Model

Create image

Generate images from a text prompt.

POST /model/v1/images/generations● Supported

Official docs ↗

Request body

  • modelstring必填

    Image model id; list candidates with listModels?type=image. Router support (supported): Verified to take effect.

    Verified to take effect.

  • response_formatstring可选◐ Partially supported

    Image response encoding. Only b64_json is accepted; url returns 400.

    gpt-image-2 supports b64_json; url returns 400.

    取值 b64_json
  • promptstring必填

    Text description of the image to generate. Router support (supported): Verified to take effect.

    Verified to take effect.

  • ninteger可选
    默认 1

    Number of images to generate, from 1 to 10; defaults to 1. Router support (supported): Controls image count; zero returns 400 and values 1–10 are accepted.

    Controls image count; zero returns 400 and values 1–10 are accepted.

  • sizestring可选◐ Partially supported

    Size of the generated images. Router support (partial): gpt-image-2 supports tested 1024x1024 and 1024x1536 sizes; 512x512 returns 400.

    gpt-image-2 supports tested 1024x1024 and 1024x1536 sizes; 512x512 returns 400.

    取值 1024x10241024x15361536x1024auto
  • qualitystring可选

    Quality of the generated images. Router support (supported): Verified to take effect.

    Verified to take effect.

    取值 lowmediumhighauto
  • backgroundstring可选

    transparent returns a transparent PNG on gpt-image-2.

  • output_formatstring可选

    jpeg returns JPEG on gpt-image-2.

Returns

200

Platform errors (auth, rate limits, validation) and OCR errors use problem+json; other model call errors follow the endpoint's own format (OpenAI or Anthropic) — see error codes

Response

HTTP 200

Image generation response

application/json

NameTypeDescription
createdintegerUnix time in seconds at which the images were created.
dataarray<object>Generated images.
data[].urlstringURL of the image; present when response_format is `url`.
data[].b64_jsonstringBase64-encoded image; present when response_format is `b64_json`.
data[].revised_promptstringPrompt after the image model rewrote it, when the model reports it.