背景
起初,在 Claude Code 中通过 ccswitch 接入了第三方模型,使用一段时间后,在云厂商控制台发现产生了两个模型的计费信息,但实际上只用了一个模型。
原因
在 ccswitch 将 sonnet 挡映射到模型 A,opus 映射到模型 B,对话中选择模型 B。
Claude Code 在每次对话结束后,会在输入框生成灰色的建议提示词,便于用户 Tab 使用,该 Prompt Suggestions 功能使用 Sonnet 档映射的模型 A 完成此任务。
证据
在 ccswitch 的日志中,调用 sonnet 即模型 A 的数据具有以下特征:
- 输出 token 数量少
- 调用时间在每轮主对话结束
指挥 Claude Code 抓包获取到 ccswitch 和 Claude Code 的通信数据,其请求体包含以下内容:
[SUGGESTION MODE: Suggest what the user might naturally type next into Claude Code.]
“Format: 2-12 words, match the user’s style. Or nothing. Reply with ONLY the suggestion, no quotes or explanation.”
关于 Prompt Suggestions 功能
让 Claude Code 调用其自身设置接口,输出了以下字段:
{"key":"prompt_suggestions","label":"Prompt suggestions","value":true,"current":"On","meaning":"Show a suggested next prompt in the message box after each reply. Each suggestion is one more model request. ..."}在同一接口中还包含以下部分:
"settable":false,"locked":"This app ignores this setting for now."这表明,该功能疑似无法关闭。并且,当 sonnet 挡映射的模型为不可用模型时,Claude Code 疑似会调用其他模型完成此任务。
个人观点,仅供参考!部分例证由 ai 获得!