Documentation
¶
Index ¶
- Constants
- Variables
- func CopilotModelUsesResponsesAPI(m Model) bool
- func DefaultReasoningEffort(model Model) string
- func DeleteSupportedModels(ids ...ModelID)
- func EnrichModelFromModelsDev(ctx context.Context, model *Model)
- func EnrichRegisteredModels(ctx context.Context)
- func GetAllModels() map[ModelID]Model
- func IsCopilotAnthropicModel(apiModel string) bool
- func IsCopilotResponsesAPIModel(apiModel string) bool
- func LoadModelCache() error
- func ModelsDevMetadata(ctx context.Context, provider ModelProvider, apiModel string) (modelsdev.Model, bool)
- func NormalizeReasoningEffort(model Model, value string) string
- func ProviderSupportsModelListing(provider ModelProvider) bool
- func ReasoningEffortsFor(model Model) []string
- func RefreshProviderModels(ctx context.Context, provider ModelProvider, apiKey string, bearerToken string, ...) error
- func RefreshProviderModelsForAccount(ctx context.Context, params AccountModelRefreshParams) error
- func RegisterDynamicModel(model Model)
- func RegisterDynamicModels(batch []Model)
- func ResolveLlamaCppBaseURL(configured string) string
- func ResolveOllamaBaseURL(configured string) string
- func ResolveOllamaRawBaseURL(configured string) string
- func SaveModelCache() error
- func SetSupportedModel(model Model)
- func SetSupportedModels(batch map[ModelID]Model)
- func SupportedModels() map[ModelID]Model
- type AccountModelRefreshParams
- type FetchedModel
- type Model
- type ModelID
- type ModelProvider
Constants ¶
const ( ProviderAnthropic ModelProvider = "anthropic" // Claude 3 family Claude3Haiku ModelID = "anthropic.claude-3-haiku-20240307" Claude3Opus ModelID = "anthropic.claude-3-opus-20240229" Claude35Sonnet ModelID = "anthropic.claude-3-5-sonnet-20241022" Claude35Haiku ModelID = "anthropic.claude-3-5-haiku-20241022" Claude37Sonnet ModelID = "anthropic.claude-3-7-sonnet-20250219" // Claude 4 family Claude4Sonnet ModelID = "anthropic.claude-sonnet-4-20250514" Claude4Opus ModelID = "anthropic.claude-opus-4-20250514" Claude4Opus1 ModelID = "anthropic.claude-opus-4-1-20250805" Claude45Sonnet ModelID = "anthropic.claude-sonnet-4-5-20250929" Claude45Haiku ModelID = "anthropic.claude-haiku-4-5-20251001" Claude45Opus ModelID = "anthropic.claude-opus-4-5-20251101" Claude46Sonnet ModelID = "anthropic.claude-sonnet-4-6" Claude46Opus ModelID = "anthropic.claude-opus-4-6" )
const ( ProviderCopilot ModelProvider = "copilot" // Model IDs match the dynamic format: "copilot.{api-id}" CopilotGTP35Turbo ModelID = "copilot.gpt-3.5-turbo" CopilotGPT4o ModelID = "copilot.gpt-4o" CopilotGPT4oMini ModelID = "copilot.gpt-4o-mini" CopilotGPT41 ModelID = "copilot.gpt-4.1" CopilotClaude35 ModelID = "copilot.claude-3.5-sonnet" CopilotClaude37 ModelID = "copilot.claude-3.7-sonnet" CopilotClaude4 ModelID = "copilot.claude-sonnet-4" CopilotO1 ModelID = "copilot.o1" CopilotO3Mini ModelID = "copilot.o3-mini" CopilotO4Mini ModelID = "copilot.o4-mini" CopilotGemini20 ModelID = "copilot.gemini-2.0-flash" CopilotGemini25 ModelID = "copilot.gemini-2.5-pro" CopilotGPT4 ModelID = "copilot.gpt-4" CopilotClaude37Thought ModelID = "copilot.claude-3.7-sonnet-thought" CopilotGPT54 ModelID = "copilot.gpt-5.4" CopilotClaudeOpus4 ModelID = "copilot.claude-opus-4" CopilotGemini25Flash ModelID = "copilot.gemini-2.5-flash" )
const ( CopilotEndpointChatCompletions = "/chat/completions" CopilotEndpointResponses = "/responses" CopilotEndpointMessages = "/v1/messages" )
Endpoint identifiers as reported by the Copilot /models API in "supported_endpoints".
const ( ProviderAntigravity ModelProvider = "antigravity" ProviderGemini ModelProvider = "gemini" // Gemini 3 preview models (require preview access) Gemini31ProPreview ModelID = "gemini.gemini-3.1-pro-preview-customtools" Gemini31ProPreviewBase ModelID = "gemini.gemini-3.1-pro-preview" Gemini31FlashLitePreview ModelID = "gemini.gemini-3.1-flash-lite-preview" Gemini30ProPreview ModelID = "gemini.gemini-3-pro-preview" Gemini30Flash ModelID = "gemini.gemini-3-flash-preview" // Gemini30Flash legacy alias – config files using "gemini.gemini-3-flash" still resolve. Gemini30FlashLegacy ModelID = "gemini.gemini-3-flash" // Gemini 2.5 stable models Gemini25 ModelID = "gemini.gemini-2.5-pro" Gemini25Flash ModelID = "gemini.gemini-2.5-flash" Gemini25FlashLite ModelID = "gemini.gemini-2.5-flash-lite" // Gemini 2.5 preview aliases – config files using old preview IDs still resolve. Gemini25LegacyPreview ModelID = "gemini.gemini-2.5-pro-preview-05-06" Gemini25FlashLegacyPreview ModelID = "gemini.gemini-2.5-flash-preview-04-17" // Gemini 2.0 stable models Gemini20Flash ModelID = "gemini.gemini-2.0-flash" Gemini20FlashLite ModelID = "gemini.gemini-2.0-flash-lite" )
const ( ProviderGROQ ModelProvider = "groq" // Model IDs match the dynamic format: "groq.{api-id}" QWENQwq ModelID = "groq.qwen-qwq-32b" Llama4Scout ModelID = "groq.meta-llama/llama-4-scout-17b-16e-instruct" Llama4Maverick ModelID = "groq.meta-llama/llama-4-maverick-17b-128e-instruct" Llama3_3_70BVersatile ModelID = "groq.llama-3.3-70b-versatile" DeepseekR1DistillLlama70b ModelID = "groq.deepseek-r1-distill-llama-70b" )
const ( ProviderOllama ModelProvider = "ollama" DefaultOllamaBaseURL = "http://localhost:11434/v1" DefaultOllamaRawURL = "http://localhost:11434" )
const ( ProviderOpenAI ModelProvider = "openai" ProviderOpenAICompatible ModelProvider = "openai-compatible" // Model IDs match the dynamic format: "openai.{api-id}" GPT41 ModelID = "openai.gpt-4.1" GPT41Mini ModelID = "openai.gpt-4.1-mini" GPT41Nano ModelID = "openai.gpt-4.1-nano" GPT45Preview ModelID = "openai.gpt-4.5-preview" GPT4o ModelID = "openai.gpt-4o" GPT4oMini ModelID = "openai.gpt-4o-mini" O1 ModelID = "openai.o1" O1Pro ModelID = "openai.o1-pro" O1Mini ModelID = "openai.o1-mini" O3 ModelID = "openai.o3" O3Mini ModelID = "openai.o3-mini" O4Mini ModelID = "openai.o4-mini" )
const ( ProviderOpenRouter ModelProvider = "openrouter" // Model IDs match the dynamic format: "openrouter.{api-id}" // OpenRouter API returns IDs in "provider/model" format OpenRouterClaude37Sonnet ModelID = "openrouter.anthropic/claude-3.7-sonnet" OpenRouterClaude35Haiku ModelID = "openrouter.anthropic/claude-3.5-haiku" OpenRouterGPT41 ModelID = "openrouter.openai/gpt-4.1" OpenRouterDeepSeekR1Free ModelID = "openrouter.deepseek/deepseek-r1-0528:free" )
const ( ProviderVertexAI ModelProvider = "vertexai" // Models VertexAIGemini25Flash ModelID = "vertexai.gemini-2.5-flash" VertexAIGemini25 ModelID = "vertexai.gemini-2.5" )
const ( ProviderXAI ModelProvider = "xai" // Model IDs match the dynamic format: "xai.{api-id}" XAIGrok3Beta ModelID = "xai.grok-3-beta" XAIGrok3MiniBeta ModelID = "xai.grok-3-mini-beta" XAIGrok3FastBeta ModelID = "xai.grok-3-fast-beta" XAiGrok3MiniFastBeta ModelID = "xai.grok-3-mini-fast-beta" )
Variables ¶
var AnthropicModels = map[ModelID]Model{ Claude3Haiku: { ID: Claude3Haiku, Name: "Claude 3 Haiku", Provider: ProviderAnthropic, APIModel: "claude-3-haiku-20240307", CostPer1MIn: 0.25, CostPer1MInCached: 0.03, CostPer1MOut: 1.25, ContextWindow: 200_000, DefaultMaxTokens: 4_096, SupportsAttachments: true, }, Claude3Opus: { ID: Claude3Opus, Name: "Claude 3 Opus", Provider: ProviderAnthropic, APIModel: "claude-3-opus-20240229", CostPer1MIn: 15.0, CostPer1MInCached: 1.50, CostPer1MOut: 75.0, ContextWindow: 200_000, DefaultMaxTokens: 4_096, SupportsAttachments: true, }, Claude35Sonnet: { ID: Claude35Sonnet, Name: "Claude 3.5 Sonnet", Provider: ProviderAnthropic, APIModel: "claude-3-5-sonnet-20241022", CostPer1MIn: 3.0, CostPer1MInCached: 0.30, CostPer1MOut: 15.0, ContextWindow: 200_000, DefaultMaxTokens: 8_192, SupportsAttachments: true, }, Claude35Haiku: { ID: Claude35Haiku, Name: "Claude 3.5 Haiku", Provider: ProviderAnthropic, APIModel: "claude-3-5-haiku-20241022", CostPer1MIn: 0.80, CostPer1MInCached: 0.08, CostPer1MOut: 4.0, ContextWindow: 200_000, DefaultMaxTokens: 8_192, SupportsAttachments: true, }, Claude37Sonnet: { ID: Claude37Sonnet, Name: "Claude 3.7 Sonnet", Provider: ProviderAnthropic, APIModel: "claude-3-7-sonnet-20250219", CostPer1MIn: 3.0, CostPer1MInCached: 0.30, CostPer1MOut: 15.0, ContextWindow: 200_000, DefaultMaxTokens: 32_000, CanReason: true, SupportsAttachments: true, }, Claude4Sonnet: { ID: Claude4Sonnet, Name: "Claude Sonnet 4", Provider: ProviderAnthropic, APIModel: "claude-sonnet-4-20250514", CostPer1MIn: 3.0, CostPer1MInCached: 0.30, CostPer1MOut: 15.0, ContextWindow: 200_000, DefaultMaxTokens: 32_000, CanReason: true, SupportsAttachments: true, }, Claude4Opus: { ID: Claude4Opus, Name: "Claude Opus 4", Provider: ProviderAnthropic, APIModel: "claude-opus-4-20250514", CostPer1MIn: 15.0, CostPer1MInCached: 1.50, CostPer1MOut: 75.0, ContextWindow: 200_000, DefaultMaxTokens: 32_000, CanReason: true, SupportsAttachments: true, }, Claude4Opus1: { ID: Claude4Opus1, Name: "Claude Opus 4.1", Provider: ProviderAnthropic, APIModel: "claude-opus-4-1-20250805", CostPer1MIn: 15.0, CostPer1MInCached: 1.50, CostPer1MOut: 75.0, ContextWindow: 200_000, DefaultMaxTokens: 32_000, CanReason: true, SupportsAttachments: true, }, Claude45Sonnet: { ID: Claude45Sonnet, Name: "Claude Sonnet 4.5", Provider: ProviderAnthropic, APIModel: "claude-sonnet-4-5-20250929", CostPer1MIn: 3.0, CostPer1MInCached: 0.30, CostPer1MOut: 15.0, ContextWindow: 200_000, DefaultMaxTokens: 32_000, CanReason: true, SupportsAttachments: true, }, Claude45Haiku: { ID: Claude45Haiku, Name: "Claude Haiku 4.5", Provider: ProviderAnthropic, APIModel: "claude-haiku-4-5-20251001", CostPer1MIn: 0.80, CostPer1MInCached: 0.08, CostPer1MOut: 4.0, ContextWindow: 200_000, DefaultMaxTokens: 32_000, SupportsAttachments: true, }, Claude45Opus: { ID: Claude45Opus, Name: "Claude Opus 4.5", Provider: ProviderAnthropic, APIModel: "claude-opus-4-5-20251101", CostPer1MIn: 15.0, CostPer1MInCached: 1.50, CostPer1MOut: 75.0, ContextWindow: 200_000, DefaultMaxTokens: 32_000, CanReason: true, SupportsAttachments: true, }, Claude46Sonnet: { ID: Claude46Sonnet, Name: "Claude Sonnet 4.6", Provider: ProviderAnthropic, APIModel: "claude-sonnet-4-6", CostPer1MIn: 3.0, CostPer1MInCached: 0.30, CostPer1MOut: 15.0, ContextWindow: 200_000, DefaultMaxTokens: 32_000, CanReason: true, SupportsAttachments: true, }, Claude46Opus: { ID: Claude46Opus, Name: "Claude Opus 4.6", Provider: ProviderAnthropic, APIModel: "claude-opus-4-6", CostPer1MIn: 15.0, CostPer1MInCached: 1.50, CostPer1MOut: 75.0, ContextWindow: 200_000, DefaultMaxTokens: 32_000, CanReason: true, SupportsAttachments: true, }, }
AnthropicModels lists all supported Anthropic models with their full capabilities. Capabilities are sourced from the Claude Code CLI source (oa() and uM() functions). Context window: 200 000 tokens for all current models. Max output tokens by family (default / upper limit from oa()):
- Claude 3 Haiku: 4 096 / 4 096
- Claude 3 Opus: 4 096 / 4 096
- Claude 3.5 Sonnet / 3.5 Haiku: 8 192 / 8 192
- Claude 3.7 Sonnet: 32 000 / 64 000
- Claude 4 Sonnet / Haiku / Opus (all 4.x): 32 000 / 64 000
var AntigravityModels = map[ModelID]Model{ AntigravityGemini30Pro: { ID: AntigravityGemini30Pro, Name: "Gemini 3 Pro", Provider: ProviderAntigravity, APIModel: "gemini-3-pro-preview", ContextWindow: 1_000_000, DefaultMaxTokens: 8_192, CanReason: true, SupportsAttachments: true, }, AntigravityGemini31Pro: { ID: AntigravityGemini31Pro, Name: "Gemini 3.1 Pro", Provider: ProviderAntigravity, APIModel: "gemini-3.1-pro-preview-customtools", ContextWindow: 1_000_000, DefaultMaxTokens: 8_192, CanReason: true, SupportsAttachments: true, }, AntigravityGemini30Flash: { ID: AntigravityGemini30Flash, Name: "Gemini 3 Flash", Provider: ProviderAntigravity, APIModel: "gemini-3-flash-preview", ContextWindow: 1_000_000, DefaultMaxTokens: 8_192, SupportsAttachments: true, }, }
var AzureModels = map[ModelID]Model{ AzureGPT41: { ID: AzureGPT41, Name: "Azure OpenAI – GPT 4.1", Provider: ProviderAzure, APIModel: "gpt-4.1", CostPer1MIn: 2.00, CostPer1MInCached: 0.50, CostPer1MOut: 8.00, CostPer1MOutCached: 0.0, ContextWindow: 1_047_576, DefaultMaxTokens: 20000, SupportsAttachments: true, }, AzureGPT41Mini: { ID: AzureGPT41Mini, Name: "Azure OpenAI – GPT 4.1 mini", Provider: ProviderAzure, APIModel: "gpt-4.1-mini", CostPer1MIn: 0.40, CostPer1MInCached: 0.10, CostPer1MOut: 1.60, CostPer1MOutCached: 0.0, ContextWindow: 200_000, DefaultMaxTokens: 20000, SupportsAttachments: true, }, AzureGPT41Nano: { ID: AzureGPT41Nano, Name: "Azure OpenAI – GPT 4.1 nano", Provider: ProviderAzure, APIModel: "gpt-4.1-nano", CostPer1MIn: 0.10, CostPer1MInCached: 0.025, CostPer1MOut: 0.40, CostPer1MOutCached: 0.0, ContextWindow: 1_047_576, DefaultMaxTokens: 20000, SupportsAttachments: true, }, AzureGPT45Preview: { ID: AzureGPT45Preview, Name: "Azure OpenAI – GPT 4.5 preview", Provider: ProviderAzure, APIModel: "gpt-4.5-preview", CostPer1MIn: 75.00, CostPer1MInCached: 37.50, CostPer1MOut: 150.00, CostPer1MOutCached: 0.0, ContextWindow: 128_000, DefaultMaxTokens: 15000, SupportsAttachments: true, }, AzureGPT4o: { ID: AzureGPT4o, Name: "Azure OpenAI – GPT-4o", Provider: ProviderAzure, APIModel: "gpt-4o", CostPer1MIn: 2.50, CostPer1MInCached: 1.25, CostPer1MOut: 10.00, CostPer1MOutCached: 0.0, ContextWindow: 128_000, DefaultMaxTokens: 4096, SupportsAttachments: true, }, AzureGPT4oMini: { ID: AzureGPT4oMini, Name: "Azure OpenAI – GPT-4o mini", Provider: ProviderAzure, APIModel: "gpt-4o-mini", CostPer1MIn: 0.15, CostPer1MInCached: 0.075, CostPer1MOut: 0.60, CostPer1MOutCached: 0.0, ContextWindow: 128_000, SupportsAttachments: true, }, AzureO1: { ID: AzureO1, Name: "Azure OpenAI – O1", Provider: ProviderAzure, APIModel: "o1", CostPer1MIn: 15.00, CostPer1MInCached: 7.50, CostPer1MOut: 60.00, CostPer1MOutCached: 0.0, ContextWindow: 200_000, DefaultMaxTokens: 50000, CanReason: true, SupportsAttachments: true, }, AzureO1Mini: { ID: AzureO1Mini, Name: "Azure OpenAI – O1 mini", Provider: ProviderAzure, APIModel: "o1-mini", CostPer1MIn: 1.10, CostPer1MInCached: 0.55, CostPer1MOut: 4.40, CostPer1MOutCached: 0.0, ContextWindow: 128_000, DefaultMaxTokens: 50000, CanReason: true, SupportsAttachments: true, }, AzureO3: { ID: AzureO3, Name: "Azure OpenAI – O3", Provider: ProviderAzure, APIModel: "o3", CostPer1MIn: 10.00, CostPer1MInCached: 2.50, CostPer1MOut: 40.00, CostPer1MOutCached: 0.0, ContextWindow: 200_000, CanReason: true, SupportsAttachments: true, }, AzureO3Mini: { ID: AzureO3Mini, Name: "Azure OpenAI – O3 mini", Provider: ProviderAzure, APIModel: "o3-mini", CostPer1MIn: 1.10, CostPer1MInCached: 0.55, CostPer1MOut: 4.40, CostPer1MOutCached: 0.0, ContextWindow: 200_000, DefaultMaxTokens: 50000, CanReason: true, SupportsAttachments: false, }, AzureO4Mini: { ID: AzureO4Mini, Name: "Azure OpenAI – O4 mini", Provider: ProviderAzure, APIModel: "o4-mini", CostPer1MIn: 1.10, CostPer1MInCached: 0.275, CostPer1MOut: 4.40, CostPer1MOutCached: 0.0, ContextWindow: 128_000, DefaultMaxTokens: 50000, CanReason: true, SupportsAttachments: true, }, }
var GeminiModels = map[ModelID]Model{ Gemini31ProPreview: { ID: Gemini31ProPreview, Name: "Gemini 3.1 Pro Preview (Custom Tools)", Provider: ProviderGemini, APIModel: "gemini-3.1-pro-preview-customtools", ContextWindow: 1_000_000, DefaultMaxTokens: 8_192, CanReason: true, SupportsAttachments: true, }, Gemini31ProPreviewBase: { ID: Gemini31ProPreviewBase, Name: "Gemini 3.1 Pro Preview", Provider: ProviderGemini, APIModel: "gemini-3.1-pro-preview", ContextWindow: 1_000_000, DefaultMaxTokens: 8_192, CanReason: true, SupportsAttachments: true, }, Gemini31FlashLitePreview: { ID: Gemini31FlashLitePreview, Name: "Gemini 3.1 Flash Lite Preview", Provider: ProviderGemini, APIModel: "gemini-3.1-flash-lite-preview", ContextWindow: 1_000_000, DefaultMaxTokens: 8_192, CanReason: true, SupportsAttachments: true, }, Gemini30ProPreview: { ID: Gemini30ProPreview, Name: "Gemini 3 Pro Preview", Provider: ProviderGemini, APIModel: "gemini-3-pro-preview", ContextWindow: 1_000_000, DefaultMaxTokens: 8_192, CanReason: true, SupportsAttachments: true, }, Gemini30Flash: { ID: Gemini30Flash, Name: "Gemini 3 Flash Preview", Provider: ProviderGemini, APIModel: "gemini-3-flash-preview", ContextWindow: 1_000_000, DefaultMaxTokens: 8_192, CanReason: true, SupportsAttachments: true, }, Gemini30FlashLegacy: { ID: Gemini30FlashLegacy, Name: "Gemini 3 Flash Preview", Provider: ProviderGemini, APIModel: "gemini-3-flash-preview", ContextWindow: 1_000_000, DefaultMaxTokens: 8_192, CanReason: true, SupportsAttachments: true, }, Gemini25: { ID: Gemini25, Name: "Gemini 2.5 Pro", Provider: ProviderGemini, APIModel: "gemini-2.5-pro", ContextWindow: 1_000_000, DefaultMaxTokens: 8_192, CanReason: true, SupportsAttachments: true, }, Gemini25Flash: { ID: Gemini25Flash, Name: "Gemini 2.5 Flash", Provider: ProviderGemini, APIModel: "gemini-2.5-flash", ContextWindow: 1_000_000, DefaultMaxTokens: 8_192, CanReason: true, SupportsAttachments: true, }, Gemini25FlashLite: { ID: Gemini25FlashLite, Name: "Gemini 2.5 Flash Lite", Provider: ProviderGemini, APIModel: "gemini-2.5-flash-lite", ContextWindow: 1_000_000, DefaultMaxTokens: 8_192, SupportsAttachments: true, }, Gemini25LegacyPreview: { ID: Gemini25LegacyPreview, Name: "Gemini 2.5 Pro", Provider: ProviderGemini, APIModel: "gemini-2.5-pro", ContextWindow: 1_000_000, DefaultMaxTokens: 8_192, CanReason: true, SupportsAttachments: true, }, Gemini25FlashLegacyPreview: { ID: Gemini25FlashLegacyPreview, Name: "Gemini 2.5 Flash", Provider: ProviderGemini, APIModel: "gemini-2.5-flash", ContextWindow: 1_000_000, DefaultMaxTokens: 8_192, CanReason: true, SupportsAttachments: true, }, Gemini20Flash: { ID: Gemini20Flash, Name: "Gemini 2.0 Flash", Provider: ProviderGemini, APIModel: "gemini-2.0-flash", ContextWindow: 1_000_000, DefaultMaxTokens: 8_192, SupportsAttachments: true, }, Gemini20FlashLite: { ID: Gemini20FlashLite, Name: "Gemini 2.0 Flash Lite", Provider: ProviderGemini, APIModel: "gemini-2.0-flash-lite", ContextWindow: 1_000_000, DefaultMaxTokens: 8_192, SupportsAttachments: true, }, }
var ProviderPopularity = map[ModelProvider]int{ ProviderCopilot: 1, ProviderAnthropic: 2, ProviderOpenAI: 3, ProviderAntigravity: 4, ProviderOllama: 5, ProviderLlamaCpp: 6, ProviderGemini: 7, ProviderGROQ: 8, ProviderOpenRouter: 9, ProviderBedrock: 10, ProviderAzure: 11, ProviderVertexAI: 12, ProviderOpenAICompatible: 13, }
Providers in order of popularity
var VertexAIGeminiModels = map[ModelID]Model{ VertexAIGemini25Flash: { ID: VertexAIGemini25Flash, Name: "VertexAI: Gemini 2.5 Flash", Provider: ProviderVertexAI, APIModel: "gemini-2.5-flash-preview-04-17", CostPer1MIn: 0.15, CostPer1MInCached: 0, CostPer1MOut: 0.60, CostPer1MOutCached: 0, ContextWindow: 1000000, DefaultMaxTokens: 50000, SupportsAttachments: true, }, VertexAIGemini25: { ID: VertexAIGemini25, Name: "VertexAI: Gemini 2.5 Pro", Provider: ProviderVertexAI, APIModel: "gemini-2.5-pro-preview-03-25", CostPer1MIn: 1.25, CostPer1MInCached: 0, CostPer1MOut: 10, CostPer1MOutCached: 0, ContextWindow: 1000000, DefaultMaxTokens: 50000, SupportsAttachments: true, }, }
Functions ¶
func CopilotModelUsesResponsesAPI ¶ added in v0.624.3
CopilotModelUsesResponsesAPI reports whether a model must be driven through the OpenAI Responses API (/responses) instead of Chat Completions.
The Copilot /models API advertises the routes each model accepts, and that metadata is authoritative: models such as "mai-code-1-flash-picker" or "gpt-5.6-luna" only accept /responses while carrying names that no gpt-version heuristic can classify. This mirrors how the official VS Code extension routes requests (see chatEndpoint.ts, useResponsesApi).
When a model advertises both routes we keep the historical name-based decision, so models like gpt-5-mini keep working over Chat Completions. Models with no advertised endpoints (static catalogue entries, older API responses) fall back to the name heuristic entirely.
func DefaultReasoningEffort ¶ added in v0.646.4
DefaultReasoningEffort returns a reasoning-effort value that is always valid for the model: "medium" when acceptable, else "high" (the most common safe strong default), else the weakest value the model supports. It never returns a value absent from the model's allowed set; for a model with no known set it falls back to "medium" to preserve prior behaviour.
func DeleteSupportedModels ¶ added in v0.644.0
func DeleteSupportedModels(ids ...ModelID)
DeleteSupportedModels removes models from the catalogue.
func EnrichModelFromModelsDev ¶ added in v0.629.0
EnrichModelFromModelsDev fills in metadata the provider's own listing API did not report — most importantly per-token costs, which almost no provider returns and without which the session cost panel stays empty.
It only ever writes fields that are currently zero/empty: whatever the provider (or Pando's curated catalog) already stated stays authoritative, so a stale or wrong catalog entry can never downgrade known-good metadata. Boolean capability flags are only raised, never cleared, for the same reason.
func EnrichRegisteredModels ¶ added in v0.629.0
EnrichRegisteredModels tops up every model already in the registry with the catalog data it is missing. Curated static entries (Antigravity, Bedrock, Vertex AI, …) are hand-written without prices, so without this pass they would keep reporting a zero session cost even though the catalog knows their rates.
Safe to call repeatedly; it is a no-op when the catalog is unavailable.
func GetAllModels ¶ added in v0.2.0
GetAllModels returns both static and dynamic models
func IsCopilotAnthropicModel ¶ added in v0.3.0
IsCopilotAnthropicModel returns true if the given API model name is an Anthropic model served through the GitHub Copilot API (detected by name containing "claude").
func IsCopilotResponsesAPIModel ¶ added in v0.100.0
IsCopilotResponsesAPIModel reports whether a model requires the Responses API based on its name alone. It is the fallback used by CopilotModelUsesResponsesAPI when the provider does not advertise the model's supported endpoints; prefer that function whenever a full Model is available. GPT-5+ models (except gpt-5-mini variants) require the Responses API.
func LoadModelCache ¶ added in v0.3.0
func LoadModelCache() error
LoadModelCache loads previously cached dynamic models into SupportedModels(). Cached models do not overwrite static entries (Azure, VertexAI, Bedrock).
func ModelsDevMetadata ¶ added in v0.629.0
func ModelsDevMetadata(ctx context.Context, provider ModelProvider, apiModel string) (modelsdev.Model, bool)
ModelsDevMetadata returns the models.dev entry describing a provider/model pair. ok is false whenever the catalog is unavailable or the model is unknown, which every caller must treat as "keep what you already have".
func NormalizeReasoningEffort ¶ added in v0.646.4
NormalizeReasoningEffort returns the canonical form of value when it is one of the model's accepted reasoning efforts, or "" otherwise. Passing an empty value also returns "" (callers distinguish "unset" from "invalid").
func ProviderSupportsModelListing ¶ added in v0.503.5
func ProviderSupportsModelListing(provider ModelProvider) bool
ProviderSupportsModelListing reports whether a provider exposes a model-listing API that FetchModelsFromProvider can query. Providers that return false (e.g. Azure, Vertex AI, Bedrock) rely on a curated static catalog instead, and must register per-account model copies separately to support multiple accounts.
func ReasoningEffortsFor ¶ added in v0.646.4
ReasoningEffortsFor returns the ordered reasoning-effort values a model accepts. A non-empty list on Model.ReasoningEfforts (from the models.dev catalog) is authoritative; otherwise a per-provider/family fallback table is consulted. It returns nil when the model's effort set is unknown.
func RefreshProviderModels ¶ added in v0.2.0
func RefreshProviderModels(ctx context.Context, provider ModelProvider, apiKey string, bearerToken string, baseURL string) error
RefreshProviderModels fetches and registers models from a provider. Models previously registered for this provider that are no longer returned by the API are removed from the registry and cache.
func RefreshProviderModelsForAccount ¶ added in v0.252.0
func RefreshProviderModelsForAccount(ctx context.Context, params AccountModelRefreshParams) error
RefreshProviderModelsForAccount fetches and registers models for a named provider account. Model IDs are prefixed with accountID when AllAccountsOfType > 1 (disambiguates multiple accounts of same type). Models previously registered for this account that are no longer returned by the API are removed.
func RegisterDynamicModel ¶ added in v0.2.0
func RegisterDynamicModel(model Model)
RegisterDynamicModel adds a dynamically discovered model.
func RegisterDynamicModels ¶ added in v0.644.0
func RegisterDynamicModels(batch []Model)
RegisterDynamicModels adds a batch of dynamically discovered models with a single catalogue update, avoiding one copy-on-write per model.
func ResolveLlamaCppBaseURL ¶ added in v0.291.0
ResolveLlamaCppBaseURL returns the llama-server base URL, consulting the LLAMACPP_BASE_URL environment variable as a fallback before using the built-in default (http://localhost:8080/v1).
func ResolveOllamaBaseURL ¶ added in v0.2.0
func ResolveOllamaRawBaseURL ¶ added in v0.2.0
ResolveOllamaRawBaseURL returns the raw Ollama base URL without the /v1 suffix, suitable for calling native Ollama endpoints like /api/tags.
func SaveModelCache ¶ added in v0.3.0
func SaveModelCache() error
SaveModelCache saves dynamically discovered models to a local cache file. This allows models to be available immediately on the next startup.
func SetSupportedModel ¶ added in v0.644.0
func SetSupportedModel(model Model)
SetSupportedModel adds or replaces a single model in the catalogue.
func SetSupportedModels ¶ added in v0.644.0
SetSupportedModels adds or replaces several models in a single update, which is what callers registering a batch should use: the catalogue is copy-on-write and a per-model write would copy it once per entry.
func SupportedModels ¶
SupportedModels returns the current model catalogue. The returned map is shared and MUST NOT be modified; use the registration helpers instead.
Types ¶
type AccountModelRefreshParams ¶ added in v0.252.0
type AccountModelRefreshParams struct {
AccountID string
ProviderType ModelProvider
APIKey string
BearerToken string
BaseURL string
ExtraHeaders map[string]string
// AllAccountsOfType is the count of non-disabled accounts sharing ProviderType,
// used to decide whether to prefix the model ID with AccountID.
AllAccountsOfType int
}
AccountModelRefreshParams holds the parameters needed to refresh models for a named account.
type FetchedModel ¶ added in v0.2.0
type FetchedModel struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Created int64 `json:"created,omitempty"`
ContextWindow int64 `json:"context_window,omitempty"`
MaxOutputTokens int64 `json:"max_output_tokens,omitempty"`
// SupportedEndpoints lists the API routes the provider accepts for this
// model (e.g. "/responses", "/chat/completions"). Empty when the provider's
// listing API does not report it, in which case callers fall back to
// name-based heuristics.
SupportedEndpoints []string `json:"supported_endpoints,omitempty"`
CanReason bool `json:"can_reason,omitempty"`
SupportsReasoningEffort bool `json:"supports_reasoning_effort,omitempty"`
SupportsAttachments bool `json:"supports_attachments,omitempty"`
}
FetchedModel represents a model returned by a provider's API
func FetchModelsFromProvider ¶ added in v0.2.0
func FetchModelsFromProvider(ctx context.Context, provider ModelProvider, apiKey string, bearerToken string, baseURL string) ([]FetchedModel, error)
FetchModelsFromProvider queries a provider's API for available models
type Model ¶
type Model struct {
ID ModelID `json:"id"`
Name string `json:"name"`
Provider ModelProvider `json:"provider"`
APIModel string `json:"api_model"`
CostPer1MIn float64 `json:"cost_per_1m_in"`
CostPer1MOut float64 `json:"cost_per_1m_out"`
CostPer1MInCached float64 `json:"cost_per_1m_in_cached"`
CostPer1MOutCached float64 `json:"cost_per_1m_out_cached"`
ContextWindow int64 `json:"context_window"`
DefaultMaxTokens int64 `json:"default_max_tokens"`
CanReason bool `json:"can_reason"`
SupportsReasoningEffort bool `json:"supports_reasoning_effort"`
// ReasoningEfforts lists the ordered reasoning-effort values (weakest to
// strongest) the model accepts for its effort-style control, e.g. OpenAI
// "reasoning_effort" or Anthropic adaptive "thinking" budget. It comes from
// the models.dev catalog (ReasoningOptions) when available. Empty means
// "unknown", and the resolver falls back to a per-family table.
ReasoningEfforts []string `json:"reasoning_efforts,omitempty"`
SupportsAttachments bool `json:"supports_attachments"`
// SupportedEndpoints lists the API routes the provider accepts for this
// model, as reported by its model-listing API (e.g. "/responses",
// "/chat/completions"). Empty for statically-defined models and for
// providers that do not report it.
SupportedEndpoints []string `json:"supported_endpoints,omitempty"`
// AccountID is the ProviderAccount.ID that this model belongs to.
// Empty means the model comes from the legacy single-account system.
AccountID string `json:"account_id,omitempty"`
// Description, Knowledge (training cutoff, e.g. "2026-01") and ReleaseDate
// are descriptive fields shown in the model selectors. They are usually
// absent from provider listing APIs and come from the models.dev catalog.
Description string `json:"description,omitempty"`
Knowledge string `json:"knowledge,omitempty"`
ReleaseDate string `json:"release_date,omitempty"`
// ImageMaxLongSidePx is the model's vision long-side pixel limit. Images
// larger than this are rescaled by the provider before encoding, so Pando
// resizes to this value locally to save bandwidth. 0 means "unknown": use
// ImageLongSideLimit() which falls back to a per-family default.
ImageMaxLongSidePx int `json:"image_max_long_side_px,omitempty"`
}
func AccountScopedStaticModels ¶ added in v0.503.5
func AccountScopedStaticModels(provider ModelProvider, accountID string, allAccountsOfType int) []Model
AccountScopedStaticModels returns per-account copies of a provider's static models, with account-prefixed IDs and AccountID set. It returns nothing when fewer than two accounts of the type exist: with a single account the prefix equals the provider type, so the prefixed ID would collide with the static one and the account-less static models (which already resolve to that single account) are used as-is. Used both to register the models (RefreshProviderModels- ForAccount) and to list them (the /api/v1/models handler) for providers that have no model-listing API.
func StaticModelsForProvider ¶ added in v0.503.5
func StaticModelsForProvider(provider ModelProvider) []Model
StaticModelsForProvider returns copies of every statically-defined (account-less) model for a provider type (exported for listing handlers).
func (Model) DisplayLabel ¶ added in v0.252.0
DisplayLabel returns the display label for a model. sameTypeAccountCount is how many non-disabled accounts share this model's provider type. If > 1, the account ID is prefixed to disambiguate.
func (Model) ImageLongSideLimit ¶ added in v0.629.4
ImageLongSideLimit returns the long-side pixel cap to resize images to before sending them to this model. Prefers the explicit ImageMaxLongSidePx (e.g. from the models.dev catalog), otherwise infers a per-family default.
type ModelID ¶
type ModelID string
const ( AzureGPT41 ModelID = "azure.gpt-4.1" AzureGPT41Mini ModelID = "azure.gpt-4.1-mini" AzureGPT41Nano ModelID = "azure.gpt-4.1-nano" AzureGPT45Preview ModelID = "azure.gpt-4.5-preview" AzureGPT4o ModelID = "azure.gpt-4o" AzureGPT4oMini ModelID = "azure.gpt-4o-mini" AzureO1 ModelID = "azure.o1" AzureO1Mini ModelID = "azure.o1-mini" AzureO3 ModelID = "azure.o3" AzureO3Mini ModelID = "azure.o3-mini" AzureO4Mini ModelID = "azure.o4-mini" )
const ( // Bedrock BedrockClaude37Sonnet ModelID = "bedrock.claude-3.7-sonnet" )
Model IDs
func CanonicalAccountModelID ¶ added in v0.503.5
func CanonicalAccountModelID(providerType ModelProvider, accountID string, allAccountsOfType int, apiModelID string) ModelID
CanonicalAccountModelID returns the registry model ID for a model fetched from a provider account, matching exactly the IDs produced by RefreshProviderModelsForAccount (i.e. "<prefix>.<apiModelID>"). Callers that list models for selection must use this so the IDs they expose are the same ones the rest of the system (model cache, agent validation, TUI) recognises. Using a bare, non-prefixed ID causes validateAgent to reject the saved agent model on the next config reload and silently revert it to a provider default.
func NormalizeModelID ¶ added in v0.210.0
func ResolveModelID ¶ added in v0.503.5
ResolveModelID maps a possibly non-canonical model ID to a registered model ID. It returns (id, true) when the input is already registered, or when exactly one registered model matches it by APIModel or by a "<provider>.<input>" suffix. Otherwise it returns (input, false). This lets callers repair legacy/bare model IDs (e.g. "gpt-5.4-mini") to their canonical form ("copilot.gpt-5.4-mini") instead of discarding the user's selection.
type ModelProvider ¶
type ModelProvider string
const ( ProviderLlamaCpp ModelProvider = "llama-cpp" DefaultLlamaCppBaseURL = "http://localhost:8080/v1" )
const ( ProviderBedrock ModelProvider = "bedrock" // ForTests ProviderMock ModelProvider = "__mock" )
const ProviderAzure ModelProvider = "azure"
const (
ProviderLocal ModelProvider = "local"
)
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package modelsdev provides read-only access to the models.dev catalog (https://github.com/anomalyco/models.dev), a community-maintained database of model pricing and capabilities per provider.
|
Package modelsdev provides read-only access to the models.dev catalog (https://github.com/anomalyco/models.dev), a community-maintained database of model pricing and capabilities per provider. |