fix(translator): strip defer_loading from Claude tool declarations in Codex and Gemini translators
Claude's Tool Search feature (advanced-tool-use-2025-11-20 beta) adds defer_loading field to tool definitions. When proxying Claude requests to Codex or Gemini, this unknown field causes 400 errors upstream. Strip defer_loading (and cache_control where missing) in all three Claude-to-upstream translation paths: - codex/claude: defer_loading + cache_control - gemini-cli/claude: defer_loading - gemini/claude: defer_loading Fixes #1725, Fixes #1375
This commit is contained in:
@@ -156,6 +156,7 @@ func ConvertClaudeRequestToCLI(modelName string, inputRawJSON []byte, _ bool) []
|
||||
tool, _ = sjson.Delete(tool, "input_examples")
|
||||
tool, _ = sjson.Delete(tool, "type")
|
||||
tool, _ = sjson.Delete(tool, "cache_control")
|
||||
tool, _ = sjson.Delete(tool, "defer_loading")
|
||||
if gjson.Valid(tool) && gjson.Parse(tool).IsObject() {
|
||||
if !hasTools {
|
||||
out, _ = sjson.SetRaw(out, "request.tools", `[{"functionDeclarations":[]}]`)
|
||||
|
||||
Reference in New Issue
Block a user