Images
GPT Image
POST
GPT Image
Parameters and usage are aligned with the official implementation. For detailed parameters, refer directly to the official documentation.
For multi-image reference editing, you can pass
Image editing:
Image editing:
Endpoint
https://{api_domain}/openai/v1/images/generationshttps://{api_domain}/openai/v1/images/edits
https://{api_domain}/openai/v1
Supported Models
gpt-image-2gpt-image-2-oaigpt-image-2.5-sunburst-oaigpt-image-2.5-flare-oai
Description
This endpoint is compatible with the OpenAI Image API and currently supports image generation and image editing. For detailed parameters, refer to the official OpenAI documentation:- OpenAI Official Image Generation Guide
- Images generate
- Images edit
-
Image generation requests use
application/json. -
Image editing supports
multipart/form-datafile uploads as well asapplication/json, with image references passed via theimagesarray; a JSON example is provided below. -
It is recommended to explicitly set
sizeandqualityto control image quality and cost. Fees are calculated based on actual Token usage and model pricing; usage can be viewed in theusagefield of the response.
Models and Parameters
- Use
gpt-image-2.5-sunburst-oaifor fine-grained image editing, orgpt-image-2.5-flare-oaifor fast image generation. Use the full names listed above in themodelfield of your requests. - For 2.5,
qualityacceptslow/medium/high/xhigh/max/auto, with a default ofauto; GPT Image 2 does not support the newly addedxhigh/max. - To generate images with a transparent background, set
background="transparent"and useoutput_format="png"or"webp". - Set the image size via
size, for example1024x1024,1536x1024, or1024x1536. For constraints on custom sizes and the full parameter description, refer to the official documentation.
REST API
1. Image Generation
2. Image Editing
image[] multiple times:
3. Image Editing (JSON)
Replace{base64_image} with the Base64 encoding of the input PNG image.
OpenAI SDK
Python
Node.js
Best Practices
moderation Parameter
moderation="auto"is the default standard filtering;moderation="low"indicates more lenient filtering.moderationcan be used in both image generation and image editing requests.