创建绘画
POST /v1/images/generations
说明
给定一个提示,该模型将返回一个或多个预测的完成,并且还可以返回每个位置的替代标记的概率。
为提供的提示和参数创建完成
官方文档:https://platform.openai.com/docs/api-reference/images/create
概览
| Method | POST |
|---|---|
| Path | /v1/images/generations |
| Type | http |
| Status | 1 |
| Module | 2102810 |
| Folder | 71287034 |
参数
{ "query": [], "path": [], "cookie": [], "header": [ { "id": "NQs7bxnpZf", "name": "Content-Type", "required": true, "description": "", "type": "string", "enable": true, "sampleValue": "application/json" }, { "id": "qb8tEQbCty", "name": "Accept", "required": true, "description": "", "type": "string", "enable": true, "sampleValue": "application/json" }, { "required": false, "description": "", "type": "string", "id": "gBxcCbXhsa", "enable": true, "name": "Authorization", "sampleValue": "Bearer {{YOUR_API_KEY}}" } ] }
请求体
{ "type": "application/json", "parameters": [], "jsonSchema": { "type": "object", "properties": { "prompt": { "description": "所需图像的文本描述。最大长度为 1000 个字符。", "type": "string" }, "size": { "description": "生成图像的大小。必须是256x256、512x512或 1024x1024之一。", "type": "string" } }, "required": [ "prompt", "size" ], "x-apifox-orders": [ "prompt", "size" ] }, "mediaType": "", "examples": [ { "value": "{\n \"size\": \"2:3\",\n \"prompt\": \"一只可爱的小猪\",\n \"model\": \"jimeng-4.0\"\n}", "mediaType": "application/json" } ], "oasExtensions": "" }
响应
[ { "id": 666443878, "name": "OK", "code": 200, "contentType": "json", "jsonSchema": { "type": "object", "properties": { "id": { "type": "string" }, "object": { "type": "string" }, "created": { "type": "integer" }, "choices": { "type": "array", "items": { "type": "object", "properties": { "index": { "type": "integer" }, "message": { "type": "object", "properties": { "role": { "type": "string" }, "content": { "type": "string" } }, "required": [ "role", "content" ], "x-apifox-orders": [ "role", "content" ] }, "finish_reason": { "type": "string" } }, "x-apifox-orders": [ "index", "message", "finish_reason" ] } }, "usage": { "type": "object", "properties": { "prompt_tokens": { "type": "integer" }, "completion_tokens": { "type": "integer" }, "total_tokens": { "type": "integer" } }, "required": [ "prompt_tokens", "completion_tokens", "total_tokens" ], "x-apifox-orders": [ "prompt_tokens", "completion_tokens", "total_tokens" ] } }, "required": [ "id", "object", "created", "choices", "usage" ], "x-apifox-orders": [ "id", "object", "created", "choices", "usage" ] }, "itemSchema": {}, "description": "", "mediaType": "", "headers": [], "oasExtensions": "" } ]
响应示例
[ { "name": "成功示例", "responseId": 666443878, "data": "{\r\n \"created\": 1765863987,\r\n \"data\": [\r\n {\r\n \"url\": \"https://p19-dreamina-sign-sg.ibyteimg.com/tos-alisg-i-wopfjsm1ax-sg/66657fb2eac34a2490a2e5b02a10894e~tplv-wopfjsm1ax-aigc_resize:0:0.jpeg?lk3s=43402efa&x-expires=1767744000&x-signature=HPpUoqaNH%2Bnh%2BFmvJIuF6ETheZc%3D&format=.jpeg\"\r\n },\r\n {\r\n \"url\": \"https://p16-dreamina-sign-sg.ibyteimg.com/tos-alisg-i-wopfjsm1ax-sg/0cf4043d94de432e8754fd6ff8e0278d~tplv-wopfjsm1ax-aigc_resize:0:0.jpeg?lk3s=43402efa&x-expires=1767744000&x-signature=K6pNWf3Yo%2FvgXHcmw30X6h00DRw%3D&format=.jpeg\"\r\n },\r\n {\r\n \"url\": \"https://p16-dreamina-sign-sg.ibyteimg.com/tos-alisg-i-wopfjsm1ax-sg/7ef97eacbb7c4cc49ae427870c28309e~tplv-wopfjsm1ax-aigc_resize:0:0.jpeg?lk3s=43402efa&x-expires=1767744000&x-signature=7YW0XMwoA3vRc5RNFFwOMgWh0zE%3D&format=.jpeg\"\r\n },\r\n {\r\n \"url\": \"https://p19-dreamina-sign-sg.ibyteimg.com/tos-alisg-i-wopfjsm1ax-sg/ea9d8881a8c34f4c8029fa2c89a9ec19~tplv-wopfjsm1ax-aigc_resize:0:0.jpeg?lk3s=43402efa&x-expires=1767744000&x-signature=2mLW1df9ACv%2FBbM3yp%2BCTxQIqoI%3D&format=.jpeg\"\r\n }\r\n ]\r\n}", "description": "", "oasKey": "", "oasExtensions": "", "id": 587196258 } ]