fix(api): 对齐 Claude API 最新规范 — Thinking/effort/beta headers 全面更新#47
Merged
mirrorange merged 1 commit intomirrorange:mainfrom Mar 4, 2026
Conversation
- ThinkingOptions.type 增加 "adaptive" 支持(修复 claude-sonnet-4-6 等模型 422) - OutputConfig.effort 增加 "max" 级别(Opus 4.6 独有) - OutputConfig extra 策略由 ignore 改为 allow,自动透传新字段(如 format) - 新增 RedactedThinkingContent 模型,防止 Web 模式丢弃 redacted_thinking 块 - temperature 默认值由 1.0 改为 None,避免 thinking 模式下隐式注入导致 400 - ClaudeWebProcessor paprika_mode 判断兼容 adaptive 类型 - 移除已 GA 的 effort/structured-outputs beta header - 支持客户端 anthropic-beta header 透传(去重合并) (cherry picked from commit 33c7499)
pdtkts
added a commit
to pdtkts/clove
that referenced
this pull request
Feb 24, 2026
pdtkts
added a commit
to pdtkts/clove
that referenced
this pull request
Feb 24, 2026
…ng, beta headers passthrough
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.
总结
Clove 的 Thinking 相关模型定义滞后于 Anthropic 官方 API,导致:
claude-sonnet-4-6等模型发送thinking: {type: "adaptive"}时 422 报错"max"级别被 Pydantic 拦截本 PR 将 Clove 数据模型和请求头处理对齐 2026-02 官方规范。
修改
🔴 阻断修复
ThinkingOptions.type增加"adaptive"支持🟡 功能完善
OutputConfig.effort增加"max"级别(Opus 4.6)OutputConfigextra 策略ignore→allow,自动透传新字段(如format)RedactedThinkingContent模型,防止 Web 模式丢弃该内容块temperature默认值1.0→None,避免 thinking 模式隐式注入导致 400ClaudeWebProcessorpaprika_mode 判断兼容adaptiveeffort-2025-11-24/structured-outputs-2025-11-13beta headeranthropic-betaheader 透传(去重合并)🟢 注释更新
OutputConfig/OutputFormatdocstring 对齐 GA 状态修改文件
app/models/claude.pyapp/processors/claude_ai/claude_api_processor.pyapp/processors/claude_ai/claude_web_processor.py测试
thinking: {type: "adaptive"}请求,确认不再 422output_config: {effort: "max"}确认不被 Pydantic 拦截anthropic-beta: interleaved-thinking-2025-05-14header 的请求,确认透传claude-sonnet-4-6端到端验证