跳转到内容

<thinking> 标签作为正文输出 Claude Code

Quick fix

将 provider 的 apiFormat 从 openai_chat 改为 anthropic(若上游支持),可绕过内联 泄露。

报错原文
<thinking>tool call</thinking>
日志很大。我先看当前配置和最近的日志内容。

在 Claude Code 使用 `apiFormat: "openai_chat"` 时,Anthropic 流式转换路径会把 `choice.delta.content` 直接作为 `text` 块输出,未剥离流首内联的 `<thinking>...</thinking>` 标签。因此思考内容会和正文一起以明文显示。

该问题发生在 `<thinking>` 变体:已有处理分别只识别 `<think>`,或仅覆盖 Codex 路径,均未覆盖 Claude 的此转换路径。问题报告确认,若上游支持原生 Anthropic 接口,改用 `anthropic` 格式即可避开该转换路径。

  1. 确认上游 provider 支持原生 Anthropic 接口。

  2. 将该 provider 的 `apiFormat` 从 `openai_chat` 改为 `anthropic`,使请求走 passthrough 路径并避开该流式转换。

ToolClaude Code
Version3.20.4(受影响版本)
PlatformsWindows

(暂无 FAQ)

这是一个非官方社区 wiki,与 cc-switch 作者及项目本身无隶属关系。内容整理自项目公开的 GitHub issues。本站不分发任何软件。