> ## Documentation Index
> Fetch the complete documentation index at: https://dripart-chore-mintlify-theme-mint.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Comfy Router で Seed 2.0 Pro 260328 を使う

> Comfy Router 経由で byteplus/seed-2-0-pro-260328 を呼び出します。エンドポイント、リクエストの形状、Router が返すレスポンスについて説明します。

`byteplus/seed-2-0-pro-260328` の API リファレンスです。Comfy Router が BytePlus から提供しています。

## クイックスタート

[Comfy ワークスペース](https://platform.comfy.org/profile/api-keys?onboarding=router) でキーを作成し、`COMFY_API_KEY` としてエクスポートします。Python、TypeScript、Swift のスニペットは Comfy SDK を使用します（`pip install comfy-sdk`、`npm install @comfyorg/sdk`、および [`ComfySwiftSDK`](https://github.com/Comfy-Org/comfy-swift-sdk) Swift パッケージ）。cURL のスニペットは、同じ呼び出しを生の HTTP で実行するものです。

**モデル ID:** `byteplus/seed-2-0-pro-260328`

**エンドポイント:** `POST https://api.comfy.org/v2/models/byteplus/seed-2-0-pro-260328`

<Tabs>
  <Tab title="結果を待つ">
    <CodeGroup>
      ```python Python theme={null}
      from comfy_sdk import Comfy

      # 環境変数から COMFY_API_KEY を読み取ります。
      # SDK は冪等性キーを自動的に作成し、自動リトライのために再利用します。
      with Comfy() as client:
          result = client.models.run(
              "byteplus/seed-2-0-pro-260328",
              {
                  "input": "Reply with the single word: ok",
              },
          )

      print(result)
      ```

      ```typescript TypeScript theme={null}
      import { comfy } from "@comfyorg/sdk";

      // 環境変数から COMFY_API_KEY を読み取ります。
      // SDK は冪等性キーを自動的に作成し、自動リトライのために再利用します。
      const { data } = await comfy.models.run("byteplus/seed-2-0-pro-260328", {
        input: "Reply with the single word: ok",
      });

      console.log(data);
      ```

      ```swift Swift theme={null}
      import Foundation
      import ComfySwiftSDK

      // 環境変数から COMFY_API_KEY を読み取ります。
      // SDK は呼び出しごとに冪等性キーを生成し、自動リトライのために再利用します。
      let client = ComfyCloudClient(apiKey: ProcessInfo.processInfo.environment["COMFY_API_KEY"]!)
      let result = try await client.models.run(
          "byteplus/seed-2-0-pro-260328",
          input: [
              "input": "Reply with the single word: ok",
          ]
      )

      print(result.output)
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/byteplus/seed-2-0-pro-260328 \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"input\": \"Reply with the single word: ok\"}"
      ```
    </CodeGroup>
  </Tab>

  <Tab title="キューに送信して後で取得">
    同じボディを `POST https://api.comfy.org/v2/models/byteplus/seed-2-0-pro-260328/requests` に送信します。Router は実行が受け付けられ次第 `201` と `request_id` を返し、結果は準備が整った時点で、このプロセスからでも別のプロセスからでも取得できます。ステータス、キャンセル、結果の取得の詳細は [キュー配信](/ja/development/comfy-router/queue) を参照してください。

    <CodeGroup>
      ```python Python theme={null}
      from comfy_sdk import Comfy

      # 環境変数から COMFY_API_KEY を読み取ります。
      # 各 submit() 呼び出しは独自の Idempotency-Key を生成し、自動リトライのために再利用します。
      with Comfy() as client:
          handle = client.models.submit(
              "byteplus/seed-2-0-pro-260328",
              {
                  "input": "Reply with the single word: ok",
              },
          )
          print("request_id:", handle.request_id)  # モデル ID と合わせて、別のプロセスに必要な情報はこれだけです

          # リクエストが完了するまでポーリングし、サーバーが指定する Retry-After の時間だけ待機します。
          for update in handle.iter_events():
              print(update.status, update.queue_position)

          # プロバイダー自身のペイロードで、models.run() が返す値と同じです。
          # 失敗またはキャンセルされたリクエストは、ここで型付きの Router エラーを発生させます。
          result = handle.get()

      print(result)
      ```

      ```typescript TypeScript theme={null}
      import { comfy } from "@comfyorg/sdk";

      // 環境変数から COMFY_API_KEY を読み取ります。
      // 各 submit() 呼び出しは独自の Idempotency-Key を生成し、自動リトライのために再利用します。
      const handle = await comfy.models.submit("byteplus/seed-2-0-pro-260328", {
        input: "Reply with the single word: ok",
      });
      console.log("requestId:", handle.requestId); // モデル ID と合わせて、別のプロセスに必要な情報はこれだけです

      // リクエストが完了するまでポーリングし、サーバーが指定する Retry-After の時間だけ待機します。
      for await (const update of handle.events()) {
        console.log(update.status, update.queuePosition);
      }

      // models.run() が返すのと同じ結果です。失敗またはキャンセルされたリクエストは、ここで reject されます。
      const result = await handle.get();

      console.log(result.data);
      ```

      ```swift Swift theme={null}
      import Foundation
      import ComfySwiftSDK

      // 環境変数から COMFY_API_KEY を読み取ります。
      // 各 submit() 呼び出しは独自の Idempotency-Key を生成し、自動リトライのために再利用します。
      let client = ComfyCloudClient(apiKey: ProcessInfo.processInfo.environment["COMFY_API_KEY"]!)
      let handle = try await client.models.submit(
          "byteplus/seed-2-0-pro-260328",
          input: [
              "input": "Reply with the single word: ok",
          ]
      )
      print("requestId:", handle.requestId)  // モデル ID と合わせて、別のプロセスに必要な情報はこれだけです

      // リクエストが完了するまでポーリングし、サーバーが指定する Retry-After の時間だけ待機します。
      for try await update in handle.events() {
          print(update.state.rawValue, update.queuePosition.map(String.init) ?? "unknown")
      }

      // プロバイダー自身のペイロードで、models.run() が返す値と同じです。
      // 失敗またはキャンセルされたリクエストは、ここで型付きの Router エラーをスローします。
      let result = try await handle.result()

      print(result.output)
      ```

      ```bash cURL theme={null}
      # 1. 送信。Router は request_id、status_url、response_url、cancel_url を含む 201 を返します。
      curl https://api.comfy.org/v2/models/byteplus/seed-2-0-pro-260328/requests \
        -H "X-API-Key: $COMFY_API_KEY" \
        -H "Idempotency-Key: $(uuidgen)" \
        -H "Content-Type: application/json" \
        -d "{\"input\": \"Reply with the single word: ok\"}"

      # 2. ステータスが COMPLETED になるまでポーリングし、各レスポンスが指定する Retry-After 秒だけ待機します。
      REQUEST_ID="<request_id from the 201 body>"
      curl -i https://api.comfy.org/v2/models/byteplus/seed-2-0-pro-260328/requests/$REQUEST_ID/status \
        -H "X-API-Key: $COMFY_API_KEY"

      # 3. 取得。まだ実行中はステータスボディとともに 202、完了後はモデルのネイティブ出力とともに 200 を返します。
      curl https://api.comfy.org/v2/models/byteplus/seed-2-0-pro-260328/requests/$REQUEST_ID \
        -H "X-API-Key: $COMFY_API_KEY"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## スキーマ

### 入力

<ParamField body="caching" type="object">
  コンテキストキャッシュの設定。
</ParamField>

<ParamField body="caching.prefix" type="boolean" default="false">
  true の場合、公開プレフィックスキャッシュのみを作成し、モデルは応答しません。
</ParamField>

<ParamField body="caching.type" type="string">
  指定可能な値: `enabled`, `disabled`
</ParamField>

<ParamField body="context_management" type="object">
  コンテキストウィンドウを管理しやすい状態に保つために適用されるコンテキスト管理戦略（`clear_thinking`、`clear_tool_uses`）。
</ParamField>

<ParamField body="context_management.edits" type="object[]">
  `type` によって判別される単一のコンテキスト編集戦略。
</ParamField>

<ParamField body="expire_at" type="integer">
  保存された応答とキャッシュが失効する Unix タイムスタンプ（秒、UTC）。範囲 (creation\_time, creation\_time + 604800]。デフォルト: creation\_time + 259200（3 日）。
</ParamField>

<ParamField body="include" type="string[]">
  追加で含める出力フィールド。現在サポートされているのは `reasoning.encrypted_content`（手動でのマルチターン再利用のための暗号化および圧縮された reasoning）のみです。
</ParamField>

<ParamField body="input" type="string | object[]" required>
  モデルに提供されるテキストコンテンツ、または入力項目のリスト。
</ParamField>

<ParamField body="instructions" type="string">
  最初の指示として先頭に付加されるシステム/開発者メッセージ。`caching` とは互換性がありません。`caching.type` が `enabled` の場合に `instructions` を設定するとエラーが返されます。
</ParamField>

<ParamField body="max_output_tokens" type="integer">
  最大出力トークン数（応答 + 思考の連鎖）。
</ParamField>

<ParamField body="max_tool_calls" type="integer">
  範囲: `1` から `10`
</ParamField>

<ParamField body="model" type="string">
  モデル ID またはエンドポイント ID。モデル一覧については [https://docs.byteplus.com/en/docs/ModelArk/1330310](https://docs.byteplus.com/en/docs/ModelArk/1330310) 、エンドポイント ID については [https://docs.byteplus.com/en/docs/ModelArk/1099522](https://docs.byteplus.com/en/docs/ModelArk/1099522) を参照してください。POST /proxy/byteplus/api/v3/responses への直接の v1 呼び出しでは必ず指定する必要があります。プロキシは自身の許可リストにない値、および省略された値を 400 で拒否します。Comfy Router の入力スキーマの `required` リストには含まれていません。これは Router が /v2/models/byteplus/\{model} の `{model}` パスセグメントから値を埋めるためで、Router の呼び出し元は省略します。
</ParamField>

<ParamField body="previous_response_id" type="string">
  マルチターン会話を続けるために使用する、前の応答の ID。失敗を避けるため、リクエスト間に約 100ms の間隔を挿入してください。
</ParamField>

<ParamField body="reasoning" type="object">
  深い思考のワークロードを制限します。
</ParamField>

<ParamField body="reasoning.effort" type="string">
  `minimal` は思考を完全に無効にします。`thinking.type = disabled` の場合、`minimal` のみが許可されます。

  指定可能な値: `minimal`, `low`, `medium`, `high`
</ParamField>

<ParamField body="store" type="boolean" default="true">
  true の場合、応答は永続化され、マルチターンで利用するために ID で取得できます。
</ParamField>

<ParamField body="temperature" type="number" default="1">
  範囲: `0` から `2`

  形式: `float`
</ParamField>

<ParamField body="text" type="object">
  出力形式の設定。
</ParamField>

<ParamField body="text.format" type="object">
  `type` によって判別されるテキスト出力形式。`text` は自然言語を返し、`json_object` は自由形式の JSON オブジェクトを返し、`json_schema` は呼び出し元が指定した JSON Schema に出力を制約します。
</ParamField>

<ParamField body="thinking" type="object">
  深い思考モードを制御します。
</ParamField>

<ParamField body="thinking.type" type="string">
  `enabled`: 応答する前に常に推論します。
  `disabled`: 追加の推論なしで応答します。
  `auto`: モデルがクエリごとに判断します。

  指定可能な値: `enabled`, `disabled`, `auto`
</ParamField>

<ParamField body="tool_choice" type="`none`, `auto`, `required` | object">
  ツール選択モード。このフィールドをサポートするのは seed-1-6 モデルのみです。
</ParamField>

<ParamField body="tools" type="object[]">
  モデルが呼び出せるツール。現在サポートされているのは `function` のみです。
</ParamField>

<ParamField body="tools[].description" type="string" />

<ParamField body="tools[].name" type="string" required />

<ParamField body="tools[].parameters" type="object" required>
  関数のパラメータを記述する JSON Schema。
</ParamField>

<ParamField body="tools[].type" type="string" required default="&#x22;function&#x22;">
  指定可能な値: `function`
</ParamField>

<ParamField body="top_p" type="number" default="0.7">
  範囲: `0` から `1`

  形式: `float`
</ParamField>

`GET /v2/models/byteplus/seed-2-0-pro-260328/openapi.json` で Router が提供するスキーマから生成されています。これは、リクエストがプロバイダーに到達する前に Router が呼び出しを検証する際に使用するのと同じドキュメントです。

### 出力

<ResponseField name="caching" type="object" />

<ResponseField name="caching.prefix" type="boolean" />

<ResponseField name="caching.type" type="string">
  指定可能な値: `enabled`、`disabled`
</ResponseField>

<ResponseField name="context_management" type="object">
  このレスポンスで実際に適用されたコンテキスト管理戦略。戦略を設定するリクエスト側の `BytePlusResponseContextManagement` とは異なり、これはサーバーが呼び出した戦略を、クリアされた内容の件数とともに返します。
</ResponseField>

<ResponseField name="context_management.applied_edits" type="object[]">
  適用されたコンテキスト編集1件。`type` によって判別されます。
</ResponseField>

<ResponseField name="created_at" type="integer" required>
  レスポンスが作成された Unix タイムスタンプ（秒）。
</ResponseField>

<ResponseField name="error" type="object">
  エラーの詳細。レスポンスが成功した場合は null。
</ResponseField>

<ResponseField name="error.code" type="string" required />

<ResponseField name="error.message" type="string" required />

<ResponseField name="expire_at" type="integer">
  保存されたレスポンスが期限切れになる Unix タイムスタンプ（秒）。
</ResponseField>

<ResponseField name="id" type="string" required>
  レスポンスの一意な ID。会話を続けるには `previous_response_id` として使用します。
</ResponseField>

<ResponseField name="incomplete_details" type="object">
  `status` が `incomplete` の場合に設定されます。
</ResponseField>

<ResponseField name="incomplete_details.reason" type="string">
  例: `max_output_tokens`、`content_filter`。
</ResponseField>

<ResponseField name="instructions" type="string">
  リクエストの `instructions` フィールドのエコー。
</ResponseField>

<ResponseField name="max_output_tokens" type="integer" />

<ResponseField name="max_tool_calls" type="integer" />

<ResponseField name="metadata" type="object" />

<ResponseField name="model" type="string" required>
  レスポンスを生成したモデル ID。
</ResponseField>

<ResponseField name="object" type="string" required default="&#x22;response&#x22;">
  指定可能な値: `response`
</ResponseField>

<ResponseField name="output" type="object[]" required>
  モデルが生成した順序付けられた出力項目。
</ResponseField>

<ResponseField name="previous_response_id" type="string" />

<ResponseField name="reasoning" type="object" />

<ResponseField name="reasoning.effort" type="string">
  指定可能な値: `minimal`、`low`、`medium`、`high`
</ResponseField>

<ResponseField name="service_tier" type="string">
  TPM 保証パッケージの使用状況。`default` はなしを意味します。

  指定可能な値: `default`
</ResponseField>

<ResponseField name="status" type="string" required>
  指定可能な値: `in_progress`、`completed`、`incomplete`、`failed`、`cancelled`
</ResponseField>

<ResponseField name="store" type="boolean" />

<ResponseField name="stream" type="boolean" />

<ResponseField name="temperature" type="number">
  フォーマット: `float`
</ResponseField>

<ResponseField name="text" type="object">
  リクエストの `text` フィールドのエコー。
</ResponseField>

<ResponseField name="text.format" type="object">
  `type` によって判別されるテキスト出力フォーマット。`text` は自然言語を返し、`json_object` は自由形式の JSON オブジェクトを返し、`json_schema` は呼び出し元が指定した JSON Schema に出力を制約します。
</ResponseField>

<ResponseField name="thinking" type="object" />

<ResponseField name="thinking.type" type="string">
  指定可能な値: `enabled`、`disabled`、`auto`
</ResponseField>

<ResponseField name="tool_choice" type="`none`, `auto`, `required` | object" />

<ResponseField name="tools" type="object[]">
  モデルが呼び出せるツール。現在は `function` のみがサポートされています。
</ResponseField>

<ResponseField name="tools[].description" type="string" />

<ResponseField name="tools[].name" type="string" required />

<ResponseField name="tools[].parameters" type="object" required>
  関数のパラメータを記述する JSON Schema。
</ResponseField>

<ResponseField name="tools[].type" type="string" required default="&#x22;function&#x22;">
  指定可能な値: `function`
</ResponseField>

<ResponseField name="top_p" type="number">
  フォーマット: `float`
</ResponseField>

<ResponseField name="usage" type="object">
  課金と可観測性のためのトークン使用量の内訳。
</ResponseField>

<ResponseField name="usage.input_tokens" type="integer" required>
  リクエスト内の合計トークン数。
</ResponseField>

<ResponseField name="usage.input_tokens_details" type="object">
  入力トークンの内訳（キャッシュヒットなど）。
</ResponseField>

<ResponseField name="usage.input_tokens_details.cached_tokens" type="integer">
  コンテキストキャッシュから提供されたトークン。
</ResponseField>

<ResponseField name="usage.output_tokens" type="integer" required>
  モデルが生成した合計トークン数。
</ResponseField>

<ResponseField name="usage.output_tokens_details" type="object">
  出力トークンの内訳（reasoning など）。
</ResponseField>

<ResponseField name="usage.output_tokens_details.reasoning_tokens" type="integer">
  思考の連鎖（chain-of-thought）によって消費されたトークン。
</ResponseField>

<ResponseField name="usage.tool_usage" type="object">
  ツールごとの呼び出し回数。
</ResponseField>

<ResponseField name="usage.tool_usage.image_process" type="integer">
  画像処理ツールの呼び出し回数。
</ResponseField>

<ResponseField name="usage.tool_usage.mcp" type="integer">
  MCP ツールの呼び出し回数。
</ResponseField>

<ResponseField name="usage.tool_usage.web_search" type="integer">
  Web 検索ツールの呼び出し回数。
</ResponseField>

<ResponseField name="usage.tool_usage_details" type="object">
  サブツールの呼び出し回数のツールごとの内訳。
</ResponseField>

<ResponseField name="usage.tool_usage_details.image_process" type="object">
  例: `{"zoom":1,"point":1,"grounding":1}`。
</ResponseField>

<ResponseField name="usage.tool_usage_details.mcp" type="object">
  例: `{"mcp_server_tos":1,"mcp_server_tls":1}`。
</ResponseField>

<ResponseField name="usage.tool_usage_details.web_search" type="object">
  例: `{"toutiao":1,"moji":1,"search_engine":1}`。
</ResponseField>

<ResponseField name="usage.total_tokens" type="integer" required>
  input\_tokens + output\_tokens。
</ResponseField>

## 例

### 入力

```json theme={null}
{
  "input": "Reply with the single word: ok"
}
```

### 出力

```json theme={null}
{
  "created_at": 1767225600,
  "id": "resp_0a1b2c3d4e5f6a7b8c9d0e1f",
  "model": "seed-2-0-pro-260328",
  "object": "response",
  "output": [
    {
      "content": [
        {
          "annotations": [],
          "text": "ok",
          "type": "output_text"
        }
      ],
      "id": "msg_0a1b2c3d4e5f6a7b8c9d0e1f",
      "role": "assistant",
      "status": "completed",
      "type": "message"
    }
  ],
  "status": "completed",
  "usage": {
    "input_tokens": 14,
    "input_tokens_details": {
      "cached_tokens": 0
    },
    "output_tokens": 2,
    "total_tokens": 16
  }
}
```

## 出荷前の確認

SDK は `Idempotency-Key` を生成し、自動リトライで再利用します。手動リトライでは元のキーを再利用してください。Router は最大 10 分間接続を保持できます。

リクエストが失敗すると、Router は理由を説明する `X-Comfy-Error-Type` レスポンスヘッダーを送信します。`422` は、プロバイダーを呼び出す前に Router が入力を拒否したことを意味し、`413` はリクエスト本文が Router の受け入れ可能なサイズを超えていたことを意味します。生成されたアセットは [結果 URL の有効期限](/ja/development/comfy-router/reference#結果アセット) があるため、早めにダウンロードしてください。

上記のフィールド説明に記載されているサイズ制限は、プロバイダーの仕様から引用した、そのフィールドに対するプロバイダー自身の上限です。Router はリクエスト本文全体に対して別の上限を適用し、base64 エンコードされたメディアもこれにカウントされます。[リクエスト本文のサイズ](/ja/development/comfy-router/limitations) を参照してください。

このページは、Comfy Router 経由で呼び出す 1 つのパートナーモデルについて説明しています。同じ `comfy-sdk` / `@comfyorg/sdk` パッケージには、Comfy Cloud 上で ComfyUI のワークフローグラフ全体を実行するための 2 つ目のクライアントも含まれています: `Comfy(api_key=...)` / `new Comfy({ apiKey })`、および `client.workflows`、`client.assets`、`client.jobs`。[Comfy SDKs](/ja/development/api-development/sdks) を参照してください。

<CardGroup cols={3}>
  <Card title="ヘッダー" icon="list" href="/ja/development/comfy-router/headers">
    認証、冪等性、リクエスト ID、エラー分類、リトライ間隔、支出上限。
  </Card>

  <Card title="Router API の利用" icon="code" href="/ja/development/comfy-router/api">
    モデルの検出、バリデーションエラー、リトライ、課金。
  </Card>

  <Card title="制限事項" icon="triangle-exclamation" href="/ja/development/comfy-router/limitations">
    Router が現在対応していないことと、代替手段。
  </Card>
</CardGroup>
