Skip to content

GPT image generation ​

Use POST /v1/images/generations as the unified GPT image generation endpoint; see Available models below for selectable models.

http
POST /v1/images/generations
  • Choose the target model with .
  • Supports and response formats.
  • You may attach in JSON as a reference image; whether it takes effect depends on the image channel that is hit.
  • If is omitted or explicitly set to , the unified layer falls back to .

Available models ​

ModelDescription
Current selectable model for the GPT image generation unified endpoint

Headers ​

NameTypeRequiredDescription
stringYesRequest authentication. Use a Bearer Token, for example:
stringYesRequest content type; must be

Request body ​

NameTypeRequiredDescription
stringYesModel ID; see Available models above
stringNoGeneration prompt. Treat as required for text-to-image
integerNoNumber of images. If omitted or explicitly set to , the unified layer falls back to
stringNoOutput size. Supports (default) and any : width and height must be multiples of 16, aspect ratio between –, longest side ≤ , total pixels – (above is experimental). Common presets are listed below
string | array | objectNoOptional reference image. Common forms are a Base64 string or a Base64 array
stringNoResponse format: /
stringNoQuality: / / / (default). Whether it takes effect depends on the channel that is hit
string | objectNoStyle field; passed through as-is to supporting upstreams
string | objectNoBackground control. Official support is / (default) only; is not supported
stringNoOutput format: (default) / /
integerNoCompression level –; only applies to /
stringNoContent moderation strength: (default) /
booleanNoExplicit watermark switch. differs from omitting the field

Aspect ratio and size presets ​

PresetTarget size

If the actual channel does not natively accept the target size, the gateway or plugin falls back to a closer official size and appends the aspect-ratio intent to the prompt.

Request example ​

bash
curl -X POST https://octopusx.ai/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "A modern API platform homepage illustration, white background, teal-blue blocks, clean whitespace",
    "n": 1,
    "size": "1536x1024",
    "response_format": "url"
  }'

Response example ​

200 - URL ​

json
{
  "created": 1735689600,
  "data": [
    {
      "url": "https://example.com/images/img-abc123.png",
      "revised_prompt": "A modern API platform homepage illustration, white background, teal-blue blocks, clean whitespace"
    }
  ]
}

200 - Base64 ​

json
{
  "created": 1735689600,
  "data": [
    {
      "b64_json": "<BASE64_IMAGE_DATA>",
      "revised_prompt": "A modern API platform homepage illustration, white background, teal-blue blocks, clean whitespace"
    }
  ]
}

Response fields ​

NameTypeDescription
integerGeneration timestamp
arrayArray of generation results
stringImage URL when is
stringImage Base64 data when is
stringSome upstreams rewrite the prompt and return it in this field