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)
17
18// InferenceProvider represents the inference provider identifier.
19type InferenceProvider string
20
21// All the inference providers supported by the system.
22const (
23 InferenceProviderOpenAI InferenceProvider = "openai"
24 InferenceProviderAnthropic InferenceProvider = "anthropic"
25 InferenceProviderGemini InferenceProvider = "gemini"
26 InferenceProviderAzure InferenceProvider = "azure"
27 InferenceProviderBedrock InferenceProvider = "bedrock"
28 InferenceProviderVertexAI InferenceProvider = "vertexai"
29 InferenceProviderXAI InferenceProvider = "xai"
30 InferenceProviderOpenRouter InferenceProvider = "openrouter"
31)
32
33// Provider represents an AI provider configuration.
34type Provider struct {
35 Name string `json:"name"`
36 ID InferenceProvider `json:"id"`
37 APIKey string `json:"api_key,omitempty"`
38 APIEndpoint string `json:"api_endpoint,omitempty"`
39 Type Type `json:"type,omitempty"`
40 DefaultLargeModelID string `json:"default_large_model_id,omitempty"`
41 DefaultSmallModelID string `json:"default_small_model_id,omitempty"`
42 Models []Model `json:"models,omitempty"`
43}
44
45// Model represents an AI model configuration.
46type Model struct {
47 ID string `json:"id"`
48 Model string `json:"model"`
49 CostPer1MIn float64 `json:"cost_per_1m_in"`
50 CostPer1MOut float64 `json:"cost_per_1m_out"`
51 CostPer1MInCached float64 `json:"cost_per_1m_in_cached"`
52 CostPer1MOutCached float64 `json:"cost_per_1m_out_cached"`
53 ContextWindow int64 `json:"context_window"`
54 DefaultMaxTokens int64 `json:"default_max_tokens"`
55 CanReason bool `json:"can_reason"`
56 HasReasoningEffort bool `json:"has_reasoning_efforts"`
57 DefaultReasoningEffort string `json:"default_reasoning_effort,omitempty"`
58 SupportsImages bool `json:"supports_attachments"`
59}
60
61// KnownProviders returns all the known inference providers.
62func KnownProviders() []InferenceProvider {
63 return []InferenceProvider{
64 InferenceProviderOpenAI,
65 InferenceProviderAnthropic,
66 InferenceProviderGemini,
67 InferenceProviderAzure,
68 InferenceProviderBedrock,
69 InferenceProviderVertexAI,
70 InferenceProviderXAI,
71 InferenceProviderOpenRouter,
72 }
73}