Enha: or free models

This commit is contained in:
Grail Finder
2025-09-05 15:10:40 +03:00
parent 53dc5a5e8d
commit 0276000bfa
4 changed files with 195 additions and 35 deletions

View File

@@ -74,6 +74,49 @@ type DSResp struct {
Object string `json:"object"`
}
// OpenRouter chat completions response (supports tool calls)
type ORChatRespChoice struct {
Index int `json:"index"`
Message struct {
Role string `json:"role"`
Content string `json:"content"`
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
} `json:"message"`
FinishReason string `json:"finish_reason"`
}
type ORChatResp struct {
ID string `json:"id"`
Choices []ORChatRespChoice `json:"choices"`
Created int `json:"created"`
Model string `json:"model"`
Object string `json:"object"`
Usage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
} `json:"usage"`
}
// OpenRouter completions response (text only)
type ORCompletionResp struct {
ID string `json:"id"`
Object string `json:"object"`
Created int `json:"created"`
Model string `json:"model"`
Choices []struct {
Text string `json:"text"`
Index int `json:"index"`
Logprobs any `json:"logprobs"`
FinishReason string `json:"finish_reason"`
} `json:"choices"`
Usage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
} `json:"usage"`
}
type LLMResp struct {
Index int `json:"index"`
Content string `json:"content"`