v0.10.5

供應商憑證

最後更新


各供應商前綴需要哪些 router.Config 欄位。

router.Config


函式庫本身不讀任何環境變數,憑證一律由呼叫端傳入。
  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 端點
  6. AccountID string // cloudflare
  7. GatewayID string // cloudflare
  8. EnableClaude bool // claude-code
  9. StateDir string // claude-code
  10. }

各供應商需要的欄位


前綴必要欄位備註
claude@APIKey—
claude-code@EnableClaude: true需要 PATH 中已登入的 claude CLI;選填 StateDir 保存 session
openai@APIKey新世代模型自動改走 Responses API
gemini@APIKey前綴達 4096 token 時自動建立 cachedContents
grok@APIKey—
deepseek@APIKey—
mistral@APIKey—
nvidia@APIKey—
ollama-cloud@APIKey—
openrouter@APIKey—
cloudflare@APIKey + AccountID走 AI Gateway;GatewayID 選填,留空時預設 default
compat@ / compat[name]@BaseURLBaseURL 留空時預設 http://localhost:11434/v1;APIKey 選填,留空時不送 Authorization header
copilot@Token(*llmrouter.CopilotToken)另需換取短期 session token
codex@Token(*llmrouter.CodexToken)帶 ChatGPT-Account-Id header
grok-oauth@Token(*llmrouter.GrokToken)—
typesafe@APIKey以 router.NewDecision 建立,不走 router.New;key 由 console.typesafe.ai/keys 取得

相關頁面


EN