# 豆包 Seed API:模型 ID、深度思考开关、图片输入与 Claude Code Source: https://ofox.ai/zh/docs/develop/models/doubao 字节跳动的豆包 Seed 文本模型,包括 Seed 2.1 Pro、Seed 2.1 Turbo、Seed Evolving 与 Seed Character。通过 OpenAI 兼容接口调用,除 Seed Character 外同时支持 Anthropic 原生接口,可在 Claude Code 中使用。豆包的生图模型见 [Seedream(豆包)](https://ofox.ai/zh/docs/develop/models/seedream),视频模型见 [Seedance](https://ofox.ai/zh/docs/develop/models/seedance)。 ## 常见任务 - [关闭深度思考](#thinking) — 思考默认开启,耗时较长时如何关闭。 - [在 Claude Code 中使用](#anthropic) — 通过 Anthropic 接口调用豆包。 - [图片输入与结构化输出](#features) — image_url 与 json_schema。 - [报错排查](#errors) — 思考类型不支持、参数组合无效、max_tokens 超限。 ## 模型 完整的模型列表与实时价格请参阅[模型页](https://ofox.ai/zh/models?provider=volcengine)。模型 ID 的前缀为 `volcengine/`,可省略;写成 `bytedance/`、`doubao/` 前缀或火山方舟带日期的模型名称会返回 404。 **常用模型 ID(调用时原样复制)** - Seed 2.1 Pro: `volcengine/doubao-seed-2.1-pro` — 256K 上下文,支持图片输入 - Seed 2.1 Turbo: `volcengine/doubao-seed-2.1-turbo` — 256K 上下文,支持图片输入 - Seed Evolving: `volcengine/doubao-seed-evolving` — 256K 上下文,支持图片输入 - Seed Character: `volcengine/doubao-seed-character` — 默认不思考,不支持 Anthropic 接口 以上模型由火山引擎(`volcengine`)提供,均支持 Chat Completions 与 Responses 接口。 ## 调用示例 **Python** ```python filename="doubao_basic.py" import os from openai import OpenAI client = OpenAI(base_url="https://api.ofox.ai/v1", api_key=os.environ["OFOX_API_KEY"]) resp = client.chat.completions.create( model="volcengine/doubao-seed-2.1-pro", messages=[{"role": "user", "content": "用一句话解释什么是幂等性。"}], extra_body={"thinking": {"type": "disabled"}}, ) print(resp.choices[0].message.content) ``` **cURL** ```bash filename="Terminal" curl https://api.ofox.ai/v1/chat/completions \ -H "Authorization: Bearer $OFOX_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "volcengine/doubao-seed-2.1-pro", "messages": [{"role": "user", "content": "用一句话解释什么是幂等性。"}], "thinking": {"type": "disabled"} }' ``` ## 深度思考 **要点**:Seed 2.1 Pro、Seed 2.1 Turbo 与 Seed Evolving 默认开启深度思考,简单问题也可能耗时数十秒。不需要思考时,请将 thinking 的 type 设为 disabled。 | 模型 | 默认 | 控制方式 | |---|---|---| | Seed 2.1 Pro、Seed 2.1 Turbo、Seed Evolving | 开启 | `"thinking": {"type": "disabled"}` 关闭;`reasoning_effort: "low"` 降低思考量 | | Seed Character | 关闭 | 不支持 `reasoning_effort` | - `thinking.type` 支持 `enabled` 与 `disabled`,传 `auto` 会返回 400。 - 实测「用一句话解释什么是幂等性」:Seed 2.1 Pro 默认思考约 1500 token、耗时约 40 秒;Seed Evolving 约 1700 token、约 54 秒。关闭思考后约 2 秒返回。 - 思考 token 计入 `max_tokens`。上限设得过小时,`content` 可能为空,`finish_reason` 为 `length`。 - 思考 token 按输出单价计费,数量见 `usage.completion_tokens_details.reasoning_tokens`。 读取思考内容:流式响应中位于 `delta.reasoning_content`;非流式响应中位于 `message.reasoning_details`,请将各项的 `text` 依次拼接。 ## 在 Claude Code 中使用 Seed 2.1 Pro、Seed 2.1 Turbo 与 Seed Evolving 支持 Anthropic 原生接口,地址为 `https://api.ofox.ai/anthropic`: **Claude Code 配置值** - ANTHROPIC_BASE_URL: `https://api.ofox.ai/anthropic` - ANTHROPIC_AUTH_TOKEN: 粘贴你的 OfoxAI API Key - ANTHROPIC_MODEL: `volcengine/doubao-seed-2.1-pro` - 通过 Anthropic 接口调用时,不传 `thinking` 参数则不返回思考内容。需要思考时传 `"thinking": {"type": "enabled", "budget_tokens": 2000}` 或 `{"type": "adaptive"}`,思考内容以 `thinking` 块返回。 - Seed Character 不支持 Anthropic 接口,调用会返回 `protocol_not_supported`。 Claude Code 的完整配置步骤见 [Claude Code 配置](https://ofox.ai/zh/docs/integrations/claude-code)。 ## 图片输入与结构化输出 - **图片输入**:以上模型均支持图片输入,使用标准的 `image_url` 内容块,写法见[视觉理解](https://ofox.ai/zh/docs/develop/guides/vision)。图片链接需能从公网快速下载,否则会返回 `Timeout while downloading url`;也可以改用 base64 数据。 - **结构化输出**:`response_format` 支持 `json_schema` 与 `json_object`,写法见[结构化输出](https://ofox.ai/zh/docs/develop/guides/structured-output)。 - **工具调用**:使用标准的 `tools` 参数,返回 `tool_calls`。 ## 常见报错 | HTTP · type | 报错原文 | 原因 | 处理方法 | |---|---|---|---| | 400 `BadRequest` | 包含 `Unsupported thinking type for the current model: auto` | `thinking.type` 传了 `auto` | 改用 `enabled` 或 `disabled` | | 400 `BadRequest` | 包含 `Invalid combination of reasoning_effort and thinking type: low + disabled` | 向 Seed Character 传了 `reasoning_effort` | 删除 `reasoning_effort` | | 400 `BadRequest` | 包含 `integer above maximum value, expected a value <= 262144` | `max_tokens` 超过上限 | 调小 `max_tokens` | | 400 `BadRequest` | 包含 `Timeout while downloading url` | 图片链接下载超时 | 换用可快速访问的链接,或改用 base64 | | 400 `protocol_not_supported` | `Model 'volcengine/doubao-seed-character' does not support the 'anthropic' protocol on this platform.` | Seed Character 不支持 Anthropic 接口 | 改用 OpenAI 兼容接口 | | 404 `model_not_found` | `Model 'bytedance/doubao-seed-2.1-pro' not found` | 前缀写错 | 前缀为 `volcengine/`,从本页复制模型 ID | | 请求超时 | — | 默认开启深度思考,耗时较长 | 关闭思考、使用流式输出,或将客户端超时设置为 600 秒以上 | 其他通用错误见[错误处理](https://ofox.ai/zh/docs/develop/guides/error-handling)。 ## 官方文档 - [火山方舟 · 文档](https://www.volcengine.com/docs/82379) ## 常见问题 **豆包的模型 ID 怎么写?** 标准写法为 volcengine/doubao-seed-2.1-pro,也可以省略前缀写成 doubao-seed-2.1-pro。写成 bytedance/ 或 doubao/ 前缀会返回 404。 **豆包为什么回答这么慢?** Seed 2.1 Pro、Seed 2.1 Turbo 与 Seed Evolving 默认开启深度思考,简单问题也可能思考上千 token、耗时数十秒。不需要思考时传 "thinking": {"type": "disabled"},OpenAI SDK 中放在 extra_body 里。 **Claude Code 能用豆包吗?** 能。ANTHROPIC_BASE_URL 设为 https://api.ofox.ai/anthropic,模型填 volcengine/doubao-seed-2.1-pro。Seed Character 不支持 Anthropic 接口。 **豆包能识别图片吗?** 能。Seed 2.1 Pro、Seed 2.1 Turbo、Seed Evolving 与 Seed Character 均支持图片输入。