Pular para o conteúdo
ByteDance logo

Seedream 4.0

Text-to-Image • ByteDance

Ver como Markdown
  • Third-party

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 information link
Pricing View pricing in the Cloudflare dashboard

Usage

const response = await env.AI.run(
  'bytedance/seedream-4.0',
  { prompt: 'A serene mountain lake surrounded by pine trees at dawn' },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "bytedance/seedream-4.0",
  "input": {
    "prompt": "A serene mountain lake surrounded by pine trees at dawn"
  }
}'
Simple Generation
{
  "gatewayMetadata": {
    "keySource": "Unified"
  },
  "result": {
    "image": "https://ark-content-generation-v2-ap-southeast-1.tos-ap-southeast-1.volces.com/seedream-4-0/021776387438887c5f50319cb4d4388d7836967b82aebe5227f8d_0.jpeg"
  },
  "state": "Completed"
}

Examples

High Resolution — 4K quality image generation
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',
    aspect_ratio: '1:1',
    size: '4K',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "bytedance/seedream-4.0",
  "input": {
    "prompt": "A detailed steampunk mechanical owl with brass gears and copper feathers, intricate clockwork visible",
    "aspect_ratio": "1:1",
    "size": "4K"
  }
}'
High Resolution
{
  "gatewayMetadata": {
    "keySource": "Unified"
  },
  "result": {
    "image": "https://ark-content-generation-v2-ap-southeast-1.tos-ap-southeast-1.volces.com/seedream-4-0/021776387448153c5f50319cb4d4388d7836967b82aebe5807cbc_0.jpeg"
  },
  "state": "Completed"
}
Widescreen Landscape — Cinematic aspect ratio image
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',
    aspect_ratio: '21:9',
    size: '2K',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "bytedance/seedream-4.0",
  "input": {
    "prompt": "A vast alien desert landscape with two suns setting on the horizon, ancient ruins in the foreground",
    "aspect_ratio": "21:9",
    "size": "2K"
  }
}'
Widescreen Landscape
{
  "gatewayMetadata": {
    "keySource": "Unified"
  },
  "result": {
    "image": "https://ark-content-generation-v2-ap-southeast-1.tos-ap-southeast-1.volces.com/seedream-4-0/021776387469085c5f50319cb4d4388d7836967b82aebe5dcf17e_0.jpeg"
  },
  "state": "Completed"
}
Portrait Format — Vertical image for portraits
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,
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "bytedance/seedream-4.0",
  "input": {
    "prompt": "An elegant Art Deco poster featuring a jazz singer under a spotlight",
    "aspect_ratio": "9:16",
    "enhance_prompt": true
  }
}'
Portrait Format
{
  "gatewayMetadata": {
    "keySource": "Unified"
  },
  "result": {
    "image": "https://ark-content-generation-v2-ap-southeast-1.tos-ap-southeast-1.volces.com/seedream-4-0/021776387475078c5f50319cb4d4388d7836967b82aebe5e6ec81_0.jpeg"
  },
  "state": "Completed"
}
Detailed 4K — High-resolution detailed botanical illustration
const response = await env.AI.run(
  'bytedance/seedream-4.0',
  {
    prompt: 'A detailed botanical illustration of exotic tropical flowers',
    aspect_ratio: '3:4',
    size: '4K',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "bytedance/seedream-4.0",
  "input": {
    "prompt": "A detailed botanical illustration of exotic tropical flowers",
    "aspect_ratio": "3:4",
    "size": "4K"
  }
}'
Detailed 4K
{
  "gatewayMetadata": {
    "keySource": "Unified"
  },
  "result": {
    "image": "https://ark-content-generation-v2-ap-southeast-1.tos-ap-southeast-1.volces.com/seedream-4-0/021776441662380e1f2c28e220bf76d8a56e2a46eaa08e982d37f_0.jpeg"
  },
  "state": "Completed"
}

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
image
stringformat: uri

API Schemas (Raw)

Input
Output