curl --request POST \
--url https://api.aiid.edu.kg/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2-2k",
"input": "生成一张 2K 横屏产品海报,白色运动鞋,干净棚拍光线,高级商业摄影风格。",
"stream": false,
"tools": [
{
"type": "image_generation"
}
],
"background": true
}
'{
"id": "resp_xxx",
"created_at": 1780649146,
"error": null,
"incomplete_details": null,
"instructions": null,
"metadata": {
"task_id": "010c31178d26436ca6194cde07931b33"
},
"model": "gpt-image-2-2k",
"object": "response",
"output": [],
"parallel_tool_calls": true,
"temperature": null,
"tool_choice": null,
"tools": null,
"top_p": null,
"max_output_tokens": null,
"previous_response_id": null,
"reasoning": null,
"status": "queued",
"text": null,
"truncation": null,
"usage": null,
"user": null,
"store": null
}OpenAI形式(Responses)
レスポンスを作成 (OpenAI Responses API)
OpenAI Responses API、モデルのレスポンスを作成するために使用します。 マルチターン対話、ツール呼び出し、推論などの機能をサポートしています。
OpenAI Responses API の画像生成非同期ユースケースを補足します。background=true はバックグラウンドタスクの送信用です。作成 API はすぐに status=queued と完全な id を返し、その後この id を使って GET /v1/responses/{response_id} を呼び出し、結果を照会します。
非同期画像生成フロー
POST /v1/responsesを呼び出し、リクエストボディにtools=[{ "type": "image_generation" }]とbackground=trueを指定します。- 作成 API が返す完全な
idを保存します。たとえばresp_xxxです。切り詰めたり、書き換えたり、metadata.task_idのみを保存したりしないでください。 GET /v1/responses/{response_id}を呼び出して照会し、status=completedまたはstatus=failedになるまで続けます。- 成功後、
output[].urlを読み取り、画像リンクを取得します。
非同期画像タスクの作成例
POST /v1/responses
Content-Type: application/json
{
"model": "gpt-image-2-2k",
"input": "生成一张 2K 横屏产品海报,白色运动鞋,干净棚拍光线,高级商业摄影风格。",
"stream": false,
"tools": [
{
"type": "image_generation"
}
],
"background": true
}
参照画像を使用して編集し、アスペクト比を指定する
input にはメッセージ配列を渡せます。同じユーザーメッセージの content 内で input_text と input_image を混在させます。tools[].ratio で生成するアスペクト比を指定します。
{
"model": "gpt-image-2-2k",
"input": [
{
"role": "user",
"content": [
{
"type": "input_text",
"text": "生成新图片 4K, 16:9"
},
{
"type": "input_image",
"image_url": "https://imageproxy.zhongzhuan.chat/api/proxy/image/70a98de9c9d48160812454b4ee21edbf.jpg",
"detail": "auto"
}
]
}
],
"stream": false,
"tools": [
{
"type": "image_generation",
"ratio": "16:9"
}
],
"background": true
}
この例の model は gpt-image-2-2k です。4K クラスが必要な場合は gpt-image-2-4k を使用し、プロンプトに「4K」と書くだけにしないでください。
作成 API のレスポンス例:
{
"id": "resp_xxx",
"created_at": 1780649146,
"error": null,
"incomplete_details": null,
"instructions": null,
"metadata": {
"task_id": "010c31178d26436ca6194cde07931b33"
},
"model": "gpt-image-2-2k",
"object": "response",
"output": [],
"parallel_tool_calls": true,
"temperature": null,
"tool_choice": null,
"tools": null,
"top_p": null,
"max_output_tokens": null,
"previous_response_id": null,
"reasoning": null,
"status": "queued",
"text": null,
"truncation": null,
"usage": null,
"user": null,
"store": null
}
対応モデル:gpt-image-2-2k、gpt-image-2-4k、nano-banana-pro。
POST
/
v1
/
responses
curl --request POST \
--url https://api.aiid.edu.kg/v1/responses \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "gpt-image-2-2k",
"input": "生成一张 2K 横屏产品海报,白色运动鞋,干净棚拍光线,高级商业摄影风格。",
"stream": false,
"tools": [
{
"type": "image_generation"
}
],
"background": true
}
'{
"id": "resp_xxx",
"created_at": 1780649146,
"error": null,
"incomplete_details": null,
"instructions": null,
"metadata": {
"task_id": "010c31178d26436ca6194cde07931b33"
},
"model": "gpt-image-2-2k",
"object": "response",
"output": [],
"parallel_tool_calls": true,
"temperature": null,
"tool_choice": null,
"tools": null,
"top_p": null,
"max_output_tokens": null,
"previous_response_id": null,
"reasoning": null,
"status": "queued",
"text": null,
"truncation": null,
"usage": null,
"user": null,
"store": null
}承認
Bearer Token を使用して認証します。
形式: Authorization: Bearer sk-xxxxxx
ボディ
application/json
The body is of type object.
レスポンス
200 - application/json
レスポンスの作成に成功しました
例:
"response"
利用可能なオプション:
completed, failed, in_progress, incomplete Hide child attributes
Hide child attributes
プロンプトのトークン数
完了トークン数
合計トークン数
