feat(ai-proxy): add OpenRouter provider support (#2823)

This commit is contained in:
澄潭
2025-08-28 19:26:21 +08:00
committed by GitHub
parent b2ffeff7b8
commit 44c33617fa
11 changed files with 5684 additions and 184 deletions

View File

@@ -29,7 +29,12 @@ const (
reasoningEndTag = "</think>"
)
type NonOpenAIStyleOptions struct {
ReasoningMaxTokens int `json:"reasoning_max_tokens,omitempty"`
}
type chatCompletionRequest struct {
NonOpenAIStyleOptions
Messages []chatMessage `json:"messages"`
Model string `json:"model"`
Store bool `json:"store,omitempty"`
@@ -169,7 +174,9 @@ type chatMessage struct {
Role string `json:"role,omitempty"`
Content any `json:"content,omitempty"`
ReasoningContent string `json:"reasoning_content,omitempty"`
Reasoning string `json:"reasoning,omitempty"` // For streaming responses
ToolCalls []toolCall `json:"tool_calls,omitempty"`
FunctionCall *functionCall `json:"function_call,omitempty"` // For legacy OpenAI format
Refusal string `json:"refusal,omitempty"`
ToolCallId string `json:"tool_call_id,omitempty"`
}