使用 CometAPI POST /v1/images/generations 进行 Seedream 文生图和图生图生成——支持顺序多图输出和参考图像。
curl -s https://api.cometapi.com/v1/images/generations \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedream-5-0-260128",
"prompt": "a cat wearing a scarf sitting by the window watching rain, illustration style",
"size": "2K",
"response_format": "url",
"watermark": false
}' | jq -r '.data[].url'{
"created": 123,
"data": [
{
"url": "<string>",
"b64_json": "<string>",
"size": "<string>"
}
],
"usage": {
"generated_images": 123,
"output_tokens": 123,
"total_tokens": 123
},
"model": "<string>"
}/v1/images/generations 端点使用 ByteDance 的 Seedream 模型生成图像。支持 文生图 和 图生图 两种生成方式。
完整模型列表请参见模型页面。有关提供商的详细参数文档,请参见 VolcEngine 文档。
sequential_image_generation 设置为 auto,并可选配置 sequential_image_generation_options.max_images 以限制输出图像数量。参考图像总数与生成图像总数之和必须 ≤ 15。image 参数(URL 或 base64 data URI 组成的数组)传入一张或多张参考图像,并同时提供文本 Prompt。最多支持 14 张参考图像。
url 是一个带签名的对象存储链接,其中包含 & 和其他特殊字符。\{"Code":"AccessDenied","Message":"Access Denied","EC":"0003-00000015"\}
| jq -r '.data[].url' 管道提取 URL,避免格式被破坏。result.data[0].url 或 image["url"] —— 该字符串本身已经完整;直接传给 requests.get() 或 webbrowser.open() 即可。result.data[0].url。& 和 % 没有被截断或重复转义。Bearer token authentication. Use your CometAPI key.
Parameters for Seedream image generation (text-to-image and image-to-image).
Model to use. See the Models page for current Seedream model IDs.
Text prompt describing the image to generate. Supports both Chinese and English. Recommended max 300 Chinese characters or 1000 English characters.
Output format. url returns a temporary image link (valid for 24 hours); b64_json returns base64-encoded image data.
url, b64_json Output resolution. Presets 2K, 4K, or exact pixels like 2048x2048, 2304x1728, 2848x1600, 1600x2848, etc. Default: 2048x2048.
Reference image(s) for image-to-image generation. Each item is a public URL or base64 data URI (data:image/png;base64,...). Supports up to 14 reference images. Supported formats: jpeg, png, webp, bmp, tiff, gif.
When true, adds an 'AI Generated' watermark to the bottom-right corner of the output image.
Controls how closely the output follows the prompt. Higher values increase adherence but may reduce naturalness. Range: 1.0–10.0. Not supported by Seedream 5.0 (ignored).
Random seed for reproducible outputs. Range: -1 to 2147483647. Use -1 (default) for random generation. Legacy parameter — ignored by newer models.
Controls sequential (multi-image) generation mode.
auto: model decides whether to generate a sequence based on the promptdisabled: always generate a single imageauto, disabled Configuration for sequential (multi-image) generation. Only effective when sequential_image_generation is auto.
Show child attributes
Output image file format. Options: png, jpeg.
png, jpeg Successful Response
curl -s https://api.cometapi.com/v1/images/generations \
-H "Authorization: Bearer $COMETAPI_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedream-5-0-260128",
"prompt": "a cat wearing a scarf sitting by the window watching rain, illustration style",
"size": "2K",
"response_format": "url",
"watermark": false
}' | jq -r '.data[].url'{
"created": 123,
"data": [
{
"url": "<string>",
"b64_json": "<string>",
"size": "<string>"
}
],
"usage": {
"generated_images": 123,
"output_tokens": 123,
"total_tokens": 123
},
"model": "<string>"
}