curl --request POST \
--url https://api.apiyi.com/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2.5-vip",
"prompt": "Cinematic landscape, old lighthouse by the sea at dusk, photorealistic"
}
'import requests
url = "https://api.apiyi.com/v1/images/generations"
payload = {
"model": "gpt-image-2.5-vip",
"prompt": "Cinematic landscape, old lighthouse by the sea at dusk, photorealistic"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'gpt-image-2.5-vip',
prompt: 'Cinematic landscape, old lighthouse by the sea at dusk, photorealistic'
})
};
fetch('https://api.apiyi.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.apiyi.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' => 'gpt-image-2.5-vip',
'prompt' => 'Cinematic landscape, old lighthouse by the sea at dusk, photorealistic'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.apiyi.com/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"gpt-image-2.5-vip\",\n \"prompt\": \"Cinematic landscape, old lighthouse by the sea at dusk, photorealistic\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.apiyi.com/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-image-2.5-vip\",\n \"prompt\": \"Cinematic landscape, old lighthouse by the sea at dusk, photorealistic\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"gpt-image-2.5-vip\",\n \"prompt\": \"Cinematic landscape, old lighthouse by the sea at dusk, photorealistic\"\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"b64_json": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
}
],
"created": 1778037127,
"usage": {
"input_tokens": 98,
"output_tokens": 1185,
"total_tokens": 1283
}
}テキストから画像生成 API リファレンス
gpt-image-2-vip のテキストから画像生成 API リファレンスとインタラクティブなプレイグラウンド — テキストとサイズから画像を生成します。全サイズ一律で $0.03/画像
curl --request POST \
--url https://api.apiyi.com/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2.5-vip",
"prompt": "Cinematic landscape, old lighthouse by the sea at dusk, photorealistic"
}
'import requests
url = "https://api.apiyi.com/v1/images/generations"
payload = {
"model": "gpt-image-2.5-vip",
"prompt": "Cinematic landscape, old lighthouse by the sea at dusk, photorealistic"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'gpt-image-2.5-vip',
prompt: 'Cinematic landscape, old lighthouse by the sea at dusk, photorealistic'
})
};
fetch('https://api.apiyi.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.apiyi.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' => 'gpt-image-2.5-vip',
'prompt' => 'Cinematic landscape, old lighthouse by the sea at dusk, photorealistic'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.apiyi.com/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"gpt-image-2.5-vip\",\n \"prompt\": \"Cinematic landscape, old lighthouse by the sea at dusk, photorealistic\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.apiyi.com/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"gpt-image-2.5-vip\",\n \"prompt\": \"Cinematic landscape, old lighthouse by the sea at dusk, photorealistic\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"gpt-image-2.5-vip\",\n \"prompt\": \"Cinematic landscape, old lighthouse by the sea at dusk, photorealistic\"\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"b64_json": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
}
],
"created": 1778037127,
"usage": {
"input_tokens": 98,
"output_tokens": 1185,
"total_tokens": 1283
}
}Bearer sk-xxx)を入力し、promptとsizeを設定して、送信をクリックしてください。sizeを入力するだけです。既存の画像を編集または合成する場合は、画像編集エンドポイントをご利用ください。gpt-image-2-allとの違い: 呼び出し構造は同一で、sizeフィールドが1つ追加されているだけです。サイズを固定する必要がなく、最速の出力を希望される場合は、代わりにgpt-image-2-allをご利用ください。b64_json)を返します。これは数MBになる場合があるため、ブラウザのPlaygroundに请求时发生错误: unable to complete requestと表示されることがあります — リクエスト自体は実際には成功しています。ブラウザ側でこれほど長いbase64文字列をレンダリングできないだけです。推奨されるワークフロー: 以下のコードサンプルをコピーしてローカルで実行してください — 画像を自動的にデコードしてファイルに保存します。size: モデルに選択させる場合はautoを渡し(vipは指定されたpromptに対して比較的固定/安定したサイズに収束する傾向があります)、厳密に固定したい場合はサポートされている30種類のサイズ(10種類のアスペクト比 × 1K Fast / 2K Recommended / 4K Detail — 概要ページの全サイズ一覧表を参照)から1つ選択してください。小文字のアスキー文字xを使用してください(例:2048x1360、3840x2160)。決して×や大文字のXは使用しないでください。quality: 任意であり、テストにおいて有効です(チャンネルの挙動であり確約ではありません — 実際のレスポンスをご確認ください)。2.5モデル(gpt-image-2.5-vip=gpt-image-2.5-sunburst-vip、gpt-image-2.5-flare-vip)は、auto/low/medium/high/xhigh/maxの6つのティアすべてを受け付けます。gpt-image-2-vipはhighまでとなり、xhigh/maxは拒否されます。同名のティアでも同等ではありません。2.5のhighはgpt-image-2-vipのmediumにのみ一致し、2.5のmaxはそのhighに一致します。画像1枚あたり一律$0.03という価格はティアによって変わりませんが、上位ティアほど時間がかかります。n: ❌ 拒否されます — 1回の呼び出しにつき画像1枚です。n=3を送信すると3倍課金されますが、返される画像は1枚のままです。 このフィールドは除外してください。aspect_ratio: ❌ 拒否されます — アスペクト比はsizeによって決定されます。response_format: 省略するとbase64が返されます(プレフィックスなしの生データ、2026-07検証済み)。画像URLを取得するには"url"を渡してください。URL出力に依存するビジネスでは、base64へのフォールバックなしで確実にURLを出力するために、tokenをimage2_OSSグループに切り替えてください。
コード例
Python
import requests
API_KEY = "sk-your-api-key"
response = requests.post(
"https://api.apiyi.com/v1/images/generations",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"model": "gpt-image-2.5-vip",
"prompt": "Cinematic landscape, old lighthouse by the sea at dusk, photorealistic",
"size": "2048x1152", # 16:9 2K Recommended
"response_format": "url" # defaults to base64; explicit response_format needed to read the url field
},
timeout=300 # conservative; absorbs long-tail and image download
).json()
image_url = response["data"][0]["url"]
print(image_url)
import requests
response = requests.post(
"https://api.apiyi.com/v1/images/generations",
headers={"Authorization": "Bearer sk-your-api-key"},
json={
"model": "gpt-image-2.5-vip",
"prompt": "Desktop wallpaper, cyberpunk city night, neon signs, wet pavement reflections",
"size": "3840x2160" # 16:9 4K Detail
},
timeout=300
).json()
# Verified 2026-07: b64_json is raw base64 (no data: prefix); earlier versions included the prefix — a check is safest
import base64
b64 = response["data"][0]["b64_json"]
if b64.startswith("data:"):
b64 = b64.split(",", 1)[1]
with open("wallpaper.png", "wb") as f:
f.write(base64.b64decode(b64))
cURL
curl -X POST "https://api.apiyi.com/v1/images/generations" \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2.5-vip",
"prompt": "Product shot of a white ceramic mug on a gray desk, soft natural light",
"size": "2048x1360"
}'
Node.js
const API_KEY = "sk-your-api-key";
const response = await fetch(
"https://api.apiyi.com/v1/images/generations",
{
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "gpt-image-2.5-vip",
prompt: "1:1 square logo, minimalist cat line art",
size: "2048x2048" // 1:1 2K Recommended
})
}
);
const data = await response.json();
// Verified raw base64 (no data: prefix) — prepend before rendering; earlier versions included the prefix, so check first
let b64 = data.data[0].b64_json;
if (!b64.startsWith("data:")) b64 = `data:image/png;base64,${b64}`;
document.getElementById("result").src = b64;
OpenAI SDK(Python、推奨)
from openai import OpenAI
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://api.apiyi.com/v1"
)
resp = client.images.generate(
model="gpt-image-2.5-vip",
prompt="Ink wash landscape painting, traditional Chinese style, vertical composition",
size="1536x2048", # 3:4 2K Portrait
)
print(resp.data[0].url)
パラメータ
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
model | string | はい | gpt-image-2.5-vip (= gpt-image-2.5-sunburst-vip) / gpt-image-2.5-flare-vip / 前世代の gpt-image-2-vip、価格と呼び出し形式は同じ |
prompt | string | はい | Prompt — コンテンツ、スタイル、ライティングなどを記述します。 |
size | string | 強く推奨 | 出力サイズ: auto(モデルが決定 — 特定の prompt に対して vip は比較的固定されます)または30種類のサイズのいずれか。フォーマット WIDTHxHEIGHT(小文字の x)。フィールドを省略すると auto と同じです。 |
- Eコマースのメインビジュアル:
2048x1360(3:2 2K) /2048x2048(1:1 2K) - 縦型ポスター:
1536x2048(3:4 2K) /2480x3312(3:4 4K) - 動画サムネイル:
2048x1152(16:9 2K) /3840x2160(16:9 4K) - ストーリー / スマートフォン用壁紙:
1152x2048(9:16 2K) /2160x3840(9:16 4K)
レスポンス形式
デフォルトでは base64 を返します(data[0].b64_json、プレフィックスなしの raw base64、2026-07 に検証済み)。代わりに 画像 URL を取得するには、response_format: "url" を明示的に指定してください。URL 出力に依存するビジネスは、base64 フォールバックなしで安定した URL 出力を得るために、token のグループを image2_OSS に切り替えてください。data[0] は url または b64_json のいずれかを返します — 両方が返ることはありません。
b64_json モード(デフォルト):
{
"data": [
{
"b64_json": "iVBORw0KGgoAAAANSUhEUgAA..."
}
],
"created": 1778037127,
"usage": {
"input_tokens": 98,
"output_tokens": 1185,
"total_tokens": 1283
}
}
url モード(response_format: "url" を明示的に指定してください。URL に依存する場合は image2_OSS グループを使用してください — R2 CDN によりグローバルに高速化されています):
{
"data": [
{
"url": "https://r2cdn.copilotbase.com/r2cdn2/0e82148a-bec0-4b42-bbca-117c6b42581b.png"
}
],
"created": 1778037331,
"usage": {
"input_tokens": 30,
"output_tokens": 2074,
"total_tokens": 2104
}
}
b64_json フィールドは data: プレフィックスなしの raw base64 です。ファイルを書き出すにはデコードするか、描画前にご自身でプレフィックスを付けてください。以前のバージョンではプレフィックスが含まれていたため、両方の形式に対応できるよう、最初に必ず startsWith('data:') チェックを実行してください。関連リソース
モデル概要(全サイズ表)
画像編集 API
/v1/images/edits 複数画像の融合と編集姉妹モデル gpt-image-2-all
承認
API Key from the API易 Console
ボディ
Model name: gpt-image-2.5-vip (= sunburst-vip) / gpt-image-2.5-flare-vip / gpt-image-2-vip, same price and call format
gpt-image-2.5-vip, gpt-image-2.5-sunburst-vip, gpt-image-2.5-flare-vip, gpt-image-2-vip Prompt — describe content, style, lighting, etc.
"Cinematic landscape, old lighthouse by the sea at dusk, photorealistic"
Quality tier (works in testing; channel behavior, not a commitment — go by the actual response). All six tiers on the 2.5 models (gpt-image-2.5-vip / gpt-image-2.5-sunburst-vip / gpt-image-2.5-flare-vip); gpt-image-2-vip stops at high and rejects xhigh / max.
Same-named tiers are not equal: 2.5 high only equals gpt-image-2-vip medium, and 2.5 max equals its high. The flat $0.03 does not change with the tier, but latency rises with it.
auto, low, medium, high, xhigh, max "high"
Output size. Pass auto to let the model decide (vip tends to converge on a relatively fixed size for a given prompt), or pick one of the 30 supported sizes (10 ratios × 1K Fast / 2K Recommended / 4K Detail) to lock it strictly.
Format: WIDTHxHEIGHT with lowercase ASCII x, e.g., 2048x1360, 3840x2160. Flat $0.03/image across all tiers.
auto, 1280x1280, 848x1280, 1280x848, 960x1280, 1280x960, 1024x1280, 1280x1024, 720x1280, 1280x720, 1280x544, 2048x2048, 1360x2048, 2048x1360, 1536x2048, 2048x1536, 1632x2048, 2048x1632, 1152x2048, 2048x1152, 2048x864, 2880x2880, 2336x3520, 3520x2336, 2480x3312, 3312x2480, 2560x3216, 3216x2560, 2160x3840, 3840x2160, 3840x1632 "2048x1152"
レスポンス
Image successfully generated. Defaults to base64 in data[0].b64_json — url is not returned in the same response.
Image generation response. Returns base64 by default (data[0].b64_json); to get a url, switch to the image2_OSS group with response_format=url. data[0] returns either url or b64_json, never both.
このページは役に立ちましたか?