ChatGPT Images 2.5 API
ChatGPT Images 2.5 Client モデルの完全な API リファレンス。
モデルの種類
この API は、次の2種類のモデルに対応しています。
比較一覧
対応するアスペクト比
16:9, 9:16, 1:1, 3:2, 2:3, 3:4, 4:3, 5:4, 4:5, 21:9
ChatGPT Images 2.5 Client(テキストから画像生成)
エンドポイント {#}
POST /api/v1/image/task
認証
Authorization: Bearer YOUR_API_KEY
リクエストパラメータ
必須
注意: 幅と高さの比率は、次のいずれかである必要があります:16:9, 9:16, 1:1, 3:2, 2:3, 3:4, 4:3, 5:4, 4:5, 21:9
リクエスト例
const response = await fetch('https://api.flaq.ai/api/v1/image/task', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model_name: 'chatgpt-images-2.5-client',
prompt: 'A minimalist product shot of a ceramic mug on marble, soft studio light',
width: 1,
height: 1,
resolution: '1k'
})
});
const { data } = await response.json();
const taskId = data.task_id;
const pollResponse = await fetch(
`https://api.flaq.ai/api/v1/image/${taskId}`,
{
headers: { Authorization: 'Bearer YOUR_API_KEY' }
}
);
const result = await pollResponse.json();
console.log(result.data.task_result.images[0].url);
ChatGPT Images 2.5 Edit Client(画像編集)
エンドポイント
POST /api/v1/image/task
リクエストパラメータ
必須
注意: 幅と高さの比率は、次のいずれかである必要があります:16:9, 9:16, 1:1, 3:2, 2:3, 3:4, 4:3, 5:4, 4:5, 21:9
単一画像の編集例
{
model_name: 'chatgpt-images-2.5-edit-client',
prompt: 'Replace the background with a clean studio scene and brighten the product lighting',
image_url_list: ['https://example.com/product-photo.jpg'],
width: 16,
height: 9,
resolution: '1k'
}
複数画像の合成例
{
model_name: 'chatgpt-images-2.5-edit-client',
prompt: 'Blend these reference images into a polished campaign composition while keeping the main subject identity consistent',
image_url_list: [
'https://example.com/image1.jpg',
'https://example.com/image2.jpg',
'https://example.com/image3.jpg'
],
width: 16,
height: 9,
resolution: '1k'
}
レスポンス形式
初回レスポンス
ChatGPT Images 2.5 のどちらのモデルも、ポーリング用の task_id を返します。
{
"code": 0,
"data": {
"task_id": "{task_id}",
"task_status": "submitted",
"response_url": "https://api.flaq.ai/api/v1/image/{task_id}"
},
"message": "success"
}
ポーリングのレスポンス
GET /api/v1/image/{task_id} をポーリングして状態を確認します。
{
"code": 0,
"data": {
"task_id": "{task_id}",
"task_status": "succeed",
"task_status_msg": null,
"response_url": "https://api.flaq.ai/api/v1/image/{task_id}",
"task_result": {
"credit": 0.0997,
"images": [
{
"url": "https://example.com/generated-image.jpeg"
}
]
}
},
"message": "success"
}
ステータス値
submitted:タスク受付済み
processing:画像の生成または編集中
succeed:タスクが正常に完了
failed:タスクが失敗
処理時間
通常の処理時間は15~60秒です。プロンプトの複雑さや、編集リクエストの画像数によって異なります。
ベストプラクティス
- 構図を明確に指定する:被写体、フレーミング、照明、希望するスタイルをプロンプトで明確に説明すると、ChatGPT Images 2.5 の性能を最大限に引き出せます。
- 用途に合ったアスペクト比にする:SNS 投稿、バナー、商品ページ、編集レイアウトなどの用途に合わせて、あらかじめ比率を設定してください。
- 編集には鮮明な元画像を使用する:鮮明で明るさが適切な入力画像は、被写体の同一性の保持と部分編集の品質向上に役立ちます。
- 複数画像のリクエストでは有効な参照画像に絞る:編集リクエストには必要な画像だけを指定し、視覚的な指示の矛盾を避けてください。