Skip to main content
POST
/
v1
/
images
/
generations
curl --request POST \
  --url https://api.getinfinityblue.com/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "gpt-image-2",
  "prompt": "A cute baby sea otter floating on a blue ocean",
  "size": "1024x1024"
}
'
{
  "created": 123,
  "data": [
    {
      "b64_json": "<string>",
      "url": "<string>"
    }
  ],
  "usage": {
    "total_tokens": 123,
    "input_tokens": 123,
    "output_tokens": 123,
    "input_tokens_details": {
      "text_tokens": 123,
      "image_tokens": 123
    }
  }
}

Models you can use

Model IDNotes
gpt-image-2GPT Image 2 — flexible sizing and multiple output formats
Snapshot versions (e.g. gpt-image-2-2026-04-21) are currently unavailable. Please use gpt-image-2.

Size options (gpt-image-2)

The size parameter defaults to auto and supports flexible dimensions:
  • Maximum edge length: 3840px
  • Both width and height must be multiples of 16
  • Aspect ratio (long side to short side) must not exceed 3:1
  • Total pixel count between 655,360 and 8,294,400
Common presets: 1024x1024, 1536x1024 (landscape), 1024x1536 (portrait), 2048x2048, 2048x1152, 3840x2160, 2160x3840. Custom sizes are also supported (e.g. 1024x768), as long as both dimensions are multiples of 16 and satisfy the constraints above.

Streaming

Streaming is not currently supported. The stream and partial_images parameters are accepted but have no effect — the response is always returned as a complete JSON payload.

Quality and format

  • quality: Quality tiers are not currently supported; all requests use the auto level. The parameter is accepted but has no observable difference between levels.
  • output_format: png (default) / jpeg / webp
  • output_compression: applies to jpeg / webp only, range 0100

Authorizations

Authorization
string
header
required

Bearer token authentication, format: Authorization: Bearer sk-xxxxxx. Get your API key in the console.

Body

application/json

Image generation request body.

model
string
required

Model ID to use for image generation. Pass gpt-image-2. Snapshot versions (e.g. gpt-image-2-2026-04-21) are currently unavailable.

Example:

"gpt-image-2"

prompt
string
required

A text description of the desired image. For gpt-image-2, the maximum length is 32,000 characters.

Example:

"A cute baby sea otter floating on a blue ocean"

n
integer
default:1

The n parameter is not currently supported. Defaults to n=1, returning one image per request. To generate multiple images, call the endpoint in a loop.

Required range: 1 <= x <= 1
size
string
default:auto

Size of the generated image. For gpt-image-2, defaults to auto with flexible dimensions (max edge 3840px, both dimensions multiples of 16, aspect ratio ≤ 3:1, total pixels 655,360–8,294,400). Common presets: 1024x1024, 1536x1024, 1024x1536, 2048x2048, 2048x1152, 3840x2160, 2160x3840.

Examples:

"1024x1024"

"1536x1024"

"auto"

background
enum<string>

Background setting for the generated image. For gpt-image-2, defaults to auto; supports opaque or auto. gpt-image-2 does not support transparent — passing it returns a 400 error.

Available options:
opaque,
transparent,
auto
moderation
enum<string>

Content moderation level. For gpt-image-2, defaults to auto (standard); low applies a more permissive policy.

Available options:
auto,
low
quality
enum<string>

Quality tiers are not currently supported; all requests use the auto level. The parameter is accepted but has no observable difference between levels.

Available options:
low,
medium,
high,
auto
stream
boolean
default:false

Streaming is not currently supported. The parameter is accepted but has no effect — the response is always returned as a complete JSON payload.

style
string

Image style hint. Only supported by DALL·E 3. For gpt-image-2, the parameter is accepted but has no effect.

output_format
enum<string>

Output format of the generated image. For gpt-image-2, defaults to png; options: png, jpeg, webp. Only GPT Image models support this parameter.

Available options:
png,
jpeg,
webp
output_compression
integer

Output compression quality (0–100). For gpt-image-2, applies only when output_format is jpeg or webp.

Required range: 0 <= x <= 100
partial_images
integer
default:0

Number of intermediate partial frames when streaming (0–3). Depends on streaming support — since streaming is not currently available, this parameter has no effect.

Required range: 0 <= x <= 3
response_format
enum<string>
default:b64_json

Format in which the generated image is returned. Defaults to b64_json (Base64-encoded image data); set to url to receive a temporary access URL (download or save promptly).

Available options:
b64_json,
url
user
string

A unique identifier for your end user, useful for monitoring and abuse detection.

Response

Image generated successfully

Image generation response body.

created
integer

Unix timestamp (seconds) of creation.

Example:

1713833628

data
object[]

List of generated images.

usage
object

Token usage statistics for the request.