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

# 将 Seed 2.0 Lite 260228 与 Comfy Router 配合使用

> 通过 Comfy Router 调用 byteplus/seed-2-0-lite-260228：endpoint、请求结构以及 Router 返回的响应。

由 BytePlus 通过 Comfy Router 提供的 `byteplus/seed-2-0-lite-260228` API 参考文档。

## 快速开始

在[你的 Comfy 工作区](https://platform.comfy.org/profile/api-keys)中创建一个密钥，并将其导出为 `COMFY_API_KEY`。Python 和 TypeScript 代码片段使用 Comfy SDK（`pip install comfy-sdk`、`npm install @comfyorg/sdk`）；cURL 代码片段则是通过原始 HTTP 发起的同一调用。

**模型 ID：** `byteplus/seed-2-0-lite-260228`

**端点：** `POST https://api.comfy.org/v2/models/byteplus/seed-2-0-lite-260228`

<Tabs>
  <Tab title="Wait for the result">
    <CodeGroup>
      ```python Python theme={null}
      from comfy_sdk import Comfy

      # Reads COMFY_API_KEY from the environment.
      # The SDK automatically creates an idempotency key and reuses it for automatic retries.
      with Comfy() as client:
          result = client.models.run(
              "byteplus/seed-2-0-lite-260228",
              {
                  "input": "Reply with the single word: ok",
              },
          )

      print(result)
      ```

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

      // Reads COMFY_API_KEY from the environment.
      // The SDK automatically creates an idempotency key and reuses it for automatic retries.
      const { data } = await comfy.models.run("byteplus/seed-2-0-lite-260228", {
        input: "Reply with the single word: ok",
      });

      console.log(data);
      ```

      ```bash cURL theme={null}
      curl https://api.comfy.org/v2/models/byteplus/seed-2-0-lite-260228 \
        -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="Queue and collect later">
    <CodeGroup>
      ```python Python theme={null}
      from comfy_sdk import Comfy

      # Reads COMFY_API_KEY from the environment.
      # Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.
      with Comfy() as client:
          handle = client.models.submit(
              "byteplus/seed-2-0-lite-260228",
              {
                  "input": "Reply with the single word: ok",
              },
          )
          print("request_id:", handle.request_id)  # with the model ID, all another process needs

          # Poll until the request completes, waiting the Retry-After the server names.
          for update in handle.iter_events():
              print(update.status, update.queue_position)

          # The provider's own payload, the same value models.run() returns.
          # A request that failed or was cancelled raises the typed Router error here.
          result = handle.get()

      print(result)
      ```

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

      // Reads COMFY_API_KEY from the environment.
      // Each submit() call mints its own Idempotency-Key and reuses it for automatic retries.
      const handle = await comfy.models.submit("byteplus/seed-2-0-lite-260228", {
        input: "Reply with the single word: ok",
      });
      console.log("requestId:", handle.requestId); // with the model ID, all another process needs

      // Poll until the request completes, waiting the Retry-After the server names.
      for await (const update of handle.events()) {
        console.log(update.status, update.queuePosition);
      }

      // The same result models.run() returns. A request that failed or was cancelled rejects here.
      const result = await handle.get();

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

      ```bash cURL theme={null}
      # 1. Submit. Router answers 201 with request_id, status_url, response_url and cancel_url.
      curl https://api.comfy.org/v2/models/byteplus/seed-2-0-lite-260228/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. Poll until status is COMPLETED, waiting the Retry-After seconds each response names.
      REQUEST_ID="<request_id from the 201 body>"
      curl -i https://api.comfy.org/v2/models/byteplus/seed-2-0-lite-260228/requests/$REQUEST_ID/status \
        -H "X-API-Key: $COMFY_API_KEY"

      # 3. Collect. 200 with the model's native output, 202 with the status body while it is still running.
      curl https://api.comfy.org/v2/models/byteplus/seed-2-0-lite-260228/requests/$REQUEST_ID \
        -H "X-API-Key: $COMFY_API_KEY"
      ```
    </CodeGroup>
  </Tab>
</Tabs>

## Schema

### 输入

<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`（经过加密和压缩的推理内容，用于手动多轮复用）。
</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">
  最大输出 token 数（响应 + 思维链）。
</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 输入 Schema 的 `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>

本文档由 Router 在 `GET /v2/models/byteplus/seed-2-0-lite-260228/openapi.json` 提供的 schema 生成，请求到达提供商之前，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[]">
  一条已应用的上下文编辑记录，通过 `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">
  用于计费与可观测性的 token 用量明细。
</ResponseField>

<ResponseField name="usage.input_tokens" type="integer" required>
  请求中的 token 总数。
</ResponseField>

<ResponseField name="usage.input_tokens_details" type="object">
  输入 token 的明细（缓存命中数等）。
</ResponseField>

<ResponseField name="usage.input_tokens_details.cached_tokens" type="integer">
  由上下文缓存提供的 token 数。
</ResponseField>

<ResponseField name="usage.output_tokens" type="integer" required>
  模型生成的 token 总数。
</ResponseField>

<ResponseField name="usage.output_tokens_details" type="object">
  输出 token 的明细（推理等）。
</ResponseField>

<ResponseField name="usage.output_tokens_details.reasoning_tokens" type="integer">
  思维链消耗的 token 数。
</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">
  网络搜索工具调用的次数。
</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-lite-260228",
  "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` 并在自动重试中复用它。手动重试时，请复用原始 key。Router 最长可保持连接 10 分钟。

请求失败时，Router 会发送 `X-Comfy-Error-Type` 响应头说明原因。`422` 表示 Router 在调用提供商之前就拒绝了输入。生成的资源请及时下载，因为[结果链接会过期](/zh/development/comfy-router/reference#结果资产)。

<CardGroup cols={3}>
  <Card title="请求头" icon="list" href="/zh/development/comfy-router/quickstart">
    身份验证、幂等性、请求 ID、错误分类、重试节奏、消费限额。
  </Card>

  <Card title="使用 Router API" icon="code" href="/zh/development/comfy-router/quickstart">
    模型发现、校验错误、重试与计费。
  </Card>

  <Card title="限制" icon="triangle-exclamation" href="/zh/development/comfy-router/limitations">
    Router 目前不支持的功能，以及替代方案。
  </Card>
</CardGroup>
