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

# Seedream 4.0 API：ByteDance のモデルによるテキストからの画像生成と編集

> バイトダンス Seedream 4.0 画像生成 API テキストから画像へのワークフローおよび画像から画像へのワークフローの場合 1K, 2K、 そして 4K 出力プリセット

## 概要

ByteDance の画像モデル Seedream 4.0 は、テキストや参照画像から画像を生成します。出力解像度は 1K、2K、4K から選べ、1 タスクで最大 15 枚生成できます。連作画像の生成や、`standard`・`fast` モードでのプロンプト最適化も利用できます。

| 機能 | 値 |
| - | - |
| モデル ID | `seedream-4-0` |
| モード | `text-to-image`, `image-to-image` |
| プロンプトの長さ | 1～5000 文字 |
| 参考画像 | 1-14 `image-to-image` の URL |
| タスク単位での画像数 | `max_images` は必須です。1-15。`image-to-image` の場合、`image_urls` の数に `max_images` を加えた値は 15 以下でなければなりません。 |
| 解像度の区分 | `1K`, `2K`, `4K` |
| アスペクト比 | `1:1`, `2:3`, `3:2`, `4:3`, `3:4`, `9:16`, `16:9`, `21:9` |
| サイズ入力 | `1K`, `2K`, `4K`, `2048x2048`, `2048X2048`, `2048*2048` |
| 逐次生成 | `disabled`, `auto` |
| プロンプトの最適化 | `standard`, `fast` |

## エンドポイントと認証

ベース URL：

```text theme={null}
https://api.apixo.ai/api/v1
```

| メソッド | エンドポイント | 用途 |
| - | - | - |
| `POST` | `/generateTask/seedream-4-0` | 生成タスクを送信する |
| `GET` | `/statusTask/seedream-4-0?taskId={taskId}` | タスクの状態を確認して結果を取得する |

すべてのリクエストに APIXO の API キーを指定してください。

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

タスクの送信時には、次のヘッダーも指定してください。

```http theme={null}
Content-Type: application/json
```

## 非同期リクエストの実行例

最小構成のリクエストで、テキストから画像を生成するタスクを送信します。レスポンスには `taskId` が含まれます。

```bash theme={null}
curl -X POST "https://api.apixo.ai/api/v1/generateTask/seedream-4-0" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "mode": "text-to-image",
      "prompt": "a sunrise train passing through snowy hills",
      "max_images": 2,
      "resolution": "1K",
      "aspect_ratio": "16:9",
      "prompt_optimize_mode": "fast"
    }
  }'
```

成功した応答:

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_12345678"
  }
}
```

結果のポーリングに使うため、`taskId` を保存してください。

## リクエストボディ

### テキストから画像を生成

```json theme={null}
{
  "input": {
    "mode": "text-to-image",
    "prompt": "a clean architectural concept of a coastal library",
    "max_images": 2,
    "resolution": "1K",
    "aspect_ratio": "16:9",
    "prompt_optimize_mode": "fast"
  }
}
```

### 参照画像から画像を生成

```json theme={null}
{
  "input": {
    "mode": "image-to-image",
    "prompt": "turn this sketch into a cinematic concept frame",
    "image_urls": [
      "https://example.com/reference-1.png"
    ],
    "max_images": 2,
    "resolution": "2K",
    "aspect_ratio": "3:4",
    "sequential_image_generation": "auto",
    "prompt_optimize_mode": "standard"
  }
}
```

### 明示的なサイズ

```json theme={null}
{
  "input": {
    "mode": "text-to-image",
    "prompt": "an editorial interior still",
    "max_images": 1,
    "size": "2048*2048"
  }
}
```

## パラメーター

**request\_type** `string` (default: async)

結果の取得方法です。`async` では `statusTask` をポーリングし、`callback` では Webhook で結果を受け取ります。

**callback\_url** `string`

`request_type` が `callback` の場合は必須です。タスクの最終結果を受け取る、外部からアクセス可能な HTTPS URL を指定してください。詳しくは [Webhook](https://apixo.ai/docs/ja/api-reference/webhooks.md) を参照してください。

**input** `object` *required*

Seedream 4.0 の入力パラメータです。

**HTTP ステータスコードです。**

**mode** `string` *required*

生成モードです。指定できる値は `text-to-image`、`image-to-image` です。

**prompt** `string` *required*

生成したい画像や編集内容をテキストで指定します。前後の空白を除いて、1～5000 文字で指定してください。

**max\_images** `integer` *required*

リクエストする画像の数。サポートされる範囲: 1 ～ 15。`image-to-image` の場合、`image_urls` に含まれる参照画像の数に `max_images` を加えた値は 15 を超えてはなりません。

**image\_urls** `string[]`

参考画像のURL。`image-to-image`では必須です。1～14のURLをサポートします。URLは公開されており、直接アクセス可能な画像ファイルでなければなりません。`image-to-image`の場合は、`image_urls`の数 + `max_images`が15以下でなければなりません。

**resolution** `string` (default: 2K)

出力解像度のプリセット。サポートされる値: `1K`、`2K`、`4K`。`resolution + aspect_ratio`と`size`が両方指定された場合は、`resolution + aspect_ratio`が優先されます。

**aspect\_ratio** `string`

オプションの出力アスペクト比。サポートされる値: `1:1`、`2:3`、`3:2`、`4:3`、`3:4`、`9:16`、`16:9`、`21:9`。

**size** `string`

オプションの明示的なサイズまたは事前設定トークン。事前設定トークンは大文字と小文字を区別せず、`1K`、`2K`、および`4K`をサポートします。ピクセル文字列は`x`、`X`、または`*`を区切り文字として受け入れます。たとえば`2048x2048`、`2048X2048`、または`2048*2048`。カスタムピクセルサイズは16ピクセル単位で指定し、アスペクト比は`1/16`から`16`まで、総ピクセル数は`921,600`から`16,777,216`（`1280x720`から`4096x4096`相当）までを維持する必要があります。サポートされていないカスタム値は、最も近いサポートされる出力サイズに調整されます。

**sequential\_image\_generation** `string` (default: disabled)

連写モード。サポートされる値: `disabled`、`auto`。

**prompt\_optimize\_mode** `string` (default: standard)

プロンプト最適化モード。サポートされる値: `standard`、`fast`。

**nsfw\_checker** `boolean` (default: false)

このリクエストにコンテンツの安全性フィルターを適用します。デフォルトは `false` です。指定する場合はブール値を使用してください。

### `resolution + aspect_ratio` からのサイズ プリセット

`aspect_ratio`が指定されている場合、APIXOは`resolution`と`aspect_ratio`を次の出力次元にマップします。

| アスペクト比 | `1K`サイズ | `2K`サイズ | `4K`サイズ |
| - | - | - | - |
| `1:1` | `1024x1024` | `2048x2048` | `4096x4096` |
| `2:3` | `832x1248` | `1664x2496` | `3328x4992` |
| `3:2` | `1248x832` | `2496x1664` | `4992x3328` |
| `3:4` | `864x1152` | `1728x2304` | `3520x4704` |
| `4:3` | `1152x864` | `2304x1728` | `4704x3520` |
| `9:16` | `736x1312` | `1600x2848` | `3040x5504` |
| `16:9` | `1312x736` | `2848x1600` | `5504x3040` |
| `21:9` | `1568x672` | `3136x1344` | `6240x2656` |

## ポーリングと配信のガイダンス

Seedream 4.0 のタスクは非同期です。

| 解像度 | 生成にかかる時間の目安 | 初回ポーリングの目安 | ポーリング間隔 |
| - | - | - | - |
| `1K` | 20s-30s | タスク作成から 15 秒後 | 3s |
| `2K` | 25s-35s | タスク作成から 20 秒後 | 3s-5s |
| `4K` | 40s-55s | タスク作成から 30 秒後 | 5s |

運用システムでは、タイトなポーリング ループよりも `callback_url` を使用してください。

## 料金

新規の非 LLM リクエストは **1 クレジット = `$0.001`** で換算します。利用量と追加項目から合計額を求め、アカウントの割引を適用してから、クレジットの端数を切り上げます。個別に固定単価を取り決めている場合は、その精度を保ったまま計算し、標準料金や割引は適用しません。この場合も最終額の端数は切り上げます。詳しくは[クレジットの換算と端数処理](https://apixo.ai/docs/ja/pricing.md#credit-conversion-and-rounding)を参照してください。

Seedream 4.0 は生成された画像ごとに課金されます。現在の公開 APIXO 価格は、このモデルに対して単一の定額料金です。

| 単位 | APIXO の料金 |
| - | - |
| 生成されたイメージごと | `$0.030 / image` |

請求動作:

```text theme={null}
precharge = requested max_images * unit price
final charge = successful images * unit price
```

要求されたイメージよりも成功したイメージが少ない場合、APIXOは最終料金を実際に成功した出力数に合わせて自動的に調整します。

## MCP 連携

[モデルの完全なスキーマ](https://apixo.ai/docs/models/schemas/image/seedream-4-0.json)では、`mcp.result` に結果のデコード方法、`mcp.attachments` にファイルを割り当てられるフィールドを定義しています。いずれもクライアント実装用のメタデータで、生成リクエストの入力パラメータには含めません。添付先は `image_urls` です。ユーザーが指定したファイルの順序を維持してください。モデルのパラメータは API 側で検証します。

## 関連リンク

* [画像モデル](https://apixo.ai/docs/ja/models/image)
* [生成 API の概要](https://apixo.ai/docs/ja/models.md)
* [生成タスクを送信](https://apixo.ai/docs/ja/api-reference/generate-task.md)
* [タスクステータス](https://apixo.ai/docs/ja/api-reference/status-task.md)
* [Webhook](https://apixo.ai/docs/ja/api-reference/webhooks.md)
* [エラーコード](https://apixo.ai/docs/ja/api-reference/errors.md)
* [API 価格](https://apixo.ai/pricing/api)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.