Skip to content

推理模式

支援的模型可透過 reasoning_effort 或相應參數調整思考強度。可用等級依模型而異,較高強度通常更慢且會使用更多計費 token。

  • 先查看模型頁確認是否支援推理及正式等級名稱。
  • 程式不應假設所有模型都有 low、medium、high;不支援時請省略參數。
  • 從最低可接受強度開始,並以 usage、延遲與答案品質共同評估。

完整範例

原始指南中的可執行範例完整保留如下。請只執行適用於您所用工具和作業系統的區塊。

json
"usage": {
  "prompt_tokens": 179,
  "completion_tokens": 545,          // total output — this is what's billed
  "completion_tokens_details": {
    "reasoning_tokens": 445          // of which, spent on reasoning
  }
}
bash
curl https://nordrouter.com/v1/chat/completions \
  -H "Authorization: Bearer sk-nr-YOUR-KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-5",
    "max_tokens": 4000,
    "reasoning": { "effort": "high" },
    "messages": [{ "role": "user", "content": "A hard problem…" }]
  }'

官方資料與相關連結

ParameterWhat it does
reasoning.effortReasoning depth: "low" / "medium" / "high". Lower effort — fewer reasoning tokens, cheaper responses
reasoning.max_tokensToken budget for reasoning (Anthropic style). Must be lower than the request's max_tokens
reasoning.enabled: falseTurn reasoning off (where the model supports it)
reasoning.exclude: trueHide the reasoning text from the response. Does not save money — the model still thinks and the tokens are billed
ModelBehavior
anthropic/claude-sonnet-5Doesn't reason by default. effort and max_tokens enable thinking, enabled: false genuinely disables it
anthropic/claude-fable-5Thinks adaptively — decides on its own how much. reasoning.* parameters are not supported (returns 400); control depth with output_config: { "effort": "low" | "medium" | "high" }
openai/gpt-5.4, gpt-5.5Reason by default; reasoning_effort scales the depth
x-ai/grok-4.3Reasons by default and generously (hundreds of tokens); effort: "low" cuts it down noticeably
deepseek/deepseek-r1, z-ai/glm-5.xAlways think: "disabling" only hides the text, reasoning tokens are still billed

相關指南

先以最小文字請求驗證連線,再加入串流、工具呼叫、圖片或其他進階功能。請勿把 API 金鑰寫入公開程式碼或瀏覽器前端。

疑難排解