mirror of
https://github.com/router-for-me/CLIProxyAPIPlus.git
synced 2026-03-29 16:54:41 +00:00
Merge pull request #1768 from router-for-me/claude
fix(translator): handle Claude thinking type "auto" like adaptive
This commit is contained in:
@@ -440,14 +440,8 @@ func ConvertClaudeRequestToAntigravity(modelName string, inputRawJSON []byte, _
|
|||||||
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.thinkingBudget", budget)
|
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.thinkingBudget", budget)
|
||||||
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.includeThoughts", true)
|
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.includeThoughts", true)
|
||||||
}
|
}
|
||||||
case "auto":
|
case "adaptive", "auto":
|
||||||
// Amp sends thinking.type="auto" — use max budget from model config
|
// Keep adaptive/auto as a high level sentinel; ApplyThinking resolves it
|
||||||
// Antigravity API for Claude models requires a concrete positive budget,
|
|
||||||
// not -1. Use a high default that ApplyThinking will cap to model max.
|
|
||||||
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.thinkingBudget", 64000)
|
|
||||||
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.includeThoughts", true)
|
|
||||||
case "adaptive":
|
|
||||||
// Keep adaptive as a high level sentinel; ApplyThinking resolves it
|
|
||||||
// to model-specific max capability.
|
// to model-specific max capability.
|
||||||
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.thinkingLevel", "high")
|
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.thinkingLevel", "high")
|
||||||
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.includeThoughts", true)
|
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.includeThoughts", true)
|
||||||
|
|||||||
@@ -230,8 +230,8 @@ func ConvertClaudeRequestToCodex(modelName string, inputRawJSON []byte, _ bool)
|
|||||||
reasoningEffort = effort
|
reasoningEffort = effort
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "adaptive":
|
case "adaptive", "auto":
|
||||||
// Claude adaptive means "enable with max capacity"; keep it as highest level
|
// Claude adaptive/auto means "enable with max capacity"; keep it as highest level
|
||||||
// and let ApplyThinking normalize per target model capability.
|
// and let ApplyThinking normalize per target model capability.
|
||||||
reasoningEffort = string(thinking.LevelXHigh)
|
reasoningEffort = string(thinking.LevelXHigh)
|
||||||
case "disabled":
|
case "disabled":
|
||||||
|
|||||||
@@ -180,8 +180,8 @@ func ConvertClaudeRequestToCLI(modelName string, inputRawJSON []byte, _ bool) []
|
|||||||
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.thinkingBudget", budget)
|
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.thinkingBudget", budget)
|
||||||
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.includeThoughts", true)
|
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.includeThoughts", true)
|
||||||
}
|
}
|
||||||
case "adaptive":
|
case "adaptive", "auto":
|
||||||
// Keep adaptive as a high level sentinel; ApplyThinking resolves it
|
// Keep adaptive/auto as a high level sentinel; ApplyThinking resolves it
|
||||||
// to model-specific max capability.
|
// to model-specific max capability.
|
||||||
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.thinkingLevel", "high")
|
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.thinkingLevel", "high")
|
||||||
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.includeThoughts", true)
|
out, _ = sjson.Set(out, "request.generationConfig.thinkingConfig.includeThoughts", true)
|
||||||
|
|||||||
@@ -161,8 +161,8 @@ func ConvertClaudeRequestToGemini(modelName string, inputRawJSON []byte, _ bool)
|
|||||||
out, _ = sjson.Set(out, "generationConfig.thinkingConfig.thinkingBudget", budget)
|
out, _ = sjson.Set(out, "generationConfig.thinkingConfig.thinkingBudget", budget)
|
||||||
out, _ = sjson.Set(out, "generationConfig.thinkingConfig.includeThoughts", true)
|
out, _ = sjson.Set(out, "generationConfig.thinkingConfig.includeThoughts", true)
|
||||||
}
|
}
|
||||||
case "adaptive":
|
case "adaptive", "auto":
|
||||||
// Keep adaptive as a high level sentinel; ApplyThinking resolves it
|
// Keep adaptive/auto as a high level sentinel; ApplyThinking resolves it
|
||||||
// to model-specific max capability.
|
// to model-specific max capability.
|
||||||
out, _ = sjson.Set(out, "generationConfig.thinkingConfig.thinkingLevel", "high")
|
out, _ = sjson.Set(out, "generationConfig.thinkingConfig.thinkingLevel", "high")
|
||||||
out, _ = sjson.Set(out, "generationConfig.thinkingConfig.includeThoughts", true)
|
out, _ = sjson.Set(out, "generationConfig.thinkingConfig.includeThoughts", true)
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ func ConvertClaudeRequestToOpenAI(modelName string, inputRawJSON []byte, stream
|
|||||||
out, _ = sjson.Set(out, "reasoning_effort", effort)
|
out, _ = sjson.Set(out, "reasoning_effort", effort)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case "adaptive":
|
case "adaptive", "auto":
|
||||||
// Claude adaptive means "enable with max capacity"; keep it as highest level
|
// Claude adaptive/auto means "enable with max capacity"; keep it as highest level
|
||||||
// and let ApplyThinking normalize per target model capability.
|
// and let ApplyThinking normalize per target model capability.
|
||||||
out, _ = sjson.Set(out, "reasoning_effort", string(thinking.LevelXHigh))
|
out, _ = sjson.Set(out, "reasoning_effort", string(thinking.LevelXHigh))
|
||||||
case "disabled":
|
case "disabled":
|
||||||
|
|||||||
Reference in New Issue
Block a user