Skip to content
ByteDance logo

Seedream 4.0

Text-to-ImageByteDanceProxied

Seedream 4.0 is ByteDance's image creation model that combines text-to-image generation and image editing into a single architecture, offering fast, high-resolution output up to 4K.

Model Info
More informationlink

Usage

TypeScript
const response = await env.AI.run(
'bytedance/seedream-4.0',
{
prompt: 'A serene mountain lake surrounded by pine trees at dawn',
},
{
gateway: { id: 'default' },
}
)
console.log(response)
Response 200 Simple Generation

Examples

High Resolution — 4K quality image generation
TypeScript
const response = await env.AI.run(
'bytedance/seedream-4.0',
{
prompt:
'A detailed steampunk mechanical owl with brass gears and copper feathers, intricate clockwork visible',
size: '4K',
aspect_ratio: '1:1',
},
{
gateway: { id: 'default' },
}
)
console.log(response)
Response 200 High Resolution
Widescreen Landscape — Cinematic aspect ratio image
TypeScript
const response = await env.AI.run(
'bytedance/seedream-4.0',
{
prompt:
'A vast alien desert landscape with two suns setting on the horizon, ancient ruins in the foreground',
size: '2K',
aspect_ratio: '21:9',
},
{
gateway: { id: 'default' },
}
)
console.log(response)
Response 200 Widescreen Landscape
Portrait Format — Vertical image for portraits
TypeScript
const response = await env.AI.run(
'bytedance/seedream-4.0',
{
prompt:
'An elegant Art Deco poster featuring a jazz singer under a spotlight',
aspect_ratio: '9:16',
enhance_prompt: true,
},
{
gateway: { id: 'default' },
}
)
console.log(response)
Response 200 Portrait Format
Custom Dimensions — Specific width and height
TypeScript
const response = await env.AI.run(
'bytedance/seedream-4.0',
{
prompt: 'A detailed botanical illustration of exotic tropical flowers',
size: 'custom',
width: 2048,
height: 3072,
},
{
gateway: { id: 'default' },
}
)
console.log(response)
Response 200 Custom Dimensions

Parameters

prompt
stringrequired
size
stringenum: 1K, 2K, 4K, custom
aspect_ratio
stringenum: match_input_image, 1:1, 4:3, 3:4, 16:9, 9:16, 3:2, 2:3, 21:9
width
integerminimum: 1024maximum: 4096
height
integerminimum: 1024maximum: 4096
enhance_prompt
boolean

API Schemas

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"prompt": {
"type": "string"
},
"size": {
"type": "string",
"enum": [
"1K",
"2K",
"4K",
"custom"
]
},
"aspect_ratio": {
"type": "string",
"enum": [
"match_input_image",
"1:1",
"4:3",
"3:4",
"16:9",
"9:16",
"3:2",
"2:3",
"21:9"
]
},
"width": {
"type": "integer",
"minimum": 1024,
"maximum": 4096
},
"height": {
"type": "integer",
"minimum": 1024,
"maximum": 4096
},
"enhance_prompt": {
"type": "boolean"
}
},
"required": [
"prompt"
],
"additionalProperties": false
}