v0.10.5

Provider Credentials

Last updated


Which router.Config fields each provider prefix needs.

router.Config


The library reads no environment variables; callers pass every credential in.
  1. type Config struct {
  2. Name string // provider@model
  3. APIKey string
  4. Token any // *llmrouter.CopilotToken / *llmrouter.CodexToken / *llmrouter.GrokToken
  5. BaseURL string // compat endpoint
  6. AccountID string // cloudflare
  7. GatewayID string // cloudflare
  8. EnableClaude bool // claude-code
  9. StateDir string // claude-code
  10. }

Required fields per provider


PrefixRequiredNotes
claude@APIKey—
claude-code@EnableClaude: trueNeeds a logged-in claude CLI on PATH; optional StateDir persists sessions
openai@APIKeyNewer generations switch to the Responses API automatically
gemini@APIKeyCreates cachedContents once a prefix reaches 4096 tokens
grok@APIKey—
deepseek@APIKey—
mistral@APIKey—
nvidia@APIKey—
ollama-cloud@APIKey—
openrouter@APIKey—
cloudflare@APIKey + AccountIDRuns through AI Gateway; optional GatewayID defaults to default
compat@ / compat[name]@BaseURLAn empty BaseURL defaults to http://localhost:11434/v1; APIKey is optional and, when empty, no Authorization header is sent
copilot@Token (*llmrouter.CopilotToken)Additionally exchanges a short-lived session token
codex@Token (*llmrouter.CodexToken)Sends the ChatGPT-Account-Id header
grok-oauth@Token (*llmrouter.GrokToken)—
typesafe@APIKeyBuilt with router.NewDecision, not router.New; keys come from console.typesafe.ai/keys


中文