Skip to main content
POST

Introduction

The image generation endpoint generates images through POST /v1/images/generations and supports workflows such as text-to-image, image-to-image, and image editing. This endpoint uses an OpenAI Images API-compatible format. The main examples currently use gpt-image-2, which has been verified successfully.
Use the full model IDs returned by GET /v1/models. Do not use legacy aliases or shortened names.
Gemini image models use the native Gemini endpoint POST /v1/models/{model}:generateContent; they do not use POST /v1/images/generations.

API Base URL

Authentication

Use a Bearer Token:

Request Body

string
required
The image model ID to call. We recommend calling GET /v1/models when your application starts to retrieve the current list of available models.
string
The prompt for text-to-image or image editing.
string
Output image size. Common values include 1024x1024, 1024x1536, and 1536x1024. Some models support higher resolutions or size values in different formats.
string
Image quality. Common values for the GPT Image series are "low", "medium", and "high".
integer
Number of images to generate. The GPT Image series supports 1-10.
string
Response format. Pass this only when the selected model explicitly supports it, such as "url" or "b64_json". gpt-image-2 currently does not accept this parameter, so omit it when calling that model.
string
A single input image, as an image URL or Base64/Data URL. Use this for image-to-image or editing workflows.
array
An array of input images. Use this for multi-image fusion or multi-reference image editing.
string
Input fidelity. GPT Image image-to-image workflows can use "auto", "high", "medium", or "low".
object
The native input object for Qwen image models. The common structure is input.messages[].content[], where content can include text or image.
object
The parameter object for Qwen image models, such as size, seed, watermark, negative_prompt, prompt_extend, and n.
array
Image context input for the Seedream series. Content can include image URLs, Data URLs, or text parts. Exact capabilities depend on the model version and account routing channel.

Basic Examples


Model-Specific Parameters

GPT Image

string
Image size. Supports 1024x1024, 1024x1536, and 1536x1024.
string
Image quality: "low", "medium", or "high".
integer
Number of images to generate, from 1-10.
string
Input fidelity, used only in image-to-image or editing mode: "auto", "high", "medium", or "low".

Qwen

object
Native message object. Pass text for text-to-image. For image editing, pass both image and text.
object
Generation parameter object:
  • size: image size, such as "1024*1024"
  • seed: random seed, from 0-2147483647
  • watermark: whether to add a watermark
  • prompt_extend: whether to enable prompt expansion
  • negative_prompt: negative prompt
  • n: number of output images

Seedream

string
Image size. Seedream 4.x/5.x commonly uses 2K/4K sizes such as 2048x2048, 2304x1728, 1728x2304, 2560x1440, and 1440x2560.
boolean
Whether to add a watermark.
integer
Random seed for controlling generation randomness. The value range is 0-2147483647.
array
Image context input. Seedream 4.x/5.x usually supports single-image or multi-image input; actual availability depends on the model version and account routing channel.
string
Group image generation switch: "disabled" or "auto".
object
Prompt optimization options, such as {"mode": "standard"} or {"mode": "fast"}.

Supported Models

The following models come from the current image-related model list returned by GET /v1/models.

GPT Image Series

Qwen Series

Seedream Series

Gemini Image Series


Best Practices

Model Selection

  • Prefer gpt-image-2 as the general-purpose model for /v1/images/generations in new projects.
  • When you need Chinese and English text rendering, test qwen-image-2.0-pro first.
  • When you need image editing, test gpt-image-2 or qwen-image-edit-max first.
  • When you need Gemini/Nano Banana image capabilities, use the native Gemini image endpoint instead of the Images API endpoint.

Prompt Suggestions

  • Clearly specify the subject, style, lighting, composition, and intended output use.
  • When you need text rendering, put the text to render in quotation marks.
  • For image-to-image, explain which elements should be preserved and which should be changed.
  • For multi-image fusion, clearly define each reference image’s role, such as “use the first image as the style reference and the second image as the subject content.”

FAQ

The current model list is based on the full model IDs returned by GET /v1/models. Legacy aliases or shortened names may fail to route to an available channel.
Gemini image models currently use the native Gemini endpoint: POST /v1/models/{model}:generateContent. POST /v1/images/generations is not the right primary call path for Gemini image models.
The GPT Image series uses the n parameter to control the number of generated images. Whether Qwen and Seedream support multiple outputs depends on the model and account routing channel.
It depends on the model and parameters. The GPT Image series usually returns b64_json, and gpt-image-2 currently does not accept the response_format parameter. Qwen and Seedream response formats depend on the model implementation and account routing channel.