GPT-Image-2.5 公式チャネルの画像生成
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 公式チャネルの画像生成
Sunburst と Flare の非同期画像タスク, R2 への保存, 公式料金の 80% によるトークン課金
POST
/
v1
/
images
/
generations
GPT-Image-2.5 公式チャネルの画像生成
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_bodyAzure 公式チャネル経由で 2 つの GPT-Image-2.5 モデルを利用できます. 送信すると非同期タスク ID がすぐに返ります. バックグラウンドで画像を生成し, R2 に保存してから提供します.
表にある完全なモデル名を指定してください.
送信レスポンスの
送信時の状態は
送信時にクォータを仮確保し, 成功後に上流の実際のテキストと画像のトークン使用量に基づいて差額を精算します. 5 段階の品質で同じ単価を使用し, 品質別の画像 1 枚あたりの固定料金はありません. 送信前に十分な残高と API Key クォータが必要です.
USD 単位の料金計算式:
例として, 未キャッシュのテキスト入力 17 tokens と画像出力 196 tokens の料金は
| モデル | model |
|---|---|
| Sunburst Official | gpt-image-2.5-sunburst-official |
| Flare Official | gpt-image-2.5-flare-official |
gpt-image-2.5-official はシリーズ名であり, リクエストの model には指定できません.
中国本土では https://api.toapis.com を https://api.toapis.cn に置き換えてください. コンソール で API Key を作成し, 環境変数 TOAPIS_API_KEY に設定します.
送信と照会
Flare で画像を 1 枚生成します. Sunburst を使う場合は model を変更してください: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 を保存し, 以下の TASK_ID に指定します:
curl --fail-with-body \
--url https://api.toapis.com/v1/images/generations/TASK_ID \
--header "Authorization: Bearer $TOAPIS_API_KEY"
pending です. 照会時は queued または in_progress を経て, completed または failed になります. completed では result.data[].url から R2 の画像 URL を取得し, failed では error を確認します. 同じタスク ID を数秒おきに照会してください. 高品質の生成には数分かかる場合があるため, 重複送信せず照会を続けてください. 全フィールドは 画像タスク状態 API を参照してください.
リクエストパラメーター
string
必須
ToAPIs API Key を
Bearer YOUR_API_KEY 形式で指定します. Azure の認証情報は不要です.string
必須
gpt-image-2.5-sunburst-official / gpt-image-2.5-flare-official.string
必須
生成する画像の説明です. 参照画像を使う場合は, 維持する部分と変更する部分を指定します.
string
デフォルト:"high"
low, medium, high, xhigh, max に対応します. 品質とサイズにより実際のトークン使用量と処理時間が変わります.string
デフォルト:"1024x1024"
1024x1024, 1536x1024, 1024x1536 などのピクセル寸法を指定します. カスタム寸法は上流の検証条件を満たす必要があります. この例では追加の resolution は不要です.string
省略可能です. 透明背景を指定するには
transparent を設定します. 省略時は上流のデフォルトを使用します. デフォルトの PNG 出力は透明度を保持できます.integer
デフォルト:1
現在, 公式チャネルでは 1 回のリクエストで画像を 1 枚生成します.
1 を指定してください.参照画像 URL
画像から画像を生成する場合, 同じ JSON 生成リクエストにimage_urls を追加します. サーバーからアクセス可能な URL を使ってください. 画像アップロード API で URL を取得できます. 参照画像には画像入力トークン料金が発生します. 送信と照会は同じ非同期フローです.
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
}'
トークン料金
2026-09-11 に確認した標準料金です. 両方の公式モデルは公式トークン料金の 80%, つまり 20% 割引で課金されます:| 種類 | USD / 1,000,000 tokens |
|---|---|
| テキスト入力 | 4.00 |
| キャッシュ済みテキスト入力 | 1.00 |
| 画像入力 | 6.40 |
| キャッシュ済み画像入力 | 1.60 |
| 画像出力 | 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 です. 画像 1 枚あたりの固定料金ではありません.
アカウント別の料金や割引も適用されます. 最終請求は使用ログで確認できます. 最新料金は 料金ページ とアカウント設定に従います.
関連モデル
通常版 と VIP 版 にはそれぞれ完全なモデル名があります. この公式チャネルでは-official 接尾辞を使用してください.