编辑 image
POST /v1/images/edits
概览
| Method | POST |
|---|---|
| Path | /v1/images/edits |
| Type | http |
| Status | 1 |
| Module | 2102810 |
| Folder | 79261575 |
参数
{ "header": [ { "required": false, "description": "", "type": "string", "id": "E5z9QyGhcQ", "enable": true, "name": "Authorization", "sampleValue": "Bearer {{YOUR_API_KEY}}" } ] }
请求体
{ "type": "multipart/form-data", "parameters": [ { "required": true, "description": "用于生成图像的模型。", "type": "string", "id": "f0noHr2apv", "enable": true, "name": "model", "sampleValue": "grok-3-image" }, { "required": true, "description": "编辑图片的提示词", "type": "string", "id": "dj34rqYZ9R", "enable": true, "name": "prompt", "sampleValue": "加一只小鸭" }, { "required": true, "description": "要编辑的图片支持传入1张", "type": "file", "id": "Vg6D935h52", "enable": true, "name": "image", "schema": { "format": "binary", "type": "string" }, "sampleValue": "file://C:\\Users\\y\\Pictures\\image-edit-2.webp" }, { "required": false, "description": "【可选参数】宽高比 \"1:1\" | \"3:4\" | \"4:3\" | \"9:16\" | \"16:9\" | \"2:3\" | \"3:2\" | \"9:19.5\" | \"19.5:9\" | \"9:20\" | \"20:9\" | \"1:2\" | \"2:1\" | \"auto\"", "type": "string", "id": "fFHqJZFagv", "enable": false, "name": "aspect_ratio", "sampleValue": "[\"1:1\"]" }, { "required": false, "description": "【可选参数】输出格式 b64_json 或者 url", "type": "string", "id": "lSvnwGet2q", "enable": false, "name": "response_format", "sampleValue": "b64_json" }, { "required": false, "description": "【可选参数】分辨率 \"1k\" | \"2k\"", "type": "string", "id": "jqPjFoyZpJ", "enable": false, "name": "resolution", "sampleValue": "[\"1k\"]" }, { "required": false, "description": "【可选参数】质量 \"low\" | \"medium\" | \"high\"", "type": "string", "id": "vrQ3LJW4gd", "enable": false, "name": "quality", "sampleValue": "[\"low\"]" }, { "required": false, "description": "【可选参数】输出图片数量 默认为1 最大 10", "type": "integer", "id": "8MXlo0EDfC", "enable": true, "name": "n", "schema": { "type": "integer" }, "sampleValue": "1" } ], "jsonSchema": { "type": "object", "properties": {} }, "required": true, "mediaType": "", "examples": [], "oasExtensions": "" }
响应
[ { "id": 121509391, "name": "成功", "code": 200, "contentType": "json", "jsonSchema": { "type": "object", "properties": {} }, "itemSchema": {}, "description": "", "mediaType": "", "headers": [] } ]
响应示例
[ { "name": "示例 1", "responseId": 121509391, "data": "{\r\n \"created\": 1773127037,\r\n \"data\": [\r\n {\r\n \"url\": \"https://pub-85624410c6c44bdb802187ae2bd8afff.r2.dev/grok/8903fc79-152b-4b80-b384-d74ae6775b07.jpg\"\r\n }\r\n ],\r\n \"usage\": {\r\n \"generated_images\": 1,\r\n \"output_tokens\": 16384,\r\n \"total_tokens\": 16384\r\n }\r\n}", "id": "019cd6a0-4c47-7229-9f59-bef5120eb5c1" } ]