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

# 豆包 Seed 2.1 Pro

> 通过 OpenAI 兼容接口调用字节 Doubao-Seed-2.1-Pro 旗舰对话模型。面向 Coding 与 Agent 时代，提供 256K 上下文、默认深度思考与领先的多模态理解能力。

Doubao-Seed-2.1-Pro 是字节面向 Coding 和 Agent 时代打造的旗舰模型，通过 Anyfast 以 OpenAI 兼容接口提供服务。作为 Seed 2.1 系列中能力最强的版本，它面向高复杂度任务探索——如复杂 Coding、长链路 Agent、多步骤工程交付，配备 256K 上下文窗口，视觉理解能力进一步提升。

## 核心能力

* **OpenAI 兼容** — 可直接替换 OpenAI SDK，无需修改其他代码
* **256K 上下文窗口** — 承载项目级上下文，单次响应最高可输出 256K Token
* **深度思考** — 思维链推理，默认开启，可通过 `reasoning_effort` 调节
* **强 Coding 与 Agent** — 需求理解、长期规划、持续修复与工程交付能力突出
* **多模态理解** — 支持文本、图片、视频与文档理解（不支持音频）
* **函数调用、结构化输出与上下文缓存** — 强大的工具调用、JSON 输出（beta）与前缀缓存
* **流式输出** — 通过 SSE 实现实时 Token 流式传输

## 输出规格

| 属性         | 取值          |
| ---------- | ----------- |
| 输入模态       | 文本、图片、视频、文档 |
| 输出模态       | 文本          |
| 上下文窗口      | 256K Token  |
| 最大输出 Token | 256K        |

## 快速示例

<CodeGroup>
  ```bash cURL theme={null}
  curl https://www.anyfast.ai/v1/chat/completions \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "doubao-seed-2.1-pro",
      "messages": [
        { "role": "user", "content": "用简单的语言解释量子纠缠。" }
      ]
    }'
  ```

  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="YOUR_API_KEY",
      base_url="https://www.anyfast.ai/v1"
  )

  response = client.chat.completions.create(
      model="doubao-seed-2.1-pro",
      messages=[
          {"role": "user", "content": "用简单的语言解释量子纠缠。"}
      ]
  )

  print(response.choices[0].message.content)
  ```

  ```python 流式输出 theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="YOUR_API_KEY",
      base_url="https://www.anyfast.ai/v1"
  )

  stream = client.chat.completions.create(
      model="doubao-seed-2.1-pro",
      messages=[
          {"role": "user", "content": "写一首关于大海的短诗。"}
      ],
      stream=True
  )

  for chunk in stream:
      print(chunk.choices[0].delta.content or "", end="")
  ```
</CodeGroup>

## 深度思考

Doubao-Seed-2.1-Pro 默认会在回答前进行思考。`thinking.type` 默认为 `enabled`，设为 `disabled` 可在轻量任务中跳过推理。通过 `reasoning_effort` 调节思考长度。

```python Python theme={null}
response = client.chat.completions.create(
    model="doubao-seed-2.1-pro",
    messages=[
        {"role": "user", "content": "为一个博客平台设计一套 REST API。"}
    ],
    extra_body={
        "thinking": {"type": "enabled"},
        "reasoning_effort": "high"
    }
)

print(response.choices[0].message.content)
```

`reasoning_effort` 控制思考长度（仅在思考开启时生效），支持 `minimal`、`low`、`medium`、`high`。默认：`high`。

## 参数说明

| 参数                 | 类型             | 必填 | 说明                                                        |
| ------------------ | -------------- | -- | --------------------------------------------------------- |
| `model`            | string         | 是  | 固定为 `doubao-seed-2.1-pro`                                 |
| `messages`         | array          | 是  | `{ role, content }` 对象数组                                  |
| `thinking`         | object         | 否  | `{ "type": "enabled" \| "disabled" }`，控制深度思考。默认 `enabled` |
| `reasoning_effort` | string         | 否  | `minimal`、`low`、`medium`、`high`，思考开启时生效。默认 `high`         |
| `max_tokens`       | integer        | 否  | 最大生成 Token 数（最高 262144）                                   |
| `temperature`      | float          | 否  | `0`–`2`，控制随机性，默认 `1`                                      |
| `top_p`            | float          | 否  | 核采样阈值，默认 `1`                                              |
| `stream`           | boolean        | 否  | 开启 SSE 流式传输，默认 `false`                                    |
| `tools`            | array          | 否  | Function 工具定义，用于工具调用                                      |
| `response_format`  | object         | 否  | `{ "type": "json_object" }` 输出结构化 JSON（beta）              |
| `stop`             | string / array | 否  | 触发停止生成的序列                                                 |

<Card title="API 参考" icon="code" href="/zh/api-reference/model-api/bytedance/doubao-seed-2.1-pro">
  查看 Doubao Seed 2.1 Pro 的交互式 API Playground。
</Card>

<script src="/feedback.js" />
