ImagesOpenAI Images
生成图像
OpenAI Images API 兼容的图像生成接口。默认同步返回图片结果;如需异步提交,在请求 URL 上携带 ?async=true,接口会返回图片任务 ID,可通过 /v1/tasks/{id} 查询结果。
Authorization
bearerAuth AuthorizationBearer <token>
使用 Authorization Bearer API Key 进行鉴权。
In: header
Query Parameters
async?boolean
是否异步提交。
Default
falseRequest Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X POST "https://example.com/v1/images/generations?async=true" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-1", "prompt": "一张未来感 API 网关控制台截图", "size": "1024x1024" }'{
"created": 0,
"data": [
{
"url": "http://example.com",
"b64_json": "string",
"revised_prompt": "string"
}
]
}{
"error": {
"code": "string",
"message": "string",
"request_id": "string"
}
}