1// Package provider provides types and constants for AI providers.
2package provider
3
4// Type represents the type of AI provider.
5type Type string
6
7// All the supported AI provider types.
8const (
9 TypeOpenAI Type = "openai"
10 TypeAnthropic Type = "anthropic"
11 TypeGemini Type = "gemini"
12 TypeAzure Type = "azure"
13 TypeBedrock Type = "bedrock"
14 TypeVertexAI Type = "vertexai"
15 TypeXAI Type = "xai"
16 TypeOpenRouter Type = "openrouter"
17)
18
19// InferenceProvider represents the inference provider identifier.
20type InferenceProvider string
21
22// All the inference providers supported by the system.
23const (
24 InferenceProviderOpenAI InferenceProvider = "openai"
25 InferenceProviderAnthropic InferenceProvider = "anthropic"
26 InferenceProviderGemini InferenceProvider = "gemini"
27 InferenceProviderAzure InferenceProvider = "azure"
28 InferenceProviderBedrock InferenceProvider = "bedrock"
29 InferenceProviderVertexAI InferenceProvider = "vertexai"
30 InferenceProviderXAI InferenceProvider = "xai"
31 InferenceProviderGROQ InferenceProvider = "groq"
32 InferenceProviderOpenRouter InferenceProvider = "openrouter"
33)
34
35// Provider represents an AI provider configuration.
36type Provider struct {
37 Name string `json:"name"`
38 ID InferenceProvider `json:"id"`
39 APIKey string `json:"api_key,omitempty"`
40 APIEndpoint string `json:"api_endpoint,omitempty"`
41 Type Type `json:"type,omitempty"`
42 DefaultLargeModelID string `json:"default_large_model_id,omitempty"`
43 DefaultSmallModelID string `json:"default_small_model_id,omitempty"`
44 Models []Model `json:"models,omitempty"`
45}
46
47// Model represents an AI model configuration.
48type Model struct {
49 ID string `json:"id"`
50 Name string `json:"model"`
51 CostPer1MIn float64 `json:"cost_per_1m_in"`
52 CostPer1MOut float64 `json:"cost_per_1m_out"`
53 CostPer1MInCached float64 `json:"cost_per_1m_in_cached"`
54 CostPer1MOutCached float64 `json:"cost_per_1m_out_cached"`
55 ContextWindow int64 `json:"context_window"`
56 DefaultMaxTokens int64 `json:"default_max_tokens"`
57 CanReason bool `json:"can_reason"`
58 HasReasoningEffort bool `json:"has_reasoning_efforts"`
59 DefaultReasoningEffort string `json:"default_reasoning_effort,omitempty"`
60 SupportsImages bool `json:"supports_attachments"`
61}
62
63// KnownProviders returns all the known inference providers.
64func KnownProviders() []InferenceProvider {
65 return []InferenceProvider{
66 InferenceProviderOpenAI,
67 InferenceProviderAnthropic,
68 InferenceProviderGemini,
69 InferenceProviderAzure,
70 InferenceProviderBedrock,
71 InferenceProviderVertexAI,
72 InferenceProviderXAI,
73 InferenceProviderGROQ,
74 InferenceProviderOpenRouter,
75 }
76}