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": "用于生成图像的提示词,支持中英文。" }, "size": { "type": "string", "description": "指定生成图像的尺寸信息,支持以下两种方式,不可混用。\n方式1 |指定生成图像的分辨率,可选值:1K、2K、4K\n方式2 |指定生成图像的宽高像素值:默认值:2048x2048\n面积取值范围:[1024x1024, 4096x4096] \n宽高比取值范围:[1/16, 16]" }, "sequential_image_generation": { "type": "string", "description": "控制是否关闭组图功能。默认值 disabled\n取值范围:\nauto:自动判断模式,模型会根据用户提供的提示词自主判断是否返回组图以及组图包含的图片数量。\ndisabled:关闭组图功能,模型只会生成一张图。" }, "stream": { "type": "boolean", "description": "控制是否开启流式输出模式。默认值 false" }, "response_format": { "type": "string", "description": "指定生成图像的返回格式。默认值 url\n生成的图片为 jpeg 格式,支持以下两种返回方式:\nurl:返回图片下载链接;链接在图片生成后24小时内有效,请及时下载图片。\nb64_json:以 Base64 编码字符串的 JSON 格式返回图像数据。" }, "watermark": { "type": "boolean", "description": "是否在生成的图片中添加水印。默认值 true\nfalse:不添加水印。\ntrue:在图片右下角添加“AI生成”字样的水印标识。" } }, "required": [ "model", "prompt" ], "x-apifox-orders": [ "model", "prompt", "size", "sequential_image_generation", "stream", "response_format", "watermark" ] }, "required": false, "mediaType": "", "examples": [ { "value": "{\n \"model\": \"doubao-seedream-4-0-250828\",\n \"prompt\": \"星际穿越,黑洞,黑洞里冲出一辆快支离破碎的复古列车,抢视觉冲击力,电影大片,末日既视感,动感,对比色,oc渲染,光线追踪,动态模糊,景深,超现实主义,深蓝,画面通过细腻的丰富的色彩层次塑造主体与场景,质感真实,暗黑风背景的光影效果营造出氛围,整体兼具艺术幻想感,夸张的广角透视效果,耀光,反射,极致的光影,强引力,吞噬\",\n \"size\": \"1728x2304\",\n \"sequential_image_generation\": \"disabled\",\n \"stream\": false,\n \"response_format\": \"url\",\n \"watermark\": true\n}", "mediaType": "application/json", "description": "" } ], "oasExtensions": "" }
响应
[ { "id": 765211305, "name": "成功", "code": 200, "contentType": "json", "jsonSchema": { "type": "object", "properties": { "data": { "type": "array", "items": { "type": "object", "properties": { "url": { "type": "string" } } } }, "created": { "type": "integer" }, "usage": { "type": "object", "properties": { "prompt_tokens": { "type": "integer" }, "completion_tokens": { "type": "integer" }, "total_tokens": { "type": "integer" }, "prompt_tokens_details": { "type": "object", "properties": { "cached_tokens_details": { "type": "object", "properties": {} } }, "required": [ "cached_tokens_details" ] }, "completion_tokens_details": { "type": "object", "properties": {} }, "output_tokens": { "type": "integer" } }, "required": [ "prompt_tokens", "completion_tokens", "total_tokens", "prompt_tokens_details", "completion_tokens_details", "output_tokens" ] } }, "required": [ "data", "created", "usage" ] }, "itemSchema": {}, "description": "", "mediaType": "", "headers": [], "oasExtensions": "" } ]
响应示例
[ { "name": "成功示例", "responseId": 765211305, "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/0217574690542070fa6ef8c2347680bd87fd8d357bb16f1e5ca0f_0.jpeg?X-Tos-Algorithm=TOS4-HMAC-SHA256&X-Tos-Credential=AKLTYWJkZTExNjA1ZDUyNDc3YzhjNTM5OGIyNjBhNDcyOTQ%2F20250910%2Fcn-beijing%2Ftos%2Frequest&X-Tos-Date=20250910T015107Z&X-Tos-Expires=86400&X-Tos-Signature=fbc5369be594d6e21be983ed1ec32463b5f82cf0c18c4349e477c11e51e55fa0&X-Tos-SignedHeaders=host\"\r\n }\r\n ],\r\n \"created\": 1757469067,\r\n \"usage\": {\r\n \"prompt_tokens\": 0,\r\n \"completion_tokens\": 0,\r\n \"total_tokens\": 15908,\r\n \"prompt_tokens_details\": {\r\n \"cached_tokens_details\": {}\r\n },\r\n \"completion_tokens_details\": {},\r\n \"output_tokens\": 15908\r\n }\r\n}", "description": "", "oasKey": "", "oasExtensions": "", "id": 676397205 } ]