Repository navigation
fix: anthropic 协议下 codex 模型档位直传 reasoning_effort - #317
Merged
Merged
Conversation
现象(2026-11-23 用户报障):anthropic provider 里用 codex 系模型 (gpt-5.x-codex / gpt-6.2-sol),模型菜单选思考档位后请求报错。 根因:models.py 的 anthropic 分支默认走 thinking/budget_tokens(Claude 系原生参数);codex 只吃 reasoning_effort——anthropic 壳网关对 codex 收到 thinking 块直接拒(400)。此前唯一出口是手配 thinking_param_style=reasoning_effort( provider 级,对混部 Claude 的 配置不可用)。 修复:anthropic 分支判定 codex_efforts(model) 命中时自动走 reasoning_effort 直传(与 thinking_param_style 覆写同路径),不发 thinking 块、不改 temperature/max_tokens 约束;off 由 resolve 层 归一化为 low(codex 无 off 档,既有 legacy 规则)。 验证:新增回归用例 test_anthropic_codex_effort_direct_reasoning_effort (high → reasoning_effort=high、无 thinking 键;off → low); test_models_thinking + test_thinking_effort 47 全绿;ruff 干净。
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
现象
anthropic provider(阿里云 MaaS anthropic 协议端点等 anthropic 壳网关)下使用 codex 系模型(gpt-5.x-codex / gpt-6.2-sol / codex/ 别名),在模型菜单选思考档位后请求报错。
根因
models.pyanthropic 分支默认把档位映射成thinking/budget_tokens(Claude 系原生参数);codex 只吃reasoning_effort——anthropic 壳网关对 codex 收到 thinking 块直接 400。此前唯一出口是手配thinking_param_style=reasoning_effort(provider 级开关,混部 Claude 模型的配置不可用)。修复
anthropic 分支
codex_efforts(model)命中时自动走reasoning_effort直传(与thinking_param_style覆写同路径):不发 thinking 块、不动 temperature/max_tokens 约束;off由 resolve 层归一化为low(codex 值域无 off,既有 legacy 规则)。验证
test_anthropic_codex_effort_direct_reasoning_effort:high →reasoning_effort=high且无thinking键;off →low