Skip to Content
模型用法豆包 Seed

豆包 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。

常用模型 ID(呼叫時原樣複製)
Seed 2.1 Provolcengine/doubao-seed-2.1-pro256K 上下文,支援圖片輸入
Seed 2.1 Turbovolcengine/doubao-seed-2.1-turbo256K 上下文,支援圖片輸入
Seed Evolvingvolcengine/doubao-seed-evolving256K 上下文,支援圖片輸入
Seed Charactervolcengine/doubao-seed-character預設不思考,不支援 Anthropic 介面

以上模型由火山引擎(volcengine)提供,皆支援 Chat Completions 與 Responses 介面。

呼叫範例

doubao_basic.py
import os from openai import OpenAI client = OpenAI(base_url="https://api.ofox.io/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)

深度思考

重點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.io/anthropic:

Claude Code 設定值
ANTHROPIC_BASE_URLhttps://api.ofox.io/anthropic
ANTHROPIC_AUTH_TOKEN貼上你的 OfoxAI API Key
ANTHROPIC_MODELvolcengine/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。

常見錯誤

HTTP · type錯誤原文原因處理方式
400 BadRequest包含 Unsupported thinking type for the current model: autothinking.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 <= 262144max_tokens 超過上限調低 max_tokens
400 BadRequest包含 Timeout while downloading url圖片連結下載逾時改用可快速存取的連結,或改用 base64
400 protocol_not_supportedModel 'volcengine/doubao-seed-character' does not support the 'anthropic' protocol on this platform.Seed Character 不支援 Anthropic 介面改用 OpenAI 相容介面
404 model_not_foundModel 'bytedance/doubao-seed-2.1-pro' not found前綴寫錯前綴為 volcengine/,從本頁複製模型 ID
請求逾時—預設開啟深度思考,耗時較長關閉思考、使用串流輸出,或將用戶端逾時設定為 600 秒以上

其他通用錯誤請見錯誤處理。

官方文件

常見問題

豆包的模型 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.io/anthropic,模型填入 volcengine/doubao-seed-2.1-pro。Seed Character 不支援 Anthropic 介面。

豆包可以辨識圖片嗎?

可以。Seed 2.1 Pro、Seed 2.1 Turbo、Seed Evolving 與 Seed Character 皆支援圖片輸入。

最後更新於