> ## Documentation Index
> Fetch the complete documentation index at: https://docs.geekai.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Doubao-Seedream-4.0

Seedream 4.0 原生支持文本、单图和多图输入，实现基于主体一致性的多图融合创作、图像编辑、组图生成等多样玩法，让图像创作更加自由可控。本文介绍如何通过API 调用Seedream 4.0模型，实现包括组图生成、多参考图生图等图片生成能力。

### 模型参数

* 模型ID：`doubao-seedream-4.0`
* 模型价格：你可以在[模型广场](https://geekai.co/models?platform=bytedance\&type=image)查看最新价格信息
* 调用入口：`https://geekai.co/api/v1/images/generations`
* 模型参数：参考[画图 API 手册](https://docs.geekai.co/cn/api/image/generations)
* API认证：[获取 API KEY](https://docs.geekai.co/cn/docs/quick_start)

<Note>
  不支持画图 API 中的以下参数：

  * `negative_prompt`
  * `seed`
  * `strength`
  * `aspect_ratio`
  * `quality`
  * `style_preset`
  * `output_format`
  * `mask`
  * `background`

  附：[Seedream 4.0 官方 API 文档](https://www.volcengine.com/docs/82379/1824121)
</Note>

Doubao-Seedream-4.0 不支持设置图片宽高比及分辨率，如需设置可以通过 size 字段实现，该字段支持两种方式传值：

* 指定生成图像的分辨率：`1K`、`2K`、`4K`，然后在 `prompt` 中通过自然语言描述生成图片宽高比
* 指定生成图像的宽高像素值，默认值是 `2048x2048`，对应宽高比为 1:1，此外还可以通过如下像素值生成不同宽高比的图片：

| 宽高比  | 像素值       |
| ---- | --------- |
| 1:1  | 2048x2048 |
| 4:3  | 2304x1728 |
| 3:4  | 1728x2304 |
| 16:9 | 2560x1440 |
| 9:16 | 1440x2560 |
| 3:2  | 2496x1664 |
| 2:3  | 1664x2496 |
| 21:9 | 3024x1296 |

宽高像素值的取值范围为 `[1280x720, 4096x4096]`。

### 文生图

通过文字描述来生成对应图像：

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"doubao-seedream-4.0",
    "prompt":"画一只可爱的小猫在草丛中玩耍",
    "size": "1K"
}'
```

响应是一个 JSON 对象，包含生成图片的 URL：

```json theme={null}
{
    "model": "doubao-seedream-4.0",
    "created": 1760442379,
    "task_id": "42bcdbe2-fde8-4bf5-8ec0-8743ba2a604d",
    "task_status": "succeed",
    "data": [
        {
            "url": "https://static.geekai.co/image/2025/10/14/d06edffeb278fdb80026af1dc8725f66.jpeg"
        }
    ],
    "usage": {
        "billed_units": 1,
        "output_tokens": 3888,
        "total_tokens": 3888
    }
}
```

### 图生图

**单图**

基于已有图片，结合文字指令进行图像编辑，生成新的图像：

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"doubao-seedream-4.0",
    "prompt": "生成狗狗趴在草地上的近景画面",
    "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imageToimage.png",
    "size": "2K"
}'
```

响应和文生图一样是一个包含生成图片 URL 的 JSON 对象：

```json theme={null}
{
    "model": "doubao-seedream-4.0",
    "created": 1760442250,
    "task_id": "577f046f-d45b-432e-b3b5-bcff4c546f43",
    "task_status": "succeed",
    "data": [
        {
            "url": "https://static.geekai.co/image/2025/10/14/d61920ceeaf3a5428d5257477c2bc444.jpeg"
        }
    ],
    "usage": {
        "billed_units": 1,
        "output_tokens": 4096,
        "total_tokens": 4096
    }
}
```

**多图**

基于多张参考图片，融合它们的风格、元素等特征来生成新图像，如衣裤鞋帽与模特图融合成穿搭图，人物与风景融合为人物风景图等：

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"doubao-seedream-4.0",
    "prompt": "将图1的服装换为图2的服装",
    "image": [
        "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png", 
        "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_2.png"
    ],
    "size": "2K"
}'
```

响应和单图一样是一个包含生成图片 URL 的 JSON 对象：

### 组图生成

支持通过一张或者多张图片和文字信息，生成漫画分镜、品牌视觉等一组内容关联的图片：

```bash theme={null}
curl --location --request POST 'https://geekai.co/api/v1/images/generations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer $GEEKAI_API_KEY' \
--data '{
    "model":"doubao-seedream-4.0",
    "prompt": "生成一组共4张连贯插画，核心为同一庭院一角的四季变迁，以统一风格展现四季独特色彩、元素与氛围",
    "size": "2K",
    "response_format": "url",
    "watermark": true,
    "extra_body": {
        "sequential_image_generation": "auto",
        "sequential_image_generation_options": {
            "max_images": 4
        }
    }
}'
```

响应是一个 JSON 对象，其中包含生成的组图列表：

```json theme={null}
{
    "model": "doubao-seedream-4.0",
    "created": 1760442607,
    "task_id": "3327c84d-e138-4874-be2c-143134d075cc",
    "task_status": "succeed",
    "data": [
        {
            "url": "https://static.geekai.co/image/2025/10/14/5a30bd378a89eb177cba13041c534636.jpeg"
        },
        {
            "url": "https://static.geekai.co/image/2025/10/14/5c5416fb79cbdf76e80bc88fb3693c19.jpeg"
        },
        {
            "url": "https://static.geekai.co/image/2025/10/14/52fa648446cec78dab5f671cb650527d.jpeg"
        },
        {
            "url": "https://static.geekai.co/image/2025/10/14/da412a64d2a300896e2508d7c4b18fc2.jpeg"
        }
    ],
    "usage": {
        "billed_units": 4,
        "output_tokens": 62208,
        "total_tokens": 62208
    }
}
```
