running-claude-code-via-litellm-copilot
通過 LiteLLM 代理將 Claude Code 路由至 GitHub Copilot
通過本地 LiteLLM 代理將 Claude Code 請求路由至 GitHub Copilot,以降低 Anthropic API 成本。本技能提供配置代理繞過方案的逐步設置說明。
下載技能 ZIP
在 Claude 中上傳
前往 設定 → 功能 → 技能 → 上傳技能
開啟並開始使用
測試它
正在使用「running-claude-code-via-litellm-copilot」。 I need help creating the LiteLLM config.yaml file
預期結果:
這是使用 claude-opus-4.5 的 GitHub Copilot 最小配置.yaml。在啟動 LiteLLM 之前,將其放在您的工作目錄中。model_name 欄位定義了 Claude Code 將請求的內容。model 欄位使用 github_copilot 提供者前綴。drop_params 設置刪除 Copilot 不理解的 Anthropic 特定欄位。
正在使用「running-claude-code-via-litellm-copilot」。 How do I verify my setup is working correctly?
預期結果:
使用兩個終端:在終端 A 中保持 LiteLLM 運行,然後在終端 B 中啟動 claude。發送一個小請求,如簡單的代碼解釋。觀察終端 A 中的傳入請求日誌,顯示 github_copilot 路由。如果看到請求流經並獲得回應,您的設置就正常工作了。
安全審計
低風險Static analysis flagged 99 patterns but all are false positives. The scanned files are markdown documentation containing code examples and instructions, not executable code. Backticks detected are markdown formatting for code blocks. References to shell commands, PowerShell, URLs, and file paths are instructional content for users to execute manually. No actual cryptographic operations, network calls, or filesystem access code exists. The skill is documentation-only guidance for setting up a LiteLLM proxy between Claude Code and GitHub Copilot.
低風險問題 (1)
風險因素
品質評分
你能建構什麼
注重成本的開發者
開發者希望利用現有的 GitHub Copilot 訂閱來降低直接 Anthropic API 支出,同時保持 Claude Code 工作流程。
DevOps 工程師故障排除
DevOps 工程師需要調試為何 Claude Code 請求無法到達 LiteLLM 代理或從 GitHub Copilot 返回認證錯誤。
技術探索者
技術精通的用戶希望了解代理架構,並設置具有多種 AI 後端選項的靈活本地開發環境。
試試這些提示
我想通過 LiteLLM 設置 Claude Code 與 GitHub Copilot 配合使用。有哪些基本步驟可以開始?
幫助我創建一個使用 claude-opus-4.5 模型的 GitHub Copilot LiteLLM config.yaml 文件。
Claude Code 啟動但 LiteLLM 沒有收到傳入請求。我將 ANTHROPIC_BASE_URL 設置為 http://localhost:4000。我應該檢查什麼?
我的請求到達 GitHub Copilot 但被拒絕。我需要在 LiteLLM 配置中添加自定義標頭(如 editor-version 或 user-agent)嗎?
最佳實務
- 在對 settings.json 進行持久更改之前,先使用臨時環境變數進行測試
- 保持 ANTHROPIC_MODEL 值與 LiteLLM config.yaml 中的 model_name 相同,以確保正確路由
- 在初始設置期間保持 LiteLLM 終端可見,因為日誌提供最快的調試反饋
避免
- 不要替換整個 ~/.claude/settings.json 文件 - 只合併本工作流程所需的 env 鍵
- 不要將 ANTHROPIC_AUTH_TOKEN 視為真正的 Copilot 憑證 - 它是 Claude Code 期望的本地佔位符
- 不要在第一次嘗試時添加自定義標頭覆蓋 - 使用基本提供者流程,僅在特定錯誤表明需要時才添加標頭