Skip to main content
POST
使用 CometAPI 兼容 OpenAI 的 POST /v1/images/generations 路由来运行 Seedream 图像生成。该端点支持文生图 Prompt、参考图像请求,以及在所选模型支持这些控制项时的有界顺序图像输出。 本页涵盖用于 Pro 文生图请求的 seedream-5-0-pro-260628,以及用于 Seedream 5.0 参考图像、顺序和异步示例的 seedream-5-0-260128。关于账户可用性,请参阅模型页面或查询 /v1/models。关于提供商参数的详细信息,请参阅 BytePlus 的图像生成 APISeedream 4.0-5.0 教程

选择请求形式

  • 文生图:发送 modelpromptsize,以及可选的输出控制项,例如 response_formatoutput_formatwatermark
  • 图生图:添加 image,其值为公共 HTTPS URL 或 data URI 组成的数组。即使只发送一张参考图像,也要使用数组。
  • 顺序 Prompt:将 sequential_image_generation 设置为 auto,并使用 sequential_image_generation_options.max_images 作为上限。模型返回的图像数量可能少于最大值。
  • 异步任务:当你希望创建请求返回 data.task_id 而不是保持 HTTP 连接打开时,添加 async: true
参考图像与生成图像的总数必须保持在提供商限制之内。请使用 max_images 为顺序请求设置上限。

运行异步图像任务

对于需要由客户端提交并轮询的图像任务,将 async 设置为 true。创建请求会返回 data.task_id;将该值与检索 Seedream 图像任务一起使用,直到 data.status 变为 successfailure 在异步示例中,对 Seedream 5.0 请求使用 2K。不同 model ID 支持的尺寸各不相同,因此在提交异步任务前,请先选择模型支持的尺寸。

发送参考图像

对于内联图像数据,请使用 data:image/png;base64,YOUR_BASE64_IMAGE,或者使用提供商可抓取的公共 HTTPS URL。API 参考示例展示了每种请求类型的完整 JSON 结构。

读取输出 URL

返回的 url 是带签名的对象存储链接,可能包含 &% 和其他特殊字符。请从解析后的 JSON 中提取 URL,而不要复制终端输出中的部分行。在 shell 示例中,jq -r '.data[]?.url' 会保留完整的带签名 URL。

授权

Authorization
string
header
必填

Bearer token authentication. Use your CometAPI key.

请求体

application/json

Parameters for Seedream image generation. Send JSON for text-to-image, image-to-image, and sequential prompt requests.

model
string
默认值:seedream-5-0-pro-260628
必填

Seedream model ID to use. Query /v1/models or open the Models page for available model IDs.

prompt
string
默认值:A clean product-style render of a blue ceramic mug on a white table, soft studio lighting.
必填

Text prompt describing the image or edit goal. Use a concrete visual request, such as a blue ceramic mug on a white table, soft studio lighting.

response_format
enum<string>
默认值:url

Response image format. Use url for a temporary signed image URL, or b64_json when you need base64 image data in the response.

可用选项:
url,
b64_json
size
string
默认值:2K

Output resolution. Use a model-supported tier such as 2K or a model-supported WIDTHxHEIGHT value such as 2048x2048. Not every model ID accepts every tier.

image
string[]

Optional reference images for image-to-image generation. Each item can be a public HTTPS URL or a data URI such as data:image/png;base64,YOUR_BASE64_IMAGE. Use an array even for one image. Reference images plus generated images must not exceed the provider limit.

watermark
boolean
默认值:false

When true, requests a visible AI-generated watermark on the output image. Set false when your workflow handles disclosure separately.

async
boolean
默认值:false

CometAPI asynchronous task mode. Set this to true to return immediately with data.task_id, then poll the Seedream image task endpoint GET /v1/images/generations/{task_id} for the final image data.

output_format
enum<string>
默认值:png

Output image file format. Use png when you need lossless output, or jpeg for smaller files.

可用选项:
png,
jpeg
guidance_scale
number

Optional prompt-adherence control for model versions that support it. Higher values can follow the prompt more closely but may reduce naturalness. Omit this field when you do not need model-specific tuning.

必填范围: 1 <= x <= 10
seed
integer
默认值:-1

Optional random seed for reproducible attempts on model versions that support seeding. Use -1 or omit the field for a random seed.

必填范围: -1 <= x <= 2147483647
sequential_image_generation
enum<string>
默认值:disabled

Controls sequential prompt handling. Use auto to let the model return a sequence when the prompt calls for one. Use disabled for ordinary single-image requests.

可用选项:
auto,
disabled
sequential_image_generation_options
object

Options for sequential prompt handling. This object is only used when sequential_image_generation is auto.

响应

200 - application/json

Image generation response. Synchronous requests return completed image data. Async requests return a task response with data.task_id.

created
integer
必填

Unix timestamp in seconds when the image response was created.

data
object[]
必填

Generated image results. The array can contain one or more images depending on the request and model response.

usage
object

Usage information for the request. Fields vary by model and route.