# Seedream 4.5

> Seedream 4.5，ByteDance 的图片生成模型。

- **模型 ID**: `bytedance/seedream-4.5`
- **厂商**: ByteDance
- **类型**: image
- **状态**: live
- **超时上限**: 600 s
- **统一格式**: 支持
- **接口**: `POST https://api.kerox.ai/v1/tasks`
- **模型页**: https://kerox.ai/models/bytedance/seedream-4.5

## 价格

| 档位 | 官方价 / 张 | Kerox / 张 | 节省 |
| --- | --- | --- | --- |
| 默认 | $0.0400 | $0.0320 | 20% |

- **组图**：开启组图后按实际生成的张数计费，每个任务最多 15 张；提交时按可能生成的最多张数冻结，完成后按实际张数结算。

## 请求示例

用原厂参数提交任务。

### cURL

```bash
curl -X POST https://api.kerox.ai/v1/tasks \
  -H "Authorization: Bearer $KEROX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "bytedance/seedream-4.5",
  "input": {
    "prompt": "editorial portrait of a ceramicist in morning sunlight, 35mm film",
    "size": "2048x2048"
  },
  "wait_seconds": 30
}'
```

### Python

```python
import os
import requests

resp = requests.post(
    "https://api.kerox.ai/v1/tasks",
    headers={
        "Authorization": f"Bearer {os.environ['KEROX_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={
        "model": "bytedance/seedream-4.5",
        "input": {
            "prompt": "editorial portrait of a ceramicist in morning sunlight, 35mm film",
            "size": "2048x2048",
        },
        "wait_seconds": 30,
    },
    timeout=60,
)
resp.raise_for_status()
task = resp.json()
print(task["id"], task["status"], task["output"])
```

### Node.js

```javascript
const res = await fetch('https://api.kerox.ai/v1/tasks', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.KEROX_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "model": "bytedance/seedream-4.5",
    "input": {
      "prompt": "editorial portrait of a ceramicist in morning sunlight, 35mm film",
      "size": "2048x2048"
    },
    "wait_seconds": 30
  }),
});
const task = await res.json();
console.log(task.id, task.status, task.output);
```

### Go

```go
package main

import (
	"bytes"
	"fmt"
	"io"
	"net/http"
	"os"
)

func main() {
	body := []byte(`{
  "model": "bytedance/seedream-4.5",
  "input": {
    "prompt": "editorial portrait of a ceramicist in morning sunlight, 35mm film",
    "size": "2048x2048"
  },
  "wait_seconds": 30
}`)
	req, _ := http.NewRequest("POST", "https://api.kerox.ai/v1/tasks", bytes.NewReader(body))
	req.Header.Set("Authorization", "Bearer "+os.Getenv("KEROX_API_KEY"))
	req.Header.Set("Content-Type", "application/json")
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	out, _ := io.ReadAll(resp.Body)
	fmt.Println(string(out))
}
```

## 参数（原厂格式）

| 参数 | 类型 | 默认值 | 可选值 | 说明 |
| --- | --- | --- | --- | --- |
| `size` | string | `"2048x2048"` | — | 尺寸 |
| `image` | string \| string[] | — | — | 参考图 |
| `prompt` | string | — | — | 提示词 |
| `watermark` | boolean | `false` | — | 水印 |
| `optimize_prompt_options` | object | `{"mode":"standard"}` | — | 提示词优化 |
| `sequential_image_generation` | string | `"disabled"` | auto, disabled | 顺序组图 |
| `sequential_image_generation_options` | object | — | — | 组图选项 |

## 参数（统一格式，`format: "unified"`）

| 参数 | 类型 | 默认值 | 可选值 | 说明 |
| --- | --- | --- | --- | --- |
| `n` | integer | `1` | 1–15 | 生成数量 |
| `images` | string \| string[] | — | — | 参考图 |
| `prompt` | string | — | — | 提示词 |
| `resolution` | string | `"2K"` | 2K, 4K | 分辨率 |
| `aspect_ratio` | string | `"auto"` | auto, 1:1, 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 16:9, 21:9, 9:16, 9:21 | 画面比例 |
| `watermark` | boolean | `false` | — | 水印 |
| `optimize_prompt_options` | object | `{"mode":"standard"}` | — | 提示词优化 |
| `sequential_image_generation_options` | object | — | — | 组图选项 |

## 轮询与输出

轮询 `GET /v1/tasks/{id}`，或用 Webhook 接收完成通知。结果文件在 `expires_at` 之后过期（完成后 7 天），想留的请下载。任务对象的其余字段见任务指南和 API 参考。

```bash
curl https://api.kerox.ai/v1/tasks/task_01JD8X9B4Q2M7T8N3K5P6R1S0V \
  -H "Authorization: Bearer $KEROX_API_KEY"
```

```json
{
  "id": "task_01JD8X9B4Q2M7T8N3K5P6R1S0V",
  "object": "task",
  "model": "bytedance/seedream-4.5",
  "status": "succeeded",
  "output": {
    "images": [
      {
        "url": "https://cdn.kerox.ai/t/task_01JD8X9B4Q2M7T8N3K5P6R1S0V/5f2b8c1e9d3a4f6b8a7c0d1e2f3a4b5c/0.png",
        "content_type": "image/png",
        "width": 2048,
        "height": 2048
      }
    ]
  },
  "error": null,
  "expires_at": "2026-11-27T08:01:10Z"
}
```

## 输入 schema（JSON）

```json
{
  "type": "object",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "required": [
    "prompt"
  ],
  "properties": {
    "size": {
      "type": "string",
      "x-tier": "common",
      "default": "2048x2048",
      "pattern": "^(2K|4K|[1-9][0-9]*x[1-9][0-9]*)$",
      "x-label-en": "Size",
      "x-label-zh": "尺寸",
      "x-constraints": {
        "max_aspect": 16,
        "max_pixels": 16777216,
        "min_aspect": 0.0625,
        "min_pixels": 3686400
      }
    },
    "image": {
      "oneOf": [
        {
          "type": "string",
          "pattern": "^(https://|data:image/)"
        },
        {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^(https://|data:image/)"
          },
          "maxItems": 14,
          "minItems": 1
        }
      ],
      "x-tier": "common",
      "x-label-en": "Reference images",
      "x-label-zh": "参考图"
    },
    "prompt": {
      "type": "string",
      "x-tier": "common",
      "pattern": "\\S",
      "minLength": 1,
      "x-label-en": "Prompt",
      "x-label-zh": "提示词"
    },
    "watermark": {
      "type": "boolean",
      "x-tier": "advanced",
      "default": false,
      "x-label-en": "Watermark",
      "x-label-zh": "水印"
    },
    "optimize_prompt_options": {
      "type": "object",
      "x-tier": "advanced",
      "default": {
        "mode": "standard"
      },
      "properties": {
        "mode": {
          "enum": [
            "standard"
          ],
          "type": "string",
          "x-tier": "advanced",
          "default": "standard",
          "x-label-en": "Mode",
          "x-label-zh": "模式"
        }
      },
      "x-label-en": "Prompt optimization",
      "x-label-zh": "提示词优化",
      "additionalProperties": false
    },
    "sequential_image_generation": {
      "enum": [
        "auto",
        "disabled"
      ],
      "type": "string",
      "x-tier": "advanced",
      "default": "disabled",
      "x-label-en": "Image set mode",
      "x-label-zh": "顺序组图"
    },
    "sequential_image_generation_options": {
      "type": "object",
      "x-tier": "advanced",
      "properties": {
        "max_images": {
          "type": "integer",
          "x-tier": "advanced",
          "default": 15,
          "maximum": 15,
          "minimum": 1,
          "x-label-en": "Max images",
          "x-label-zh": "最多张数"
        }
      },
      "x-label-en": "Image set options",
      "x-label-zh": "组图选项",
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
```
