OhMyGPT

思考

通过任意协议为 Claude、Gemini 和 GPT 模型开启、关闭或调低推理。

推理 token 按输出 token 计费,所以控制推理就是在控制费用和延迟。无论调用哪个模型,都可以直接用你所用协议自带的推理字段:在 Chat Completions 中发送的 reasoning_effort,对 Claude 和 Gemini 模型同样生效。

各协议的控制字段

协议字段
Chat Completionsreasoning_effort;thinking: {"type": "enabled", "budget_tokens": N}、{"type": "adaptive"} 或 {"type": "disabled"};OpenRouter 的 reasoning 对象和 include_reasoning
Responsesreasoning.effort
Messagesthinking、output_config.effort
GeminigenerationConfig.thinkingConfig:thinkingLevel、thinkingBudget、includeThoughts

在模型的原生协议上,这些字段按你发送的原样传给模型,用法以厂商文档为准:GPT 用 reasoning_effort,通过 Messages 调用的 Claude 用 thinking,通过 Gemini 端点调用的 Gemini 用 thinkingConfig,在 Chat Completions 上还可以用厂商自有字段,例如 DeepSeek 的 thinking、Qwen 的 enable_thinking。

在 Chat Completions 中,reasoning_effort 优先于 reasoning 对象,reasoning 对象又优先于 include_reasoning。推理强度可选 none、minimal、low、medium、high 和 xhigh。

Claude

通过 Chat Completions、Responses 或 Gemini 调用 Claude 模型时,可以使用以下设置:

发送的内容对 Claude 的效果
thinking: {"type": "enabled", "budget_tokens": N}开启扩展思考,预算为 N 个 token
thinking: {"type": "adaptive"}由 Claude 决定何时思考、思考多少
reasoning_effort / reasoning.effortClaude 的推理强度;在 Claude Fable 5 和 5.1 上还会同时开启自适应思考
thinking: {"type": "disabled"}关闭思考
curl https://api.ohmygpt.com/v1/chat/completions \
  -H "Authorization: Bearer $OHMYGPT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-haiku-4-5",
    "max_tokens": 1500,
    "messages": [{"role": "user", "content": "What is 17 * 23? Reply with the number only."}],
    "thinking": {"type": "enabled", "budget_tokens": 1024}
  }'
{
  "choices": [
    {
      "finish_reason": "stop",
      "native_finish_reason": "end_turn",
      "message": {
        "role": "assistant",
        "content": "391",
        "reasoning": "17 * 23 = ?\n\nLet me calculate this:\n17 * 23 = 17 * 20 + 17 * 3\n= 340 + 51\n= 391",
        "reasoning_details": [{ "type": "reasoning.text", "text": "17 * 23 = ?\n\n…", "signature": "EuoCCrgB…", "index": 0 }]
      }
    }
  ],
  "usage": { "prompt_tokens": 51, "completion_tokens": 60, "total_tokens": 111, "completion_tokens_details": { "reasoning_tokens": 54 } }
}

较新的 Claude 模型采用自适应思考。请按各模型支持的方式设置:

模型用法
Claude Opus 5.5、Opus 5、Sonnet 5.5、Sonnet 5、Haiku 5.5、Fable 5、Fable 5.1、Opus 4.8、Opus 4.7用 {"type": "adaptive"} 加推理强度,不用 token 预算
Claude Opus 5.5、Fable 5、Fable 5.1这些模型始终会思考;想让思考简短,就设一个较低的推理强度
更早的 Claude 模型{"type": "enabled", "budget_tokens": N}

其他设置按你发送的原样交给模型;模型不接受时,它返回的错误会原样交给你,被拒绝的请求不收费。

Gemini

通过 Chat Completions、Responses 或 Messages 调用 Gemini 模型时,可以使用以下设置:

发送的内容对 Gemini 的效果
thinking: {"type": "enabled", "budget_tokens": N}思考预算为 N 个 token,返回思考内容
reasoning_effort: "low"、"medium"、"high"设置思考等级,返回思考内容
reasoning_effort: "none" 或 thinking: {"type": "disabled"}使用该模型最低的思考等级,不返回思考内容

在 google/gemini-3.1-flash-lite 上用与上文相同的提示词实测:

reasoning_effortcompletion_tokens_details.reasoning_tokens
none无此字段,模型没有思考
low118
high229
curl https://api.ohmygpt.com/v1/chat/completions \
  -H "Authorization: Bearer $OHMYGPT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "google/gemini-3.1-flash-lite",
    "messages": [{"role": "user", "content": "What is 17 * 23? Reply with the number only."}],
    "reasoning_effort": "none"
  }'

其他模型

GPT、DeepSeek、Qwen 等原生协议为 Chat Completions 的模型,无论你通过哪种协议发送推理强度,都会转成 reasoning_effort。在 GPT 推理模型上开启推理时,temperature 和 top_p 请保持默认值。

响应中的推理

所有协议都会在用量中报告推理 token 数:

协议字段
Chat Completionsusage.completion_tokens_details.reasoning_tokens
Responsesusage.output_tokens_details.reasoning_tokens
GeminiusageMetadata.thoughtsTokenCount
Messages计入 usage.output_tokens

可见的推理内容在 Chat Completions 中以 reasoning 和 reasoning_details 返回,在 Responses 中是 reasoning 输出项,在 Messages 中是 thinking 块,在 Gemini 中是带有 "thought": true 的 part。

本页目录