claude: do not auto-enable extended thinking

This commit is contained in:
Finessse
2025-12-17 17:06:33 +07:00
parent 2b53dbb09c
commit ef732615a4
2 changed files with 6 additions and 30 deletions
@@ -65,20 +65,9 @@ func ConvertOpenAIRequestToClaude(modelName string, inputRawJSON []byte, stream
root := gjson.ParseBytes(rawJSON)
if v := root.Get("reasoning_effort"); v.Exists() {
out, _ = sjson.Set(out, "thinking.type", "enabled")
switch v.String() {
case "none":
out, _ = sjson.Set(out, "thinking.type", "disabled")
case "low":
out, _ = sjson.Set(out, "thinking.budget_tokens", 1024)
case "medium":
out, _ = sjson.Set(out, "thinking.budget_tokens", 8192)
case "high":
out, _ = sjson.Set(out, "thinking.budget_tokens", 24576)
}
}
// Do not map OpenAI "reasoning_effort" to Claude extended thinking by default.
// Enabling Claude thinking requires assistant messages to start with a thinking block,
// which OpenAI-format requests do not provide and will be rejected upstream.
// Helper for generating tool call IDs in the form: toolu_<alphanum>
// This ensures unique identifiers for tool calls in the Claude Code format
@@ -52,22 +52,9 @@ func ConvertOpenAIResponsesRequestToClaude(modelName string, inputRawJSON []byte
root := gjson.ParseBytes(rawJSON)
if v := root.Get("reasoning.effort"); v.Exists() {
out, _ = sjson.Set(out, "thinking.type", "enabled")
switch v.String() {
case "none":
out, _ = sjson.Set(out, "thinking.type", "disabled")
case "minimal":
out, _ = sjson.Set(out, "thinking.budget_tokens", 1024)
case "low":
out, _ = sjson.Set(out, "thinking.budget_tokens", 4096)
case "medium":
out, _ = sjson.Set(out, "thinking.budget_tokens", 8192)
case "high":
out, _ = sjson.Set(out, "thinking.budget_tokens", 24576)
}
}
// Do not map OpenAI "reasoning.effort" to Claude extended thinking by default.
// Enabling Claude thinking requires assistant messages to start with a thinking block,
// which OpenAI-format requests do not provide and will be rejected upstream.
// Helper for generating tool call IDs when missing
genToolCallID := func() string {