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.
type Config struct {
Name string // provider@model
APIKey string
Token any // *llmrouter.CopilotToken / *llmrouter.CodexToken / *llmrouter.GrokToken
BaseURL string // compat endpoint
AccountID string // cloudflare
GatewayID string // cloudflare
}
Required fields per provider
| Prefix | Required | Notes |
|---|---|---|
claude@ |
APIKey |
— |
openai@ |
APIKey |
Newer generations switch to the Responses API automatically |
gemini@ |
APIKey |
Creates cachedContents once a prefix reaches 4096 tokens |
grok@ |
APIKey |
— |
deepseek@ |
APIKey |
— |
mistral@ |
APIKey |
— |
nvidia@ |
APIKey |
— |
ollama-cloud@ |
APIKey |
— |
openrouter@ |
APIKey |
— |
cloudflare@ |
APIKey + AccountID + GatewayID |
Runs through AI Gateway; an empty GatewayID defaults to default |
compat@ / compat[name]@ |
APIKey + BaseURL |
An empty BaseURL defaults to http://localhost:11434/v1 |
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) |
— |
Related
- OAuth Tokens: obtaining
Tokenfor Copilot, Codex, and Grok - Custom Endpoints:
BaseURL,AccountID,GatewayIDexamples