Routescope APIRoutescope API

doubao-seedream-4-0-250828

doubao-seedream-4-0-250828 Image Editing API

Seedream 4.0 image editing uses /v1/images/edits with the reference image passed in the JSON image field, rather than the OpenAI-style file-upload protocol.

POST
/v1/images/edits
curl -X POST "https://api.routescope.ai/v1/images/edits" \  -H "Content-Type: application/json" \  -d '{    "model": "doubao-seedream-4-0-250828",    "prompt": "Generate a new image based on these two reference images.",    "images": [      {        "image_url": "https://example.com/a.png"      },      {        "image_url": "https://example.com/b.png"      }    ],    "size": "1024x1024"  }'
{
  "created": 1,
  "data": {}
}

Authorization

BearerAuth

AuthorizationBearer <token>

Model relay endpoint authentication. Header: Authorization: Bearer .

In: header

Request Body

application/json

model*string

Model name. The Tencent TokenHub channel maps it inside the gateway to the upstream model name.

Default"doubao-seedream-4-0-250828"
prompt*string

Image editing prompt.

images?

Recommended JSON URL image input. Each item is a single image URL object.

image?string||

Compatibility field: accepts a single URL string, a URL array, or an object. Prefer images[].image_url.

image_urls?array<string>

Compatibility field: a URL string array. Prefer images[].image_url.

mask?string

Optional. Mask image URL; transparent areas mark the regions to edit.

Formaturi
n?integer

Number of images to generate.

Formatint32
Range1 <= value
size?string

Output image size.

Default"1024x1024"
quality?string

Image quality. Allowed values depend on the upstream model.

response_format?string

Response format. Supports url or b64_json; can be omitted by default and support varies across upstream channels.

Value in"url" | "b64_json"
background?string

Background fill mode. Support depends on the model.

Default"auto"
Value in"transparent" | "opaque" | "auto"
output_format?string

Output format. Allowed values depend on the upstream model.

output_compression?integer

Output compression level. Applies to jpeg and webp only.

Default90
Formatint32
Range0 <= value <= 100
moderation?string

Moderation strength. Support depends on the model.

Default"auto"
Value in"auto" | "low"
watermark?boolean

Whether to add a watermark. Support depends on the upstream channel.

Defaultfalse
user?string

End-user identifier; useful for abuse monitoring.

Response Body

application/json

Request Parameters

FieldTypeRequiredDefaultDescription
modelstringYesNoneFixed to doubao-seedream-4-0-250828.
promptstringYesNoneEdit instruction, such as replacing the background, preserving the subject, changing style, or blending multiple reference images.
imagestring or string[]YesNoneSource/reference image URL or Base64. For multi-image blending, up to 14 images is recommended.
sizestringNo1920x1920Use an explicit <width>x<height> value such as 1920x1920; the total pixel count must be at least 3686400.
response_formatstringNoNoneSupports url or b64_json. Omit by default unless you need a specific return format.
watermarkbooleanNotrueWhether to add an AI-generated watermark.
streambooleanNofalseWhether to enable streaming output.

Example Code

curl https://api.routescope.ai/v1/images/edits \
  -H "Authorization: Bearer $ROUTESCOPE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-4-0-250828",
    "prompt": "Keep the main person unchanged and replace the background with a futuristic office in a realistic photography style.",
    "image": "https://example.com/input.png",
    "size": "1920x1920"
  }'
import requests

response = requests.post(
    "https://api.routescope.ai/v1/images/edits",
    headers={"Authorization": "Bearer YOUR_ROUTESCOPE_API_KEY"},
    json={
        "model": "doubao-seedream-4-0-250828",
        "prompt": "Keep the main person unchanged and replace the background with a futuristic office in a realistic photography style.",
        "image": "https://example.com/input.png",
        "size": "1920x1920",
    },
)
print(response.json())
const response = await fetch("https://api.routescope.ai/v1/images/edits", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.ROUTESCOPE_API_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    model: "doubao-seedream-4-0-250828",
    prompt: "Keep the main person unchanged and replace the background with a futuristic office in a realistic photography style.",
    image: "https://example.com/input.png",
    size: "1920x1920",
  }),
});
console.log(await response.json());

Response Example

{
  "created": 1777432320,
  "data": [
    {
      "url": "https://api.routescope.ai/assets/images/seedream-edit.png",
      "b64_json": null,
      "revised_prompt": "Keep the main subject, futuristic office background, realistic photography style."
    }
  ]
}

Notes

Billing follows the configured model and channel ratios. More reference images and higher resolutions increase both latency and cost.

Last updated on