POST
https://octopusx.ai
/
v1
/
images
/
generations
gpt-image-2-pro Image Generation API
curl --request POST \
  --url https://octopusx.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "prompt": "<string>",
  "n": 123,
  "size": "<string>",
  "image": [
    "<string>"
  ],
  "response_format": "<string>",
  "quality": "<string>",
  "style": {},
  "background": {},
  "watermark": true
}
'
{
  "created": 1735689600,
  "data": [
    {
      "url": "https://.../images/img-pro-abc123.png",
      "revised_prompt": "A cinematic panoramic poster of a futuristic city, morning mist, deep perspective, rich details"
    }
  ]
}

gpt-image-2-pro Image Generation API

gpt-image-2-pro shares the unified image generation endpoint with gpt-image-2, but additionally exposes 2K and 4K high-resolution tiers, making it suitable for scenarios that require larger canvases and higher output sizes.
  • The unified endpoint is POST /v1/images/generations.
  • Select the target model with model = "gpt-image-2-pro".
  • In addition to the base sizes, 2K and 4K high-resolution tiers are also available.
  • Supports both url and b64_json response formats.
  • You can include image in JSON as a reference image; whether it takes effect depends on the actual image channel that is hit.

Method and Path

POST /v1/images/generations

Request Example

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-pro",
    "prompt": "A cinematic panoramic poster of a futuristic city, morning mist, deep perspective, rich details",
    "n": 1,
    "size": "3840x2160",
    "response_format": "url"
  }'

Response Example

{
  "created": 1735689600,
  "data": [
    {
      "url": "https://.../images/img-pro-abc123.png",
      "revised_prompt": "A cinematic panoramic poster of a futuristic city, morning mist, deep perspective, rich details"
    }
  ]
}

Authentication

Authorization: Bearer YOUR_API_KEY

Body

model
string
required
Must be passed as gpt-image-2-pro.
prompt
string
Generation prompt. For text-to-image use cases, this should be treated as required.
n
integer
Number of images to generate. If omitted or explicitly set to 0, the unified layer falls back to 1.
size
string
Output size. In addition to the base tiers, high-resolution extended tiers are also supported.
image
string | array<string> | object
Optional reference image input. Common formats are a Base64 string or a Base64 array.
response_format
string
Response format, common values are url and b64_json.
quality
string
Quality field. Whether it truly takes effect depends on the final channel that is hit.
style
string | object
Style field, passed through unchanged to supported upstreams.
background
string | object
Background control field, passed through unchanged to supported upstreams.
watermark
boolean
Explicit watermark switch. false is semantically different from omitting it.

High-Resolution Tiers

2K Extended Tiers

PresetActual Target Size
1:1(2K)2048x2048
4:3(2K)2048x1536
3:2(2K)2560x1712
2:3(2K)1712x2560
16:9(2K)2048x1152
9:16(2K)1152x2048

4K Extended Tiers

PresetActual Target Size
1:1(4K)2880x2880
4:3(4K)3840x2880
3:2(4K)3840x2560
2:3(4K)2560x3840
16:9(4K)3840x2160
9:16(4K)2160x3840
These high-resolution tiers reflect the target sizes exposed by the plugin side. If the upstream does not natively accept the corresponding size, the gateway or plugin may fall back to the closest official size and append the aspect ratio intent to the prompt.

Response

created
integer
Generation timestamp.
data[].url
string
The image URL returned when response_format = url.
data[].b64_json
string
The image Base64 data returned when response_format = b64_json.
data[].revised_prompt
string
Some upstreams rewrite the prompt and return it in this field.