GPT-Image-2.5 画像生成
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 画像生成
gpt-image-2.5-flare と gpt-image-2.5-sunburst 通常版の接続ガイド。非同期タスク、参考画像、固定の high 画質、解像度ごとの課金について説明します
POST
/
v1
/
images
/
generations
GPT-Image-2.5 画像生成
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_body通常版は
API Key は コンソール で作成できます。
送信時のレスポンス例:
返された
タスクは
これら 3 つの価格は
VIP に切り替える際は、モデル名とパラメータも合わせて変更してください。詳細は GPT-Image-2.5 VIP を参照してください。
POST /v1/images/generations で画像タスクを作成し、タスク ID を返します。タスク完了後、照会エンドポイントで画像 URL を取得します。2 つのモデルは同じリクエスト形式を使用します:
| モデル | リクエストの model |
|---|---|
| Flare | gpt-image-2.5-flare |
| Sunburst | gpt-image-2.5-sunburst |
gpt-image-2.5 はシリーズ名です。呼び出し時は表の完全なモデル名を指定してください。
本ページでは通常版を説明します。実際の token に基づく課金が必要な場合は、独立した GPT-Image-2.5 VIP ドキュメント を使用してください。両版とも非同期タスクで、主な違いは size の形式と課金方法です。
中国本土のユーザー向け: 中国本土のユーザーは
https://toapis.cn を API エンドポイント(Base URL)としてご利用ください。本ドキュメント内の例では https://toapis.com を https://toapis.cn に置き換えてください。クイックスタート
自分の ToAPIs API Key を環境変数TOAPIS_API_KEY に設定し、タスクを送信します:
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 を保存し、下の TASK_ID をその値に置き換えて照会します:
curl --fail-with-body \
--url https://toapis.com/v1/images/generations/TASK_ID \
--header "Authorization: Bearer $TOAPIS_API_KEY"
pending、queued、in_progress を経て、最終的に completed または failed になります。completed の場合は result.data から画像 URL を読み取り、failed の場合は error を読み取ります。数秒ごとに 1 回照会することを推奨します。完全なフィールドは 画像タスクのステータス取得 を参照してください。
送信の成功はタスクが作成されたことを示します。completed になるまで待ってから画像をダウンロードし、待機中は同じタスク ID を照会し続けてください。
Body
string
必須
Bearer YOUR_TOAPIS_API_KEY で認証します。string
必須
gpt-image-2.5-flare または gpt-image-2.5-sunburst。string
必須
画像の説明。参考画像を使用する場合は、保持する主体と変更する内容を記述します。
string
デフォルト:"high"
現在の通常版 W8X チャネルでは
high に固定されているため、このパラメータは省略できます。他の文字列値を指定しても無視され、一律で high が使用されます。Playground には品質オプションが表示されません。現在の通常版は resolution ごとに課金されます。string
デフォルト:"1:1"
画面のアスペクト比。例:
1:1、3:2、2:3、4:3、3:4、5:4、4:5、16:9、9:16、21:9。比率を指定し、resolution も明示的に指定することを推奨します。サーバーはこの 2 つから出力ピクセルサイズを計算します。通常版の比率での指定方法は、VIP 版のピクセルサイズでの指定方法とは異なります。string
デフォルト:"1K"
解像度の段階。
1K、2K、4K に対応し、小文字形式も受け付けます。このフィールドは通常版の課金段階を決定します。string
背景の任意パラメータ.
"transparent" を指定すると透明背景の画像を生成します. 省略すると通常の画像生成になります.テキストからの生成と reference_images を含むリクエストの両方で使用できます.integer
デフォルト:1
1 リクエストにつき
1 を使用し、画像を 1 枚生成します。string[]
省略可能な参考画像の URL リスト。画像アドレスはサーバーからアクセスできる必要があります。ローカル画像は先に Upload 画像API で URL を取得してください。
image_urls にも対応しています。いずれか一方のフィールドを選択してください。本エンドポイントの例では URL の参考画像を使用します。ローカルファイルを直接アップロードして編集する場合は、VIP 画像編集 を参照してください。アスペクト比と解像度の例
| 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 は解像度の段階を表し、実際の縦横サイズはアスペクト比によって決まります。たとえば正方形の 4K 出力は 2880x2880 です。
参考画像を使った生成
同じ生成エンドポイントを使用し、reference_images を追加します。下の例では Sunburst を使用しており、戻り値は引き続き非同期タスクです:
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 を自分の参考画像 URL に置き換え、返されたタスク ID で結果を照会します。
料金
以下は 2026-09-09 時点で確認した標準価格です。1 回につき画像を 1 枚生成し、2 つの通常版モデルの価格は同じです:| resolution | USD/枚 |
|---|---|
| 1K | 0.015 |
| 2K | 0.020 |
| 4K | 0.025 |
low、medium、high、xhigh、max のいずれにも適用されます。現在、参考画像の入力に 1 枚あたりの追加費用はありません。アカウント固有の価格や割引が適用される場合があります。最新の価格は モデル料金ページ とアカウントの実際の設定を基準とします。
VIP 版との違い
| 項目 | 通常版 | VIP 版 |
|---|---|---|
| モデル名 | -vip なし | -vip 付き |
| タスク方式 | 非同期タスクで、タスク ID で画像 URL を取得 | 非同期タスクで、タスク ID で画像 URL を取得 |
| size | 比率を推奨(例:16:9) | ピクセルサイズ(例:1536x1024) |
| resolution | 1K、2K、4K | 省略し、サイズは size で指定 |
| 課金 | resolution に対応する 1 枚あたりの価格 | 実際のテキストと画像の token |
| 参考画像 | 生成エンドポイントに参考画像 URL を指定 | 編集エンドポイントで画像ファイルをアップロード |