GPT-Image-2.5 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>",
"quality": "<string>",
"size": "<string>",
"background": "<string>",
"n": 123
}
'import requests
url = "https://api.toapis.com/v1/images/generations"
payload = {
"model": "<string>",
"prompt": "<string>",
"quality": "<string>",
"size": "<string>",
"background": "<string>",
"n": 123
}
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>',
quality: '<string>',
size: '<string>',
background: '<string>',
n: 123
})
};
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>',
'quality' => '<string>',
'size' => '<string>',
'background' => '<string>',
'n' => 123
]),
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 \"quality\": \"<string>\",\n \"size\": \"<string>\",\n \"background\": \"<string>\",\n \"n\": 123\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 \"quality\": \"<string>\",\n \"size\": \"<string>\",\n \"background\": \"<string>\",\n \"n\": 123\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 \"quality\": \"<string>\",\n \"size\": \"<string>\",\n \"background\": \"<string>\",\n \"n\": 123\n}"
response = http.request(request)
puts response.read_bodyGPT-Image-2.5
GPT-Image-2.5 Official Image Generation
Async Sunburst and Flare image tasks through the official channel, with R2 delivery and token pricing at 80% of official rates
POST
/
v1
/
images
/
generations
GPT-Image-2.5 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>",
"quality": "<string>",
"size": "<string>",
"background": "<string>",
"n": 123
}
'import requests
url = "https://api.toapis.com/v1/images/generations"
payload = {
"model": "<string>",
"prompt": "<string>",
"quality": "<string>",
"size": "<string>",
"background": "<string>",
"n": 123
}
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>',
quality: '<string>',
size: '<string>',
background: '<string>',
n: 123
})
};
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>',
'quality' => '<string>',
'size' => '<string>',
'background' => '<string>',
'n' => 123
]),
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 \"quality\": \"<string>\",\n \"size\": \"<string>\",\n \"background\": \"<string>\",\n \"n\": 123\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 \"quality\": \"<string>\",\n \"size\": \"<string>\",\n \"background\": \"<string>\",\n \"n\": 123\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 \"quality\": \"<string>\",\n \"size\": \"<string>\",\n \"background\": \"<string>\",\n \"n\": 123\n}"
response = http.request(request)
puts response.read_bodyAccess both GPT-Image-2.5 models through the official Azure channel. Submission returns an asynchronous task ID immediately. Images are generated in the background and stored in R2 before delivery.
Use the full model name from this table.
Save the
Submission returns
Quota is reserved at submission and reconciled against actual upstream text and image token usage on success. All five quality levels use these unit prices; there is no fixed per-image price for each quality. Sufficient account balance and API Key quota are required before submission.
Cost formula, in USD:
For example, 17 uncached text input tokens and 196 image output tokens cost
| Model | model |
|---|---|
| Sunburst Official | gpt-image-2.5-sunburst-official |
| Flare Official | gpt-image-2.5-flare-official |
gpt-image-2.5-official is a series label, not a valid request model.
For mainland China, replace https://api.toapis.com with https://api.toapis.cn. Create an API Key in the console and set the TOAPIS_API_KEY environment variable.
Submit and Query
Submit one Flare image. Change model 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.5-flare-official",
"prompt": "A small blue circle on a plain white background",
"quality": "low",
"size": "1024x1024",
"n": 1
}'
{
"id": "tsk_img_example",
"object": "generation.task",
"model": "gpt-image-2.5-flare-official",
"status": "pending",
"progress": 0,
"created_at": 1789099098,
"metadata": {}
}
id from the submission 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 return queued or in_progress, followed by completed or failed. On completed, read the R2 image URLs from result.data[].url. On failed, read error. Poll the same task ID every few seconds. High-quality generation can take several minutes; keep polling instead of submitting duplicate requests. See the image task status API for the complete response fields.
Request Parameters
string
required
Use a ToAPIs API Key as
Bearer YOUR_API_KEY. Azure credentials are not required.string
required
gpt-image-2.5-sunburst-official / gpt-image-2.5-flare-official.string
required
Describe the image. For reference-image requests, describe what to preserve and change.
string
default:"high"
Supports
low, medium, high, xhigh, and max. Quality and dimensions affect actual token usage and processing time.string
default:"1024x1024"
Use pixel dimensions such as
1024x1024, 1536x1024, or 1024x1536. Custom dimensions must pass upstream validation. These examples do not require an additional resolution field.string
Optional. Set
transparent to request a transparent background. Omit it to use the upstream default. The default PNG output preserves transparency.integer
default:1
The official channel currently generates one image per request. Use
1.Reference Image URLs
For image-to-image requests, addimage_urls to the same JSON generation request. URLs must be accessible to the server. You can obtain URLs through the image upload API. Reference images incur image input token charges. Submission and polling use the same asynchronous flow.
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.5-sunburst-official",
"prompt": "Keep the subject and replace the background with a snowy forest",
"image_urls": ["https://example.com/reference.png"],
"quality": "high",
"size": "1024x1024",
"n": 1
}'
Token Pricing
Standard prices verified on 2026-09-11. Both official models are billed at 80% of official token rates, a 20% discount:| Type | USD / 1,000,000 tokens |
|---|---|
| Text input | 4.00 |
| Cached text input | 1.00 |
| Image input | 6.40 |
| Cached image input | 1.60 |
| Image output | 24.00 |
USD = (
uncached_text_input_tokens * 4
+ cached_text_input_tokens * 1
+ uncached_image_input_tokens * 6.4
+ cached_image_input_tokens * 1.6
+ image_output_tokens * 24
) / 1,000,000
(17 * 4 + 196 * 24) / 1,000,000 = $0.004772. This is not a fixed price per image.
Account-specific pricing or discounts still apply. Verify the final charge in usage logs. Current prices follow the pricing page and your account configuration.
Related Models
The standard tier and VIP tier have their own full model names. Use the-official suffix for the channel documented here.