Skip to main content
POST
GPT-Image-2.6 Official Image Generation
Access both GPT-Image-2.6 models through the official channel. Submission returns an asynchronous task ID immediately. Images are generated in the background and stored in R2 before delivery. You must use the full model name from the table. gpt-image-2.6-official is only the series name and cannot be used as model. Users in mainland China can replace https://api.toapis.com in the examples with https://api.toapis.cn. Create an API Key in the console and set the TOAPIS_API_KEY environment variable.

Submit and poll

Submit a Flare image. Swap model to call Sunburst:
Keep the id from the submit response and replace TASK_ID below:
The submit response is pending. Polling may show queued or in_progress, ending in completed or failed. On completed read the R2-delivered result URL from result.data[].url; on failed read error. Poll the same task ID every few seconds; high-quality generation can take several minutes, so do not resubmit while waiting. See the image task status API for all fields.

Request parameters

string
required
Use a ToAPIs API Key in the form Bearer YOUR_API_KEY.
string
required
gpt-image-2.6-sunburst-official / gpt-image-2.6-flare-official.
string
required
Image description. With reference or markup images, describe what to keep and what to change.
string
default:"auto"
Aspect-ratio names (such as 1:1, 3:2, 2:3, 16:9, 9:16) or pixel sizes (such as 1024x1024, 1536x1024). For GIF output see the GIF section for size semantics. Pixel dimensions must be multiples of 16 on both sides (minimum 16), each side must not exceed 3840, and the long-to-short side ratio must not exceed 3:1; sizes beyond 2560x1440 are experimental.
string
Resolution tier 1k / 2k / 4k. When set explicitly it takes precedence over the tier inferred from size. The tier affects actual token usage and latency.
string
default:"medium"
Six tiers: auto, low, medium, high, xhigh, max. auto lets the model pick the tier per request. Quality affects actual token usage and latency.
integer
default:1
Generates 1 to 4 images per request. n must be 1 when output_format is svg.
string
Output format png / jpeg / webp / gif / svg. Uses the upstream default when omitted. See the GIF and SVG sections for their extra parameters and restrictions.
integer
Compression level 0-100, applies to jpeg and webp output only.
string
transparent / opaque / auto. Explicit transparency only applies to png / webp output; svg is transparent by default.
string
Content moderation level auto / low.
string
Generation complexity low / medium / high; defaults to high when omitted. Not billed separately.

Reference images and masks

For image-to-image editing, add image_urls to the same JSON request, up to 16 images. URLs must be reachable by the server. You can get URLs through the image upload API first. Reference images are billed as image input tokens. mask_url points to a PNG alpha mask whose size must match the first reference image, and it requires image_urls.

Markup-guided editing

markup_url points to an annotated reference image (or pass an inline annotation object via markup). Together with image_urls for the source image, the model edits according to the annotations. markup_url and mask_url are mutually exclusive; each request can use only one.

GIF output

Set output_format to gif to generate an animation. frame_count sets the frame count (2-16) and frame_duration_ms sets the per-frame duration. GIF is text-to-image only and cannot be combined with image_urls, mask_url, markup_url, markup, or output_compression. Pass size as an exact pixel size (for example 512x512) or omit it to use the upstream default frame dimensions; aspect-ratio values such as 1:1 are rejected for GIF.

SVG output

Set output_format to svg to generate vector graphics. You must also pass the svg object with svg.model inside. SVG is text-to-image only, n must be 1, and it cannot be combined with image_urls, mask_url, markup_url, markup, or output_compression. SVG generation additionally invokes the text model named by svg.model and bills that call at the corresponding text-model rate.

Token pricing

Both official models bill per token category: text input, cached text input, image input, cached image input, and image output are priced separately. Quota is reserved on submission, then settled against actual token usage with refunds or top-ups. Cost formula in USD:
GIF is billed on the output tokens of the whole animation. SVG output additionally produces one text-model call at the svg.model rate on top of image tokens. Account-specific pricing or discounts still apply. Final charges can be verified in usage logs; the latest prices are on the pricing page and in your account configuration. GPT-Image-2.5 Official, standard, and VIP editions use their own full model names. Use the -official suffix when calling this official channel.