创建 gpt-image-1
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 | 55735707 |
参数
{ "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" }, "n": { "description": "要生成的图像数。必须介于 1 和 10 之间。", "type": "integer" }, "size": { "description": "生成图像的大小。必须是256x256、512x512或 1024x1024之一。", "type": "string" } }, "required": [ "prompt", "n", "size" ], "x-apifox-orders": [ "prompt", "n", "size" ] }, "required": false, "mediaType": "", "examples": [ { "value": "{\n \"size\": \"1024x1536\",\n \"prompt\": \"一只可爱的小猪\",\n \"model\": \"gpt-image-1\",\n \"n\": 1\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": "OK", "responseId": 666443878, "data": "{\n \"id\": \"chatcmpl-123\",\n \"object\": \"chat.completion\",\n \"created\": 1677652288,\n \"choices\": [\n {\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"\\n\\nHello there, how may I assist you today?\"\n },\n \"finish_reason\": \"stop\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 9,\n \"completion_tokens\": 12,\n \"total_tokens\": 21\n }\n}", "description": "", "oasKey": "", "oasExtensions": "", "id": 587196258 } ]