apimaxDocs
DocsPricingConsole
API ReferenceIntegration GuideUser GuideChangelog

Music Series

Image Series

POSTGPT Image 2.5 Image GenerationPOSTGPT Image 2 Image GenerationPOSTGPT Image Web Image GenerationPOSTGPT Image 2.6 Image Generation

Video series

Task Management

Error Code ReferenceQuery Task StatusGET

Account Management

Query Quota UsageGET

Docs / Image Series / GPT Image / Async

AsyncPOSTImage GenerationGPT-ImageOpenAIAsyncGIFgpt-image-2.6-flaregpt-image-2.6-sunburst

GPT Image 2.6 Image Generation

GPT Image 2.6 image generation with text-to-image, image-to-image, editing, and animated GIF output with configurable frame count and per-frame duration.

POSThttps://api.apimax.ai/v1/images/async-generations
Try it
Bearer API KeyJSONServer-side call

GPT Image 2.6 (gpt-image-2.6-sunburst / gpt-image-2.6-flare) is OpenAI's new-generation image generation model, supporting text-to-image, image-to-image, image editing, and animated GIF output. This endpoint is fully compatible with the OpenAI Images API format and uses an asynchronous task mode: submission immediately returns a task ID, which you then poll through the query endpoint.

- Asynchronous mode uses a dedicated endpoint, POST /v1/images/async-generations, which returns a task_id on submission. Use the task query endpoint to fetch the result. - Generated image links are pre-signed URLs valid for about 24 hours; save them promptly.

Authentication#

All endpoints require Bearer token authentication. Create your key on the API Key management page and add it to the request header:

text
Authorization: Bearer YOUR_API_KEY

Create a task#

POST /v1/images/async-generations

Request parameters#

ParameterTypeRequiredDefaultDescription
modelstringYesgpt-image-2.6-sunburstModel name; choose either gpt-image-2.6-sunburst or gpt-image-2.6-flare
promptstringYes—The prompt describing the image to generate or edit. Up to 32,000 characters
image_urlsarrayNo—List of reference image URLs for image-to-image/image editing. 1-16 images, each < 20MB
sizestringNoautoImage size, in ratio format (e.g. 16:9) or pixel format (e.g. 1024x1024)
resolutionstringNo1KResolution tier 1K/2K/4K; only takes effect when `size` is in ratio format
qualitystringNoautoImage quality: low, medium, high, xhigh, and max; the 2.6 series supports all tiers
output_formatstringNopngOutput image format: png, jpeg, webp, gif; the 2.6 series supports GIF output
frame_countintegerNo9Total number of GIF frames, 2–16; only valid with output_format=gif, see Animated GIF output below
frame_duration_msintegerNo200Playback duration of each GIF frame in milliseconds, 20–2000, rounded to the nearest 10 ms; only valid with output_format=gif
callback_urlstringNo—HTTPS callback URL invoked when the task completes

quality#

Supported values are low, medium, high, xhigh, max, and auto. medium is the balanced tier; GPT Image 2.6's xhigh and max deliver higher-quality output.

json
{
  "model": "gpt-image-2.6",
  "prompt": "A cute cat",
  "quality": "medium"
}

size#

Two notations are supported. The default is auto (decided automatically by the model, in which case resolution has no effect).

① Ratio format (recommended, 15 options):

1:1, 1:2, 2:1, 1:3, 3:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9, 9:21, 21:9

② Explicit pixel format: WxH (or W×H), e.g. 1024x1024, 1536x1024, 3840×2160

  • Width and height must both be multiples of 16, with each side in the range [16, 3840]
  • Pixel budget: 655,360 ≤ width × height ≤ 8,294,400 (about 0.65MP to 8.29MP)
  • Aspect ratio ≤ 3:1
If a ratio + resolution combination exceeds the pixel budget, it is automatically scaled proportionally to the maximum allowed (e.g. 4K + 2:1 → 3840×1920).

resolution tiers#

Takes effect only when size is in ratio format; it is ignored for explicit pixel formats.

TierTarget pixels1:116:92:1
1K~1MP1024×10241360×7681456×720
2K~4MP2048×20482736×15362896×1456
4K~8.29MP2880×28803840×21603840×1920

Values are case-insensitive.

output_format (image format, with GIF)#

output_format selects the output image format: png (default), jpeg, webp, and gif. The 2.6 series supports gif, producing animated GIFs for stickers, looping animations, and similar use cases. See Animated GIF output below for details.

Animated GIF output#

Use the following fields when generating animated GIFs:

FieldValuesDefaultDescription
frame_count2–16 frames9Total number of frames in the animation
frame_duration_ms20–2000, rounded to the nearest 10 ms200Playback duration of each frame, in milliseconds
sizeauto, ratio format, or WIDTHxHEIGHTautoPer-frame canvas size (see below)

`size` means the per-frame size, but total pixels accumulate over frames: for GIF output, size describes the width and height of each finished frame — the dimensions the animation plays back at — and all frames share the same canvas. size follows this endpoint's notations (ratio format combined with resolution, or explicit pixel format). However, the total pixel budget is calculated as frame count × per-frame pixels, with the same cap as still images (8,294,400 pixels): for example, frame_count=9 + size=1024x1024 totals 9 × 1,048,576 ≈ 9.4MP, which exceeds the budget and returns a 400 error; with 9 frames the largest per-frame size is 960x960 (9 × 921,600 = 8,294,400 exactly). Prefer smaller frame sizes for GIF output, such as 512x512 (GIF frames are not subject to the 0.65MP minimum area that applies to still images). If the request exceeds the limits, reduce frame_count or shrink the frame dimensions — or use size=auto to let the API choose a frame size within the model's limits.

In the prompt, describe the subject, the motion, and how the animation should loop (for example, "the motion loops and returns to the starting pose") to get a natural loop. The defaults (frame_count=9, frame_duration_ms=200) correspond to a loop of roughly 1.8 seconds.

frame_count and frame_duration_ms are only valid with output_format=gif; sending them with another output format returns a 400 error.

json
{
  "model": "gpt-image-2.6-sunburst",
  "prompt": "A cat waving hello, with the motion looping back to the starting pose",
  "size": "512x512",
  "output_format": "gif",
  "frame_count": 9,
  "frame_duration_ms": 200
}

Request examples#

The request body has the same structure as the synchronous OpenAI Images API. Minimal text-to-image needs only model and prompt:

json
{
  "model": "gpt-image-2.6-sunburst",
  "prompt": "A beautiful, colorful sunset over the sea"
}

HD landscape (ratio + resolution tier + quality):

json
{
  "model": "gpt-image-2.6-sunburst",
  "prompt": "A cinematic wide shot of a futuristic city skyline at dusk",
  "size": "16:9",
  "resolution": "4K",
  "quality": "high"
}

Image-to-image / image editing (with reference images):

json
{
  "model": "gpt-image-2.6-sunburst",
  "prompt": "Add a cute kitten next to her",
  "size": "1:1",
  "resolution": "1K",
  "image_urls": ["https://example.com/input.png"],
  "callback_url": "https://your-domain.com/webhook/image-done"
}

Create task response#

On successful submission, task information is returned immediately (HTTP 200):

json
{
  "id": "task_V1StGXR8_Z5jdHi6B",
  "object": "image.generation.task",
  "type": "image",
  "status": "queued",
  "progress": 0,
  "created": 1757156493,
  "model": "gpt-image-2.6-sunburst",
  "task_info": {
    "can_cancel": true,
    "estimated_time": 100
  }
}

id is the task identifier (task_ prefix), used for subsequent queries.

Query a task#

GET /v1/tasks/{id}

bash
curl 'https://api.apimax.ai/v1/tasks/task_V1StGXR8_Z5jdHi6B' \
  --header 'Authorization: Bearer <token>'

Poll every 2-5 seconds until status becomes completed or failed.

The generated result is determined by what data actually returns: individual images may fail to generate, in which case the task still ends as completed, returning only the successful images, billed by the number of successfully generated images.

Completed (`completed`):

json
{
  "id": "task_V1StGXR8_Z5jdHi6B",
  "object": "image.generation.task",
  "type": "image",
  "status": "completed",
  "progress": 100,
  "created": 1757156493,
  "completed_at": 1757156593,
  "model": "gpt-image-2.6-sunburst",
  "data": [
    {
      "url": "https://cdn.example.com/img/.../0.png?X-Amz-Signature=...",
      "url_expires_at": 1757160193
    }
  ],
  "usage": {
    "input_tokens": 12,
    "output_tokens": 4160,
    "total_tokens": 4172
  }
}

The pre-signed URL is re-signed on every query, so polling effectively "refreshes" expired links.

Failed (`failed`):

json
{
  "id": "task_V1StGXR8_Z5jdHi6B",
  "object": "image.generation.task",
  "type": "image",
  "status": "failed",
  "failed_at": 1757156593,
  "model": "gpt-image-2.6-sunburst",
  "error": {
    "code": "upstream_error",
    "message": "openai returned 400: content_policy_violation"
  }
}

status#

StatusMeaning
queuedQueued, waiting to execute
in_progressGenerating
completedGeneration completed; data contains the image links
failedGeneration failed; see error

error.code error codes#

CodeMeaning
upstream_errorUpstream returned 4xx (content policy / invalid prompt)
upstream_unavailableUpstream still returned 5xx after multiple retries
storage_errorFailed to upload the result to cloud storage
internal_errorInternal gateway exception

If a task fails, the pre-deducted quota is automatically refunded.

Error codes (HTTP)#

Status codecodeMeaning
400invalid_requestMissing prompt/model, or incorrectly formatted parameters
400model_not_supportedModel is not in the gpt-image-* series
401unauthorizedToken is invalid or expired
403insufficient_user_quotaInsufficient quota; please top up
403(empty string)Token does not have access to this model
429rate_limit_exceededToo many requests
500internal_errorInternal server error

Callback (callback_url)#

When callback_url is set, the gateway POSTs a callback whenever the task completes / fails / is canceled. The callback body has the same format as the task query endpoint.

  • Only HTTPS is supported, callbacks to internal IPs are blocked, and the URL must be no more than 2048 characters
  • 10-second timeout; failed deliveries are retried up to 3 times (after 1s / 2s / 4s)
  • A 2xx callback response counts as success; any other status code triggers a retry

GPT Image 2.6 series models#

GPT Image 2.6 offers two available models:

  • gpt-image-2.6-sunburst: suited for general text-to-image, image-to-image, and image editing.
  • gpt-image-2.6-flare: suited for work that needs stronger lighting and visual style control.

Both models support GIF output via output_format: gif. Apart from the model name, both use the same request parameters, asynchronous task flow, and response structure — simply replace model in the request with the model you want.

Next steps

All docs
Relink Audio URLsSynchronously fetch ready-to-use audio URLs by Suno clip_id.Upsample Style TagsPolish and expand style tags and lyrics into a fuller style description.Get Style Inspiration SuggestionsGet random style or inspiration suggestions from the Suno upstream.Method 1: Create a Voice from an Existing SongCreate a vocal voice directly from a song clip already generated in this pool.Upload AudioImport user audio as a Suno-owned clip; returns an async upload task ID. With copyright=true the request switches to the copyright pipeline.Query Quota UsageUse an API key to query the remaining credits, used credits, and unlimited-quota status of the current key and its owning user.
On this page
OverviewAuthenticationCreate a taskRequest parametersqualitysizeresolution tiersoutputformat (image format, with GIF)Animated GIF outputRequest examplesCreate task responseQuery a taskstatuserror.code error codesError codes (HTTP)Callback (callbackurl)GPT Image 2.6 series modelsNext steps
API

POST /v1/images/async-generations