From 5989e9a39040b6d3282f2950630a1ff1da9d95c5 Mon Sep 17 00:00:00 2001 From: ashisgreat22 Date: Wed, 15 Apr 2026 08:30:09 +0000 Subject: [PATCH] fix: add thinking parameter to match claude-code request format --- converter.go | 4 ++++ types.go | 26 ++++++++++++++++---------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/converter.go b/converter.go index c0366f1..c94df05 100644 --- a/converter.go +++ b/converter.go @@ -14,6 +14,10 @@ func ConvertOpenAIRequest(req *ChatCompletionRequest) *AnthropicRequest { Messages: convertMessages(remainingMessages), System: system, MaxTokens: 32000, + Thinking: &AnthropicThinking{ + Type: "enabled", + BudgetTokens: 10000, + }, } if req.MaxTokens != nil { diff --git a/types.go b/types.go index 0dbb926..abf90fb 100644 --- a/types.go +++ b/types.go @@ -94,16 +94,22 @@ type FunctionCall struct { // Anthropic Types type AnthropicRequest struct { - Model string `json:"model"` - Messages []AnthropicMessage `json:"messages"` - System string `json:"system,omitempty"` - MaxTokens int `json:"max_tokens"` - Stream bool `json:"stream,omitempty"` - Temperature *float64 `json:"temperature,omitempty"` - TopP *float64 `json:"top_p,omitempty"` - StopSequences []string `json:"stop_sequences,omitempty"` - Tools []AnthropicTool `json:"tools,omitempty"` - ToolChoice *AnthropicToolChoice `json:"tool_choice,omitempty"` + Model string `json:"model"` + Messages []AnthropicMessage `json:"messages"` + System string `json:"system,omitempty"` + MaxTokens int `json:"max_tokens"` + Stream bool `json:"stream,omitempty"` + Temperature *float64 `json:"temperature,omitempty"` + TopP *float64 `json:"top_p,omitempty"` + StopSequences []string `json:"stop_sequences,omitempty"` + Tools []AnthropicTool `json:"tools,omitempty"` + ToolChoice *AnthropicToolChoice `json:"tool_choice,omitempty"` + Thinking *AnthropicThinking `json:"thinking,omitempty"` +} + +type AnthropicThinking struct { + Type string `json:"type"` + BudgetTokens int `json:"budget_tokens,omitempty"` } type AnthropicMessage struct {