doubao-seedream-5.0-pro

Before use, press Access Basics to set SHANHAI_BASE_URL (this site’s root address) and SHANHAI_API_KEY (this site’s token). The following command is suitable for Bash; the material example address must be replaced with a real address that can be downloaded directly.

Basic information

Use POST /v1/images/generations. Both pure text generation and reference image generation use this entry; the reference image is written in the image field. Pro and Lite are selected and billed independently, and existing applications should retain their accurate names.

request parameters

Parameter Type Required Description
model string Yes fixed doubao-seedream-5.0-pro
prompt string is Specify the subject, action, style, and screen ratio; clearly define the content to be modified and retained when editing
image string / array No You can directly fill in the picture address for a single picture; use an address array for multiple pictures. When omitted, the text will generate a picture. When passed in, it will be combined with the reference picture to generate
n integer No Request quantity; use 1 for a single picture, and treat it as 1 if it is omitted. The general quantity protection upper limit of this site cannot be regarded as the maximum number of generated pictures of this model
size string No The example uses 2K; for other gears and custom sizes, please confirm that the current model supports it first, and specifications of different versions cannot be mixed.
response_format string No url returns the image address, b64_json returns the encoded image data
watermark boolean No Whether to add a watermark; it is recommended to fill in true or false explicitly. If omitted, the model's default behavior will be used

image must be an image resource that can be directly downloaded. You cannot fill in the local path, image management page or web page that requires login. When submitting multiple reference pictures, press "Picture 1, Picture 2" in the prompt to explain their respective functions. The material format, size and quantity must comply with the current model service restrictions; if you are not sure, please contact the site customer service.

Request Example

Text generated image

curl --fail-with-body "$SHANHAI_BASE_URL/v1/images/generations" \
  -H "Authorization: Bearer $SHANHAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "doubao-seedream-5.0-pro",
  "prompt": "纯米色背景上的红色陶瓷杯,柔和灯光,产品摄影",
  "n": 1,
  "size": "2K",
  "response_format": "url",
  "watermark": true
}'

Use a reference picture

{
  "model": "doubao-seedream-5.0-pro",
  "prompt": "保留杯子的形状和红色,将背景改成木质桌面和柔和的窗边光线",
  "image": "https://example.com/cup.png",
  "n": 1,
  "size": "2K",
  "response_format": "url",
  "watermark": false
}

Use multiple reference pictures

{
  "model": "doubao-seedream-5.0-pro",
  "prompt": "保留图片1中的杯子外观,放入图片2的场景中,保持光线自然",
  "image": ["https://example.com/cup.png", "https://example.com/scene.jpg"],
  "n": 1,
  "size": "2K",
  "response_format": "url"
}

The above is an independent JSON request body, which is still submitted to /v1/images/generations. Do not move the nested input.messages or parameters of other image models directly into this model.

Return results

The data array is successfully returned. The url mode reads the URL of each item; the b64_json mode decodes the b64_json of each item and saves it. Don't just read the first one and ignore the rest of the results. The temporary image address should be saved to business storage in a timely manner.

If an error is returned, check the status code and error.message first; do not save the error text as an image. Check the address validity period and access permissions when the entered image cannot be downloaded. After timeout, consumption and generation records should be checked first to avoid repeated generation.

encountered a problem

If you encounter problems with calling or configuration, please contact the site customer service and provide the model name, task number, error time and error message. Do not provide the complete token.