Doubao Seedream 4.0 Image Generation
ByteDance's Doubao Seedream 4.0 model, supporting 1K/2K/4K multi-resolution generation, multi-image mode, and reference image input, with excellent performance in Chinese typography and Eastern aesthetics.
Try it Online
Quick Start
python
from openai import OpenAI
client = OpenAI(
base_url="https://open.dieyuyun.com/v1",
api_key="YOUR_API_KEY"
)
response = client.images.generate(
model="doubao-seedream-4.0",
prompt="An orange tabby cat sitting on a windowsill watching the snow, watercolor style",
size="4096x4096",
n=1
)
print(response.data[0].url)Endpoint
| Item | Value |
|---|---|
| Method | POST |
| Path | /v1/images/generations |
| Base URL | https://open.dieyuyun.com |
| Protocol | OpenAI Images API |
Authentication
Bearer Token: Authorization: Bearer YOUR_API_KEY
Standard Request Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| model | string | Yes | — | Model identifier: doubao-seedream-4.0 |
| prompt | string | Yes | — | Image description text, supports Chinese and English, recommended under 300 Chinese characters |
| size | string | No | 4096x4096 | Image size (width x height in pixels) |
| n | integer | No | 1 | Number of images to generate (max 15). When >1, multi-image mode is enabled |
| response_format | string | No | url | Response format: url or b64_json |
Supported Sizes
The following recommended pixel values are available for each resolution tier:
1K Resolution
| Size | Aspect Ratio |
|---|---|
1024x1024 | 1:1 |
1152x864 | 4:3 |
864x1152 | 3:4 |
1312x736 | 16:9 |
736x1312 | 9:16 |
1248x832 | 3:2 |
832x1248 | 2:3 |
1568x672 | 21:9 |
2K Resolution
| Size | Aspect Ratio |
|---|---|
2048x2048 | 1:1 |
2304x1728 | 4:3 |
1728x2304 | 3:4 |
2848x1600 | 16:9 |
1600x2848 | 9:16 |
2496x1664 | 3:2 |
1664x2496 | 2:3 |
3136x1344 | 21:9 |
4K Resolution (Default)
| Size | Aspect Ratio |
|---|---|
4096x4096 | 1:1 |
4704x3520 | 4:3 |
3520x4704 | 3:4 |
5504x3040 | 16:9 |
3040x5504 | 9:16 |
4992x3328 | 3:2 |
3328x4992 | 2:3 |
6240x2656 | 21:9 |
Extended Parameters
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
| image | string/array | No | — | Reference image URLs or Base64, up to 14 |
| watermark | boolean | No | false | Whether to add an AI-generated watermark |
| sequential_image_generation | string | No | disabled | auto for multi-image mode / disabled for single image |
Request Examples
bash
curl https://open.dieyuyun.com/v1/images/generations \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "doubao-seedream-4.0",
"prompt": "An orange tabby cat sitting on a windowsill watching the snow, watercolor style",
"size": "4096x4096",
"n": 1
}'python
from openai import OpenAI
client = OpenAI(
base_url="https://open.dieyuyun.com/v1",
api_key="YOUR_API_KEY"
)
response = client.images.generate(
model="doubao-seedream-4.0",
prompt="An orange tabby cat sitting on a windowsill watching the snow, watercolor style",
size="4096x4096",
n=1
)
print(response.data[0].url)javascript
import OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'https://open.dieyuyun.com/v1',
apiKey: 'YOUR_API_KEY',
})
const response = await client.images.generate({
model: 'doubao-seedream-4.0',
prompt: 'An orange tabby cat sitting on a windowsill watching the snow, watercolor style',
size: '4096x4096',
n: 1,
})
console.log(response.data[0].url)Response Format
Success Response
json
{
"created": 1717000000,
"model": "doubao-seedream-4.0",
"data": [
{
"url": "https://...",
"size": "2048x2048"
}
],
"usage": {
"generated_images": 1,
"output_tokens": 16384,
"total_tokens": 16384
}
}| Field | Type | Description |
|---|---|---|
| created | integer | Unix timestamp (seconds) |
| model | string | Model ID |
| data | array | Array of generated results |
| data[].url | string | Image URL (valid for 24 hours) |
| data[].b64_json | string | Base64-encoded image |
| data[].size | string | Actual image dimensions in pixels |
| usage | object | Usage information |
| usage.generated_images | integer | Number of images successfully generated |
| usage.output_tokens | integer | Output token count |
| usage.total_tokens | integer | Total token count |
Error Response
See Error Codes for details.
Best Practices
- Chinese prompts: Doubao Seedream 4.0 has excellent understanding of Chinese prompts, especially in Chinese typography and Eastern aesthetics.
- Style specification: Include explicit style descriptions in your prompt (e.g., "watercolor style", "oil painting", "cyberpunk") for more precise output.
- Multilingual support: Supports both Chinese and English prompts. Keep prompts under 300 Chinese characters for best results.
- Reference images: Pass reference images via the
imagefield to guide the model toward stylistically consistent output. Up to 14 reference images are supported. - Multi-image mode: Set
ngreater than 1 or enablesequential_image_generation: "auto"to generate multiple stylistically unified images in a single request. - Multi-resolution: Use 1K-resolution pixel values for quick previews, 2K for medium-precision scenarios, and
4096x4096as the default output quality.
Rate Limits
See Rate Limits for details.
Related Documentation
- Doubao Seedream 4.5 - Use the upgraded Doubao Seedream 4.5
- Doubao Seedream 5.0 Lite - Use the lightweight Doubao Seedream 5.0
- Model List & Pricing - Browse available models and pricing
- Playground - Test image generation interactively