doubao-seedream-4-0-250828-多图生图
POST /v1/images/generations
说明
概览
| Method | POST |
|---|---|
| Path | /v1/images/generations |
| Type | http |
| Status | 1 |
| Module | 2102810 |
| Folder | 62716892 |
参数
{ "query": [], "path": [], "cookie": [], "header": [ { "required": false, "description": "", "type": "string", "id": "GTujCrB2It", "enable": true, "name": "Authorization", "sampleValue": "Bearer {{YOUR_API_KEY}}" } ] }
请求体
{ "type": "application/json", "parameters": [], "jsonSchema": { "type": "object", "properties": { "model": { "type": "string", "description": "本次请求使用模型的 Model ID。" }, "prompt": { "type": "string", "description": "用于生成图像的提示词,支持中英文。\n建议不超过300个汉字或600个英文单词。字数过多信息容易分散,模型可能因此忽略细节,只关注重点,造成视图片缺失部分元素。" }, "image": { "type": "array", "items": { "type": "string" }, "description": "输入的图片信息,支持 URL 或 Base64 编码。doubao-seedream-4.0 支持单图或多图输入。\n图片URL:请确保图片URL可被访问。\nBase64编码:请遵循此格式data:image/<图片格式>;base64,<Base64编码>。注意 <图片格式> 需小写,如 data:image/png;base64,<base64_image>。" }, "sequential_image_generation": { "type": "string", "description": "控制是否关闭组图功能。默认值 disabled\n取值范围:\nauto:自动判断模式,模型会根据用户提供的提示词自主判断是否返回组图以及组图包含的图片数量。\ndisabled:关闭组图功能,模型只会生成一张图。" }, "sequential_image_generation_options": { "type": "object", "properties": { "max_images": { "type": "integer", "description": "指定本次请求,最多可生成的图片数量。默认值 15\n取值范围: [1, 15]" } }, "x-apifox-orders": [ "max_images" ], "description": "组图功能的配置。仅当sequential_image_generation为auto时生效。" }, "response_format": { "type": "string", "description": "指定生成图像的返回格式。默认值 url\n生成的图片为 jpeg 格式,支持以下两种返回方式:\nurl:返回图片下载链接;链接在图片生成后24小时内有效,请及时下载图片。\nb64_json:以 Base64 编码字符串的 JSON 格式返回图像数据。" }, "size": { "type": "string", "description": "指定生成图像的尺寸信息,支持以下两种方式,不可混用。\n方式1 |指定生成图像的分辨率,可选值:1K、2K、4K\n方式2 |指定生成图像的宽高像素值:默认值:2048x2048\n面积取值范围:[1024x1024, 4096x4096] \n宽高比取值范围:[1/16, 16]" }, "stream": { "type": "boolean", "description": "控制是否开启流式输出模式。默认值 false" }, "watermark": { "type": "boolean", "description": "是否在生成的图片中添加水印。默认值 true\nfalse:不添加水印。\ntrue:在图片右下角添加“AI生成”字样的水印标识。" } }, "required": [ "model", "prompt" ], "x-apifox-orders": [ "model", "prompt", "image", "sequential_image_generation", "sequential_image_generation_options", "response_format", "size", "stream", "watermark" ] }, "required": false, "mediaType": "", "examples": [ { "value": "{\n \"model\": \"doubao-seedream-4-0-250828\",\n \"prompt\": \"生成3张女孩和奶牛玩偶在游乐园开心地坐过山车的图片,涵盖早晨、中午、晚上\",\n \"image\": [\n \"https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimages_1.png\",\n \"https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimages_2.png\"\n ],\n \"sequential_image_generation\": \"auto\",\n \"sequential_image_generation_options\": {\n \"max_images\": 3\n },\n \"size\": \"2K\",\n \"watermark\": false\n}", "mediaType": "application/json", "description": "" } ], "oasExtensions": "" }
响应
[ { "id": 767383439, "name": "Create image", "code": 200, "contentType": "json", "jsonSchema": { "type": "object", "properties": { "created": { "type": "integer" }, "data": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string" } }, "required": [ "url" ], "x-apifox-orders": [ "url" ] } } }, "required": [ "created", "data" ], "x-apifox-orders": [ "created", "data" ] }, "itemSchema": {}, "description": "", "mediaType": "", "headers": [], "oasExtensions": "" } ]
响应示例
[ { "name": "成功示例", "responseId": 767383439, "data": "{\r\n \"data\": [\r\n {\r\n \"url\": \"https://ark-content-generation-v2-cn-beijing.tos-cn-beijing.volces.com/doubao-seedream-4-0/0217574695481350fa6ef8c2347680bd87fd8d357bb16f114b01e_0.jpeg?X-Tos-Algorithm=TOS4-HMAC-SHA256&X-Tos-Credential=AKLTYWJkZTExNjA1ZDUyNDc3YzhjNTM5OGIyNjBhNDcyOTQ%2F20250910%2Fcn-beijing%2Ftos%2Frequest&X-Tos-Date=20250910T015921Z&X-Tos-Expires=86400&X-Tos-Signature=95ed1d75393161dc0ea150c0c9b6d72298d4b27ea3ca305bcf07268ffe550e4c&X-Tos-SignedHeaders=host\"\r\n }\r\n ],\r\n \"created\": 1757469561,\r\n \"usage\": {\r\n \"prompt_tokens\": 0,\r\n \"completion_tokens\": 0,\r\n \"total_tokens\": 16280,\r\n \"prompt_tokens_details\": {\r\n \"cached_tokens_details\": {}\r\n },\r\n \"completion_tokens_details\": {},\r\n \"output_tokens\": 16280\r\n }\r\n}", "description": "", "oasKey": "", "oasExtensions": "", "id": 693705357 } ]