豆包 Seed 系列
字节跳动的豆包 Seed 文本模型,包括 Seed 2.1 Pro、Seed 2.1 Turbo、Seed Evolving 与 Seed Character。通过 OpenAI 兼容接口调用,除 Seed Character 外同时支持 Anthropic 原生接口,可在 Claude Code 中使用。豆包的生图模型见 Seedream(豆包),视频模型见 Seedance。
常见任务
模型
完整的模型列表与实时价格请参阅模型页 。模型 ID 的前缀为 volcengine/,可省略;写成 bytedance/、doubao/ 前缀或火山方舟带日期的模型名称会返回 404。
volcengine/doubao-seed-2.1-pro256K 上下文,支持图片输入volcengine/doubao-seed-2.1-turbo256K 上下文,支持图片输入volcengine/doubao-seed-evolving256K 上下文,支持图片输入volcengine/doubao-seed-character默认不思考,不支持 Anthropic 接口以上模型由火山引擎(volcengine)提供,均支持 Chat Completions 与 Responses 接口。
调用示例
Python
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)深度思考
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:
https://api.ofox.ai/anthropicvolcengine/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 配置。
图片输入与结构化输出
- 图片输入:以上模型均支持图片输入,使用标准的
image_url内容块,写法见视觉理解。图片链接需能从公网快速下载,否则会返回Timeout while downloading url;也可以改用 base64 数据。 - 结构化输出:
response_format支持json_schema与json_object,写法见结构化输出。 - 工具调用:使用标准的
tools参数,返回tool_calls。
常见报错
其他通用错误见错误处理。
官方文档
常见问题
豆包的模型 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 均支持图片输入。