Image Series
GPT Image 2.6 Sunburst Reference
gpt-image-2.6-sunburstgenerates images withPOST /v1/images/generationsand edits reference images withPOST /v1/images/edits.- Send
"async": trueto get a task id right away, then pollGET /v1/tasks/{id}. Asynchronous calls are recommended. - Result links are APIKO-signed and kept for 24 hours; download anything you need to keep.
- Billed by the tokens each result uses, so quality and size change the price. See Billing below.
POST
Authorizations
All requests use Bearer authentication:
Authorization: Bearer <API_KEY>.Create a key in Console → API Keys.
Routes
string
POST /v1/images/generations— text to imagePOST /v1/images/edits— edit or combine reference images (JSON body withimages)GET /v1/tasks/{id}— query an asynchronous task
Body
application/json
model
stringdefault:gpt-image-2.6-sunburstrequired
Use this exact public model id.
Available options:
gpt-image-2.6-sunburstExample:
"gpt-image-2.6-sunburst"prompt
stringrequired
Image description, at most 32,000 characters.
A prompt over 32,000 characters is rejected with HTTP 400 before any charge (
prompt is too long: at most 32000 characters).Minimum length:
1Example:
"A cinematic product photo on a marble table"size
stringdefault:1:1
Aspect ratio, rendered at the resolution tier; exact WIDTHxHEIGHT (multiples of 16, each edge at most 3840, long edge at most 3x the short, 655,360 to 8,294,400 pixels; resolution is then ignored); or auto. Sizes above 2560x1440 are experimental upstream. Omitted on /v1/images/generations = 1:1; omitted on /v1/images/edits = the first image's aspect ratio. With output_format gif: the WIDTHxHEIGHT of one frame (multiples of 16; the sheet must have each edge at most 3840 and at most 8,294,400 pixels, so 512x512 takes 2 to 16 frames and 768x768 up to 12) or auto (512x512); no aspect ratios, and resolution is not accepted.
Send a ratio from the list, or one of the sizes in the table under
resolution as WIDTHxHEIGHT (e.g. 1024x1024). Any other pixel size is rejected before any charge.Available options:
1:1, 3:2, 2:3, 4:3, 3:4, 5:4, 4:5, 16:9, 9:16, 2:1, 1:2, 21:9, 9:21, 3:1, 1:3, autoExample:
"1:1"resolution
enum<string>default:1k
Output tier for aspect-ratio sizes; omitted = 1k. Not with output_format gif.
Values are lowercase. Omit the field for the default tier. The tier sets the output size, and with it the number of output tokens billed; see the model page for estimates.
Available options:
1k, 2k, 4kExample:
"1k"quality
enum<string>default:auto
Rendering quality; billed by tokens, so higher levels cost more (a 1K medium image used about 1,450 output tokens, 1K low about 820); omitted or auto lets the model choose and bills the level it used.
Higher levels use more output tokens and cost more;
auto lets the model choose and is billed by the tokens it uses. See Billing below.Available options:
low, medium, high, xhigh, max, autoExample:
"auto"background
enum<string>default:auto
Transparent requires output_format png or webp.
Available options:
transparent, opaque, autoExample:
"auto"output_format
enum<string>default:png
Gif makes a looping animation: /v1/images/generations only, without background transparent or output_compression.
Available options:
png, jpeg, webp, gifExample:
"png"frame_count
integerdefault:9
Animation frames; only with output_format gif. All frames are drawn on one sheet and billed together: 4x2 up to 8 frames, 3x3 for 9, 4x3 up to 12, 4x4 up to 16.
Range:
2 ≤ x ≤ 16Example:
9frame_duration_ms
integerdefault:200
Milliseconds per frame, rounded to 10 ms; only with output_format gif.
Range:
20 ≤ x ≤ 2000Example:
200output_compression
integer
0-100, only for jpeg or webp.
Range:
0 ≤ x ≤ 100Example:
0moderation
enum<string>default:low
Low (default) or auto.
Available options:
auto, lowExample:
"low"user
string
A stable ID for your end user (hash it); accepted and not forwarded upstream.
Maximum length:
256images
string<uri>[]
Reference image HTTPS URLs, 1 to 16; data URLs and plain HTTP are not accepted (upload a local file with POST /v1/uploads/images first); required for /v1/images/edits.
- Accepted only by
POST /v1/images/edits, where at least one image is required. Send the edits request as JSON, not multipart form data. - Every entry must be a publicly reachable HTTPS URL; file uploads, base64 and data URLs are rejected. For a local image, upload it to
POST /v1/uploads/imagesfirst (multipart fieldfile) and pass the returnedurl; uploads are kept 72 hours. - Each reference image adds about 1,100 image-input tokens to the charge.
Items:
1–16Example:
["https://example.com/reference.png"]mask
string<uri>
Inpainting mask HTTPS URL (PNG with alpha, same size as the first image); only for /v1/images/edits; not with markup; pixels outside the mask may still change slightly.
- Public HTTPS URL. Use it with
imagesonPOST /v1/images/edits. - Use a PNG with an alpha channel, the same size as the first image in
images; transparent pixels mark the area to redraw. - Replace the example mask URL with your own: a mask that cannot be downloaded makes the task fail (refunded).
Example:
"https://example.com/mask.png"n
enum<integer>default:1
Only 1; send one request per image.
Only
1 is accepted. Send separate requests for more images.Available options:
1Example:
1response_format
enum<string>default:url
Results are always returned as APIKO-signed URLs.
Available options:
url, b64_jsonExample:
"url"async
booleandefault:false
True returns a task id; poll GET /v1/tasks/{id}.
- Recommended. With
truethe response is a task object right away; pollGET /v1/tasks/{id}until it completes. - With
falsethe request stays open until the image is ready. A request with no response after 100 seconds is closed with HTTP 524 but is still charged, and no task id comes back to fetch the image.
Example:
falsecallback_url
string<uri>
Optional public HTTPS URL notified when the task finishes.
- When the task ends in
completedorfailed, APIKO POSTs the same JSON asGET /v1/tasks/{id}with headerX-Apiko-Task-Id. - Each delivery waits up to 10 seconds; any 2xx response counts as delivered. A failed delivery is retried 3 times, after 2, 10 and 30 seconds.
- Redirects are not followed: a 3xx response counts as a failed delivery. A
callback_urlthat is not a public HTTPS URL is rejected when you submit (invalid_callback_url). - Callbacks are not signed: re-fetch the task to confirm the result.
Example:
"https://your-domain.com/webhooks/apiko-task"complexity
enum<string>default:high
Planning level, separate from quality and not billed separately: low for focused edits, high for dense text and complex layouts.
Available options:
low, medium, highExample:
"high"markup
string<uri>
Transparent PNG overlay with drawn annotations, same size as the first image, guiding the edit; only for /v1/images/edits; not with mask; the first image and the overlay at most 16,777,216 pixels each, the overlay file at most 50 MB; the overlay is not billed as image input.
Response
200 - application/json
A slightly higher amount is reserved when the request is accepted and settled by the tokens used when the task completes; a task that ends in failed is refunded in full.
id
string
Task id returned by an
async request. Use it with GET /v1/tasks/{id}.Example:
"task_abc123"status
enum<string>
Task status. Poll every 5–10 seconds until it is
completed or failed.Available options:
queued, in_progress, completed, failedprogress
string
Progress reported by the task, e.g.
"100%".data
object[]
Present when the task is
completed. Each data[].url is an APIKO-signed image link kept for 24 hours; download anything you need to keep.A synchronous request (
async omitted or false) returns { "created": …, "data": [{ "url": … }] } directly.usage
object
Present when the task is
completed: input_tokens, input_tokens_details (text_tokens, image_tokens) and output_tokens. The charge is computed from these counts; see Billing.fail_reason
string
Why the task failed. Failed tasks are refunded in full.
Image models answer one of:
the prompt or a reference image was rejected by the content safety review; change them and try again (retrying the same input fails the same way), the image service is busy or temporarily unavailable; please retry later, the request or a reference image was not accepted; check the parameters and reference images, a reference image could not be downloaded; use a public https:// image URL or upload the image, or image generation failed.GET /v1/tasks/{id}
object
The 200 response example is what submitting returns. Polling returns the task in this shape (a callback POSTs the same JSON):
Example:
Billing
Flare and Sunburst are billed by the tokens each result uses, not per image.
Token prices
per 1M tokens
- Text input:
$4.00(official $5.00) - Image input, which covers reference images:
$6.40(official $8.00) - Image output:
$24.00(official $30.00)
About 20% below OpenAI's list prices. These are the rates at the time of writing; the model page always shows the current ones.
Pre-charge and settlement
async
Submitting a request reserves a slightly higher amount from your balance. When the task completes, the charge for the tokens actually used replaces it and the difference is refunded automatically. A task that ends in
failed is refunded in full.usage
object
A completed result carries the tokens it was charged for, in the OpenAI shape.
input_tokens_details.image_tokens counts the reference images of an edit.Example:
quality
low | medium | high | xhigh | max | auto
Quality changes the price: higher levels use more output tokens. Supported values are
low, medium, high, xhigh, max and auto. When quality is omitted or auto, the model picks the quality itself; the submit-time reservation assumes medium.Output tokens at 1k: about 824 (low), 1,449 (medium), 1,756 (high), 3,122 (xhigh) and 7,024 (max); low and medium are measured, the rest come from OpenAI's token calculator. The model page lists every quality and size.
Not supported
input_fidelity, user
input_fidelity and user are not supported at the moment; do not send them. mask is supported on /v1/images/edits and is not billed as extra input.Errors
application/json
Errors use the shape { "error": { "message", "type", "param", "code" } }; most messages end with a request id to quote when you contact support.
400
error
Invalid request. Fix the request instead of retrying it; it is not charged.
- A field this page does not list, e.g.
seed is not supported. - A value outside the listed options or range, e.g.
size must be one of the documented ratios or table WxH pixels. - A missing or empty
prompt(prompt is required). - A
promptover 32,000 characters (prompt is too long: at most 32000 characters). nother than 1 (n must be 1).background: "transparent"withoutput_format: "jpeg"(background transparent requires output_format png).- A
userlonger than 256 characters (user must be a string of at most 256 characters). imagessent to/v1/images/generations(images requires the edits endpoint), or an image URL that is not HTTPS (images must contain HTTPS URLs).- More than 16
images(images must contain 1 to 16 HTTPS URLs). masksent to/v1/images/generations(mask requires the edits endpoint), or amaskthat is not HTTPS (mask must be an HTTPS URL).- An edit without
images(images is required for edits), or an edit sent as multipart form data (JSON body required). - A
callback_urlthat is not a public HTTPS URL:code: "invalid_callback_url",callback_url must be an HTTPS public URL(no request id).
401
error
Missing or invalid API key (
Invalid token).403
error
Insufficient balance (
code: "insufficient_user_quota"). Add credit in Console → Billing.404
error
GET /v1/tasks/{id} for a task that does not exist or belongs to another account (Task not found).503
error
The model exists but none of its routes can take the request right now:
No available channel for model … (code: "model_not_found"). Retry later with backoff, or pick another model. A missing or misspelled model returns 404 with the same message; check the id instead of retrying.524
error
A synchronous request (
async omitted or false) got no response within 100 seconds and the edge closed it. The request was still accepted and charged, but no task id was returned, so the image cannot be retrieved. Use "async": true for anything that may take over a minute.