GPT-Image-2.6 Official Image Generation
curl --request POST \
--url https://api.toapis.com/v1/images/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"size": "<string>",
"resolution": "<string>",
"quality": "<string>",
"n": 123,
"output_format": "<string>",
"output_compression": 123,
"background": "<string>",
"moderation": "<string>",
"complexity": "<string>"
}
'import requests
url = "https://api.toapis.com/v1/images/generations"
payload = {
"model": "<string>",
"prompt": "<string>",
"size": "<string>",
"resolution": "<string>",
"quality": "<string>",
"n": 123,
"output_format": "<string>",
"output_compression": 123,
"background": "<string>",
"moderation": "<string>",
"complexity": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
prompt: '<string>',
size: '<string>',
resolution: '<string>',
quality: '<string>',
n: 123,
output_format: '<string>',
output_compression: 123,
background: '<string>',
moderation: '<string>',
complexity: '<string>'
})
};
fetch('https://api.toapis.com/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.toapis.com/v1/images/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'prompt' => '<string>',
'size' => '<string>',
'resolution' => '<string>',
'quality' => '<string>',
'n' => 123,
'output_format' => '<string>',
'output_compression' => 123,
'background' => '<string>',
'moderation' => '<string>',
'complexity' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.toapis.com/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"size\": \"<string>\",\n \"resolution\": \"<string>\",\n \"quality\": \"<string>\",\n \"n\": 123,\n \"output_format\": \"<string>\",\n \"output_compression\": 123,\n \"background\": \"<string>\",\n \"moderation\": \"<string>\",\n \"complexity\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.toapis.com/v1/images/generations")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"size\": \"<string>\",\n \"resolution\": \"<string>\",\n \"quality\": \"<string>\",\n \"n\": 123,\n \"output_format\": \"<string>\",\n \"output_compression\": 123,\n \"background\": \"<string>\",\n \"moderation\": \"<string>\",\n \"complexity\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.toapis.com/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"size\": \"<string>\",\n \"resolution\": \"<string>\",\n \"quality\": \"<string>\",\n \"n\": 123,\n \"output_format\": \"<string>\",\n \"output_compression\": 123,\n \"background\": \"<string>\",\n \"moderation\": \"<string>\",\n \"complexity\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyGPT-Image-2.6
GPT-Image-2.6 Official Image Generation
Async Sunburst and Flare image tasks through the official channel, with markup-guided editing, GIF and SVG output, R2 delivery and token pricing
POST
/
v1
/
images
/
generations
GPT-Image-2.6 Official Image Generation
curl --request POST \
--url https://api.toapis.com/v1/images/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"size": "<string>",
"resolution": "<string>",
"quality": "<string>",
"n": 123,
"output_format": "<string>",
"output_compression": 123,
"background": "<string>",
"moderation": "<string>",
"complexity": "<string>"
}
'import requests
url = "https://api.toapis.com/v1/images/generations"
payload = {
"model": "<string>",
"prompt": "<string>",
"size": "<string>",
"resolution": "<string>",
"quality": "<string>",
"n": 123,
"output_format": "<string>",
"output_compression": 123,
"background": "<string>",
"moderation": "<string>",
"complexity": "<string>"
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: '<string>',
prompt: '<string>',
size: '<string>',
resolution: '<string>',
quality: '<string>',
n: 123,
output_format: '<string>',
output_compression: 123,
background: '<string>',
moderation: '<string>',
complexity: '<string>'
})
};
fetch('https://api.toapis.com/v1/images/generations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.toapis.com/v1/images/generations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'prompt' => '<string>',
'size' => '<string>',
'resolution' => '<string>',
'quality' => '<string>',
'n' => 123,
'output_format' => '<string>',
'output_compression' => 123,
'background' => '<string>',
'moderation' => '<string>',
'complexity' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.toapis.com/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"size\": \"<string>\",\n \"resolution\": \"<string>\",\n \"quality\": \"<string>\",\n \"n\": 123,\n \"output_format\": \"<string>\",\n \"output_compression\": 123,\n \"background\": \"<string>\",\n \"moderation\": \"<string>\",\n \"complexity\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.toapis.com/v1/images/generations")
.header("Authorization", "<authorization>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"size\": \"<string>\",\n \"resolution\": \"<string>\",\n \"quality\": \"<string>\",\n \"n\": 123,\n \"output_format\": \"<string>\",\n \"output_compression\": 123,\n \"background\": \"<string>\",\n \"moderation\": \"<string>\",\n \"complexity\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.toapis.com/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"size\": \"<string>\",\n \"resolution\": \"<string>\",\n \"quality\": \"<string>\",\n \"n\": 123,\n \"output_format\": \"<string>\",\n \"output_compression\": 123,\n \"background\": \"<string>\",\n \"moderation\": \"<string>\",\n \"complexity\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyAccess 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.
Keep the
The submit response is
GIF is billed on the output tokens of the whole animation. SVG output additionally produces one text-model call at the
| Model | model |
|---|---|
| Sunburst Official | gpt-image-2.6-sunburst-official |
| Flare Official | gpt-image-2.6-flare-official |
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. Swapmodel to call Sunburst:
curl --fail-with-body --request POST \
--url https://api.toapis.com/v1/images/generations \
--header "Authorization: Bearer $TOAPIS_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2.6-flare-official",
"prompt": "A small blue circle on a plain white background",
"size": "1:1",
"resolution": "1k",
"quality": "medium",
"n": 1
}'
{
"id": "tsk_img_example",
"object": "generation.task",
"model": "gpt-image-2.6-flare-official",
"status": "pending",
"progress": 0,
"created_at": 1789099098,
"metadata": {}
}
id from the submit response and replace TASK_ID below:
curl --fail-with-body \
--url https://api.toapis.com/v1/images/generations/TASK_ID \
--header "Authorization: Bearer $TOAPIS_API_KEY"
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, addimage_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.
curl --fail-with-body --request POST \
--url https://api.toapis.com/v1/images/generations \
--header "Authorization: Bearer $TOAPIS_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2.6-sunburst-official",
"prompt": "Keep the subject and replace the masked area with a snowy forest",
"image_urls": ["https://example.com/reference.png"],
"mask_url": "https://example.com/mask.png",
"quality": "high",
"size": "1024x1024",
"n": 1
}'
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.
curl --fail-with-body --request POST \
--url https://api.toapis.com/v1/images/generations \
--header "Authorization: Bearer $TOAPIS_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2.6-sunburst-official",
"prompt": "Follow the markup annotations to adjust the layout",
"image_urls": ["https://example.com/reference.png"],
"markup_url": "https://example.com/markup.png",
"quality": "high",
"n": 1
}'
GIF output
Setoutput_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.
curl --fail-with-body --request POST \
--url https://api.toapis.com/v1/images/generations \
--header "Authorization: Bearer $TOAPIS_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2.6-flare-official",
"prompt": "A paper airplane looping across a blue sky, flat illustration",
"output_format": "gif",
"frame_count": 8,
"frame_duration_ms": 200,
"size": "512x512",
"n": 1
}'
SVG output
Setoutput_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.
curl --fail-with-body --request POST \
--url https://api.toapis.com/v1/images/generations \
--header "Authorization: Bearer $TOAPIS_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2.6-flare-official",
"prompt": "A minimalist mountain logo, flat vector style",
"output_format": "svg",
"svg": { "model": "gpt-5" },
"n": 1
}'
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:USD = (
uncached_text_input_tokens * text_input_price
+ cached_text_input_tokens * cached_text_input_price
+ uncached_image_input_tokens * image_input_price
+ cached_image_input_tokens * cached_image_input_price
+ image_output_tokens * image_output_price
) / 1,000,000
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.
Related models
GPT-Image-2.5 Official, standard, and VIP editions use their own full model names. Use the-official suffix when calling this official channel.