Skip to content

fix: make reasoning effort opt-in, disable by default#345

Merged
icebear0828 merged 3 commits intomasterfrom
fix/reasoning-effort-opt-in
Apr 10, 2026
Merged

fix: make reasoning effort opt-in, disable by default#345
icebear0828 merged 3 commits intomasterfrom
fix/reasoning-effort-opt-in

Conversation

@icebear0828
Copy link
Copy Markdown
Owner

Summary

  • 根本原因:所有请求都会自动注入 reasoning: { effort: "medium" },即使是最简单的 "hi" 也会触发 medium 推理,导致用户一次对话消耗 0.1M+ tokens(相关 issue: 代理可能导致输入token消耗激增,一次简单对话竟然要0.1m token #344
  • 移除 modelInfo?.defaultReasoningEffort 从兜底链(三个翻译文件 + responses.ts),彻底切断模型元数据自动激活推理的路径
  • default_reasoning_effort schema 默认值改为 nullconfig/default.yaml 同步更新
  • Settings API 允许传 null,Dashboard 新增 "Disabled (no reasoning)" 选项

Reasoning 仍在以下情况生效:客户端显式传 reasoning_effort、模型名后缀指定、或用户在 Dashboard 手动设置。

Test plan

  • npm test — 1331 tests passed
  • 新增测试:does not set reasoning effort when config is null and no explicit request
  • 新增测试:accepts null default_reasoning_effort to disable reasoning
  • 更新受影响的现有测试(anthropic × 2,gemini × 1,config × 3,integration × 3)

Fixes #344

Previously every request sent reasoning: { effort: "medium" } to the
Codex API due to modelInfo.defaultReasoningEffort always falling back to
"medium", causing 100K+ token consumption for simple conversations.

- Remove modelInfo?.defaultReasoningEffort from fallback chain in all
  translation files (openai/anthropic/gemini) and responses.ts
- Change default_reasoning_effort schema default from "medium" to null
- Update config/default.yaml to default_reasoning_effort: null
- Allow null in settings API validation and hook type
- Add "Disabled (no reasoning)" option to Dashboard dropdown
- Update tests to reflect new opt-in behavior

Reasoning is still activated when: client sends reasoning_effort,
model name suffix specifies effort, or user sets default in config.
Previously reasoning: { summary: "auto" } was sent on every request even
without an effort, which caused include: ["reasoning.encrypted_content"]
to be added unconditionally. This could trigger default-effort reasoning
on models that interpret the presence of the reasoning object as opt-in.

Now reasoning is omitted entirely when no effort is configured or
requested. The responses.ts route preserves client-supplied reasoning
objects (e.g. explicit summary override) when present.
@icebear0828 icebear0828 merged commit 4d6e34f into master Apr 10, 2026
1 check passed
@icebear0828 icebear0828 deleted the fix/reasoning-effort-opt-in branch April 10, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

代理可能导致输入token消耗激增,一次简单对话竟然要0.1m token

1 participant