GPT-Image-2.5 Image Generation
curl --request POST \
--url https://toapis.com/v1/images/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"quality": "<string>",
"size": "<string>",
"resolution": "<string>",
"background": "<string>",
"n": 123,
"reference_images": [
"<string>"
]
}
'import requests
url = "https://toapis.com/v1/images/generations"
payload = {
"model": "<string>",
"prompt": "<string>",
"quality": "<string>",
"size": "<string>",
"resolution": "<string>",
"background": "<string>",
"n": 123,
"reference_images": ["<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>',
quality: '<string>',
size: '<string>',
resolution: '<string>',
background: '<string>',
n: 123,
reference_images: ['<string>']
})
};
fetch('https://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://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>',
'resolution' => '<string>',
'background' => '<string>',
'n' => 123,
'reference_images' => [
'<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://toapis.com/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"quality\": \"<string>\",\n \"size\": \"<string>\",\n \"resolution\": \"<string>\",\n \"background\": \"<string>\",\n \"n\": 123,\n \"reference_images\": [\n \"<string>\"\n ]\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://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 \"resolution\": \"<string>\",\n \"background\": \"<string>\",\n \"n\": 123,\n \"reference_images\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://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 \"resolution\": \"<string>\",\n \"background\": \"<string>\",\n \"n\": 123,\n \"reference_images\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_bodyGPT-Image-2.5
GPT-Image-2.5 Image Generation
Access guide for the standard gpt-image-2.5-flare and gpt-image-2.5-sunburst tiers, including async tasks, reference images, fixed high quality, and resolution-based pricing
POST
/
v1
/
images
/
generations
GPT-Image-2.5 Image Generation
curl --request POST \
--url https://toapis.com/v1/images/generations \
--header 'Authorization: <authorization>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"prompt": "<string>",
"quality": "<string>",
"size": "<string>",
"resolution": "<string>",
"background": "<string>",
"n": 123,
"reference_images": [
"<string>"
]
}
'import requests
url = "https://toapis.com/v1/images/generations"
payload = {
"model": "<string>",
"prompt": "<string>",
"quality": "<string>",
"size": "<string>",
"resolution": "<string>",
"background": "<string>",
"n": 123,
"reference_images": ["<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>',
quality: '<string>',
size: '<string>',
resolution: '<string>',
background: '<string>',
n: 123,
reference_images: ['<string>']
})
};
fetch('https://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://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>',
'resolution' => '<string>',
'background' => '<string>',
'n' => 123,
'reference_images' => [
'<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://toapis.com/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"prompt\": \"<string>\",\n \"quality\": \"<string>\",\n \"size\": \"<string>\",\n \"resolution\": \"<string>\",\n \"background\": \"<string>\",\n \"n\": 123,\n \"reference_images\": [\n \"<string>\"\n ]\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://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 \"resolution\": \"<string>\",\n \"background\": \"<string>\",\n \"n\": 123,\n \"reference_images\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://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 \"resolution\": \"<string>\",\n \"background\": \"<string>\",\n \"n\": 123,\n \"reference_images\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_bodyThe standard tier creates an image task through
Create an API Key in the console.
Example submit response:
Save the returned
A task moves through
Replace
All three prices apply to
When switching to VIP, change the model name and the parameters together. See GPT-Image-2.5 VIP for details.
POST /v1/images/generations and returns a task ID. After the task finishes, retrieve the image URL through the status endpoint. Both models use the same request format:
| Model | model in the request |
|---|---|
| Flare | gpt-image-2.5-flare |
| Sunburst | gpt-image-2.5-sunburst |
gpt-image-2.5 is the series name. Always pass the full model name from the table.
This page covers the standard tier. To pay by actual token usage, use the separate GPT-Image-2.5 VIP documentation. Both tiers run as async tasks; the main differences are the size format and the billing model.
Note for users in mainland China: Please use
https://toapis.cn as the API endpoint (Base URL). Replace https://toapis.com with https://toapis.cn in the examples in this document.Quick Start
Set your ToAPIs API Key as theTOAPIS_API_KEY environment variable, then submit the task:
curl --fail-with-body --request POST \
--url https://toapis.com/v1/images/generations \
--header "Authorization: Bearer $TOAPIS_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2.5-flare",
"prompt": "Children's picture book style, a veterinarian listening to a baby otter's heartbeat with a stethoscope",
"quality": "high",
"size": "1:1",
"resolution": "1K",
"n": 1
}'
{
"id": "tsk_img_example",
"object": "generation.task",
"model": "gpt-image-2.5-flare",
"status": "pending",
"progress": 0,
"created_at": 1788951900,
"metadata": {}
}
id, replace TASK_ID below with that value, and query the result:
curl --fail-with-body \
--url https://toapis.com/v1/images/generations/TASK_ID \
--header "Authorization: Bearer $TOAPIS_API_KEY"
pending, queued, and in_progress, and finally reaches completed or failed. On completed, read the image URL from result.data; on failed, read error. Poll every few seconds. The full set of fields is documented in Image Task Status.
A successful submit only means the task was created. Wait until completed before downloading the image, and keep polling the same task ID while you wait.
Request Parameters
string
required
Authenticate with
Bearer YOUR_TOAPIS_API_KEY.string
required
gpt-image-2.5-flare or gpt-image-2.5-sunburst.string
required
Description of the image. When you use reference images, describe the subject to keep and the content to change.
string
default:"high"
The standard tier currently pins W8X channels to
high, so you can omit this parameter. Any other string value is ignored and high is used instead. The Playground does not expose a quality option.The standard tier is currently priced by resolution.string
default:"1:1"
Aspect ratio, for example
1:1, 3:2, 2:3, 4:3, 3:4, 5:4, 4:5, 16:9, 9:16, 21:9.We recommend using a ratio and passing resolution explicitly. The service calculates the output pixel dimensions from both values. The standard tier uses ratios, while the VIP tier uses pixel dimensions.string
default:"1K"
Resolution tier.
1K, 2K, and 4K are supported, and lowercase values are also accepted. This field determines the pricing tier for the standard tier.string
Optional background setting. Set
"transparent" to generate an image with a transparent background. Omit this field for normal image generation.Works with both text-to-image requests and requests containing reference_images.integer
default:1
Use
1 per request to generate one image.string[]
Optional list of reference image URLs. The images must be reachable by the server. For local images, obtain a URL first through the Upload Image API.
image_urls is also accepted. Use one of the two fields. The examples on this page use reference image URLs; to upload local files directly for editing, see Reference Image Editing.Ratio and Resolution Examples
| size | 1K | 2K | 4K |
|---|---|---|---|
1:1 | 1024x1024 | 2048x2048 | 2880x2880 |
3:2 | 1536x1024 | 2048x1360 | 3520x2336 |
2:3 | 1024x1536 | 1360x2048 | 2336x3520 |
16:9 | 1536x864 | 2048x1152 | 3840x2160 |
9:16 | 864x1536 | 1152x2048 | 2160x3840 |
4K is a resolution tier; the actual width and height depend on the aspect ratio. A square 4K output, for example, is 2880x2880.
Generation with Reference Images
Use the same generation endpoint and addreference_images. The example below uses Sunburst and still returns an async task:
curl --fail-with-body --request POST \
--url https://toapis.com/v1/images/generations \
--header "Authorization: Bearer $TOAPIS_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2.5-sunburst",
"prompt": "Keep the baby otter and the veterinarian from the reference image, and add a yellow scarf to the baby otter",
"reference_images": ["https://example.com/otter.png"],
"quality": "high",
"size": "1:1",
"resolution": "2K",
"n": 1
}'
https://example.com/otter.png with your own reference image URL, then query the result with the returned task ID.
Pricing
The prices below are standard prices verified on 2026-09-09, for one generated image per request. Both standard models cost the same:| resolution | USD/image |
|---|---|
| 1K | 0.015 |
| 2K | 0.020 |
| 4K | 0.025 |
low, medium, high, xhigh, and max. Reference image input currently has no additional per-image fee. Account-specific pricing or discounts may differ; check the model pricing page and your account configuration for the latest prices.
Differences from the VIP Tier
| Item | Standard | VIP |
|---|---|---|
| Model name | Without -vip | With -vip |
| Task mode | Async task; query by task ID for the image URL | Async task; query by task ID for the image URL |
| size | Ratio, such as 16:9 | Pixel dimensions, such as 1536x1024 |
| resolution | 1K, 2K, 4K | Omitted; size expresses the dimensions |
| Billing | Per-image price for the resolution | Actual text and image tokens |
| Reference images | Reference image URLs in the generation endpoint | Image file upload through the edits endpoint |