Documentation
¶
Index ¶
- Constants
- Variables
- type Entry
- func Fetch(key string, env map[string]string) ([]Entry, error)
- func FetchAnthropic(env map[string]string) ([]Entry, error)
- func FetchAzure(env map[string]string) ([]Entry, error)
- func FetchBedrock(env map[string]string) ([]Entry, error)
- func FetchCanopyWave(env map[string]string) ([]Entry, error)
- func FetchDeepSeek(env map[string]string) ([]Entry, error)
- func FetchGemini(env map[string]string) ([]Entry, error)
- func FetchGrok(env map[string]string) ([]Entry, error)
- func FetchKimi(env map[string]string) ([]Entry, error)
- func FetchMiniMaxPayg(env map[string]string) ([]Entry, error)
- func FetchMiniMaxTokenPlan(env map[string]string) ([]Entry, error)
- func FetchOllama(env map[string]string) ([]Entry, error)
- func FetchOpenAI(env map[string]string) ([]Entry, error)
- func FetchOpenCodeGo(env map[string]string) ([]Entry, error)
- func FetchOpenRouter(env map[string]string) ([]Entry, error)
- func FetchVertex(env map[string]string) ([]Entry, error)
- func FetchXiaomiPayg(env map[string]string) ([]Entry, error)
- func FetchXiaomiTokenPlan(env map[string]string) ([]Entry, error)
- func FetchZAI(env map[string]string) ([]Entry, error)
- func FetchZAICoding(env map[string]string) ([]Entry, error)
- type FetchFunc
Constants ¶
const ( DefaultOpenRouterBaseURL = "https://openrouter.ai/api/v1" DefaultCanopyWaveBaseURL = "https://inference.canopywave.io/v1" DefaultZAIBaseURL = "https://api.z.ai/api/paas/v4" DefaultZAICodingBaseURL = "https://api.z.ai/api/coding/paas/v4" DefaultOpenAIBaseURL = "https://api.openai.com/v1" DefaultGrokBaseURL = "https://api.x.ai/v1" DefaultOpenCodeGoBaseURL = opencodego.DefaultBaseURL DefaultKimiBaseURL = "https://api.moonshot.ai/v1" DefaultXiaomiBaseURL = "https://api.xiaomimimo.com/v1" DefaultMiniMaxBaseURL = "https://api.minimax.io/v1" )
const DefaultDeepSeekBaseURL = "https://api.deepseek.com/v1"
Variables ¶
var Registry = map[string]FetchFunc{ "anthropic": FetchAnthropic, "openai": FetchOpenAI, "azure": FetchAzure, "gemini": FetchGemini, "bedrock": FetchBedrock, "vertex": FetchVertex, "openrouter": FetchOpenRouter, "grok": FetchGrok, "zai_payg": FetchZAI, "zai_coding": FetchZAICoding, "canopywave": FetchCanopyWave, "opencodego": FetchOpenCodeGo, "kimi": FetchKimi, "xiaomi_mimo_payg": FetchXiaomiPayg, "xiaomi_mimo_token_plan": FetchXiaomiTokenPlan, "minimax_token_plan": FetchMiniMaxTokenPlan, "minimax_payg": FetchMiniMaxPayg, "ollama": FetchOllama, "deepseek": FetchDeepSeek, }
Registry maps fetcher keys to implementations.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
ID string
DisplayName string
Description string
OwnedBy string
ContextWindow int
MaxOutput int
InputPricePer1M float64
OutputPricePer1M float64
// CachedReadPricePer1M is the price per 1M tokens for cached reads (prompt caching).
CachedReadPricePer1M float64
// CachedWritePricePer1M is the price per 1M tokens for cached writes (cache creation).
CachedWritePricePer1M float64
// Tiered pricing: when input tokens exceed TierThreshold, TieredInputPricePer1M applies.
// Same for output. 0 means no tiering.
TierThreshold int `json:"tier_threshold,omitempty"`
TieredInputPricePer1M float64 `json:"tiered_input_price_per_1m,omitempty"`
TieredOutputPricePer1M float64 `json:"tiered_output_price_per_1m,omitempty"`
TieredCachedReadPer1M float64 `json:"tiered_cached_read_per_1m,omitempty"`
TieredCachedWritePer1M float64 `json:"tiered_cached_write_per_1m,omitempty"`
Features []string
// Protocol indicates which API protocol the model uses ("openai" or "anthropic").
// Populated from live API metadata when available; empty means unknown/heuristic.
Protocol string
// RawJSON is the provider's full model object from the list API (preserved verbatim).
RawJSON json.RawMessage
// Capability fields (populated from live API responses that include capabilities).
MaxInputTokens int `json:"max_input_tokens,omitempty"`
ThinkingEnabled bool `json:"thinking_enabled,omitempty"` // model supports thinking with explicit budget
ThinkingAdaptive bool `json:"thinking_adaptive,omitempty"` // model supports adaptive thinking
EffortSupported bool `json:"effort_supported,omitempty"` // model supports effort parameter
EffortLevels string `json:"effort_levels,omitempty"` // comma-separated: "low,medium,high,xhigh,max"
StructuredOutput bool `json:"structured_output,omitempty"` // model supports native JSON schema output
CodeExecution bool `json:"code_execution,omitempty"` // model supports server-side code execution
CitationsSupported bool `json:"citations_supported,omitempty"` // model supports citations
PDFInput bool `json:"pdf_input,omitempty"` // model supports PDF input
ImageInput bool `json:"image_input,omitempty"` // model supports image input
}
Entry is one model row from a live provider list API.
func FetchDeepSeek ¶
FetchDeepSeek lists models from the DeepSeek OpenAI-compatible API.
func FetchGrok ¶
Per-provider fetchers (Grok, ZAI, CanopyWave, OpenCodeGo, Kimi, Xiaomi, MiMo, OpenRouter, Anthropic, Gemini, Ollama, DeepSeek). Split out of fetchers.go for clarity.
func FetchOpenAI ¶
OpenAI/OpenRouter enrichment and cloud-provider (Azure, Bedrock, Vertex, MiniMax) fetchers. Split out of fetchers.go for clarity.
func FetchZAICoding ¶
FetchZAICoding lists models using the GLM Coding Plan dedicated endpoint. It expects ZAI_CODING_API_KEY (and optional ZAI_CODING_BASE_URL) in the env map. This ensures proper quota/billing separation from the general pay-as-you-go path.