Skip to content

GPT Image 2.6 ​

Flare / Sunburst use a dedicated 2.6 contract for static generation and editing, plus text-only GIF and SVG generation. Copy an available API model ID from the catalog in place of example/gpt-image-2.6-flare. Availability, permissions and prices come from your authorized catalog.

Quick start ​

bash
BASE_URL='https://api.tokenlio.ai'
curl "$BASE_URL/v1/images/generations" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: unique-image-request-001' \
  --data '{"model":"example/gpt-image-2.6-flare","prompt":"White tulips by a window, natural light","size":"1:1","resolution":"1k","quality":"high","complexity":"high","n":1,"output_format":"png"}'

202 means accepted, for example {"id":"dfc68868-d388-4d83-a173-d44e47a8bec7","model":"example/gpt-image-2.6-flare","status":"queued","assets":[]}. Save the ID. This is asynchronous, with no synchronous data[].b64_json response.

Request fields ​

FieldType / defaultRules
modelstring, requiredAuthorized catalog API model ID
promptstring, requiredNonempty, at most 32,000 characters
sizeoptional stringauto, aspect ratio or exact pixels; omission and explicit auto have different request identities
resolutionstring, 1k1k / 2k / 4k; omit for exact-pixel sizes
qualitystring, autolow / medium / high / xhigh / max / auto
complexitystring, highlow / medium / high
ninteger, 11–4 for static images/GIF; SVG requires 1
output_formatstring, pngpng / jpeg / webp / gif / svg, never jpg
output_compressionoptional integer0–100, JPEG / WebP only
backgroundoptional stringauto / opaque / transparent; transparent requires PNG / WebP
moderationstring, lowlow / auto
image_urlsoptional string[]Up to 16 reference images, static formats only
mask_urloptional stringPNG mask URL or Data URI, static only; requires reference images
frame_countGIF integer, 92–16; forbidden for other formats
frame_duration_msGIF integer, 200At least 20ms; forbidden for other formats

The JSON body, including Data URIs, is limited to 8 MiB. Unknown, duplicate or null fields are rejected. Integers must be numbers, not strings. Do not send stream, seed, negative_prompt, response_format, max_charge_amount, or fields selecting an internal SVG authoring model or supplying markup.

Static images and editing ​

  • Ratios: 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.
  • Exact pixels, such as 1600x1200: lowercase x; both dimensions multiples of 16; maximum edge 3840; maximum ratio 3:1; area 655,360–8,294,400 pixels.
  • References and remote masks require public HTTPS/443 direct links, with no redirects, login or extra headers. Use PNG / JPEG / WebP references, each dimension at most 6000.
  • The PNG mask needs Alpha, at most 4 MiB, and the same dimensions as the first reference. Alpha=0 identifies the editable area. A data:image/png;base64,... mask is also supported. Editing uses the same JSON generation endpoint.

GIF ​

json
{"model":"example/gpt-image-2.6-flare","prompt":"A spinning paper pinwheel, looping animation","output_format":"gif","size":"512x512","frame_count":9,"frame_duration_ms":200,"n":1}

Text-only: no references, masks, transparent background or compression. Omit size, use auto, or supply exact per-frame pixels; ratios are unsupported. Frame dimensions must be multiples of 16. The complete frame sheet must fit edge 3840, area 8,294,400 and ratio 3:1: 512² supports 2–16 frames, 768² supports up to 12, and 1024² is rejected even at 2 frames. Default/auto uses 512² frames.

One GIF file is one output object. Frame count does not multiply task token usage again.

SVG ​

json
{"model":"example/gpt-image-2.6-sunburst","prompt":"A minimal vector coffee cup icon","output_format":"svg","n":1,"complexity":"medium"}

Text-only, n=1; no references, mask, transparent background, compression or frame fields. The channel maintains SVG authoring settings; customers do not select an internal authoring model.

Poll and download original files ​

bash
TASK_ID='dfc68868-d388-4d83-a173-d44e47a8bec7'
curl "$BASE_URL/v1/tasks/$TASK_ID" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY"

Poll the same ID every 5–15 seconds, backing off on temporary errors. Continue for queued / processing; read assets for succeeded, or error.code / error.message for failed. The default image deadline is 10 minutes, frozen on acceptance. Late results do not revive expired tasks or trigger late charges.

Each asset has a role (image_0–image_3) and temporary signed url. Process the actual returned list. Signed URLs need no API Key; poll again after expiry. The authenticated content endpoint also works:

bash
curl --location "$BASE_URL/v1/tasks/$TASK_ID/content?role=image_0" \
  -H "Authorization: Bearer $TOKENLIO_API_KEY" -o result.bin

Content returns a 307 redirect. Handle files according to their returned MIME. Files are delivered as received: GIF is not split into frames and SVG is not parsed or rasterized. Use an image element for SVG previews, never inline untrusted SVG as HTML. Do not use --location-trusted; strip Authorization on cross-host redirects and keep signed links private.

Actual tokens and reservations ​

Main image charges use the task totals for text input, image input and image output. Default reference rates are $5 / $8 / $30 per million tokens; your catalog and frozen accepted rates remain authoritative. Charge those task totals once, without multiplying by n, frames or duration. Cache diagnostics do not add duplicate charges, and the first version applies no separate cache discount.

Marketplace cards show only main image rates as a rough estimate. SVG can add authoring text input/output charges, with actual components in usage records. Reasoning tokens are already included in authoring output. A missing or incomplete authoring public price waives only that component, leaving image fees due. With a valid price, missing usage waits for recovery or the deadline instead of being treated as zero.

Initial reservation H is an engineering estimate, not an official exact prediction or charge cap. Final S uses actual tokens. Combine image and SVG authoring costs before applying one order discount: H = ceil8(estimated total × discount), S = round8(actual total × discount). Release H and debit full S atomically, refunding unused reservation or charging the difference. Admitted tasks can temporarily make the balance negative; new insufficient-balance tasks are rejected. Failure/timeout releases the reservation without a customer charge.

Usage records show the three token buckets, SVG components, amounts before discount, initial reservation, final debit and both differences. GIF and SVG count as delivered output objects.

Idempotency and errors ​

  • Do not blindly retry creation POSTs. The same Key, Idempotency-Key and parameters return the original task; changed parameters give 409. Use 1–128 non-whitespace printable ASCII characters. Preserve omitted fields, especially size, on retries.
  • 400 parameters/input limits; 401/403 authentication/model permission; 402 new-task funds; 404 task identity/ownership; 409 idempotency/content readiness; 429 rate/concurrency. Back off on query 5xx; confirm acceptance before resubmitting creation.
  • Keep the task ID for investigation. HTTP 200 alone does not prove delivery or settlement.

GPT Image 2.5 retains its original API and historical billing contract. Do not send 2.6-only fields to it.

Access leading AI models through one unified API