running-claude-code-via-litellm-copilot

Route Claude Code requests through a local LiteLLM proxy to GitHub Copilot.

71|7|Updated Mar 27, 2026
One-click install
npx skills add https://github.com/xixu-me/skills --skill running-claude-code-via-litellm-copilot
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: running-claude-code-via-litellm-copilot
Source: https://github.com/xixu-me/skills/tree/main/skills/running-claude-code-via-litellm-copilot
Command: npx skills add https://github.com/xixu-me/skills --skill running-claude-code-via-litellm-copilot

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill guides engineers through routing Claude Code traffic via a local LiteLLM proxy to the GitHub Copilot Chat API, reducing direct Anthropic spend and preserving the Claude Code client behavior while forwarding requests to Copilot. It helps users create the necessary LiteLLM model mappings, set temporary or persistent environment keys, and verify the request chain end-to-end.

Core Features & Use Cases

  • Local Proxy Configuration: Create a LiteLLM config.yaml that maps a Claude-facing model_name to a github_copilot/<model> provider and uses drop_params to strip Anthropic-specific fields.
  • Temporary and Persistent Setup: Provide shell-appropriate temporary environment exports for quick tests and safe merge rules for updating ~/.claude/settings.json when persistence is requested.
  • Verification & Troubleshooting: Walk through running litellm, initiating device authorization, confirming logs show inbound requests, and diagnosing model-not-found, no-localhost-traffic, and GitHub 401/403 errors in realistic scenarios.

Quick Start

Provide a minimal LiteLLM config.yaml that maps a logical model_name to github_copilot/<model>, the single command to start litellm on port 4000, and the one-line temporary environment exports needed to point Claude Code at http://localhost:4000.

Frequently Asked Questions about running-claude-code-via-litellm-copilot

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I route Claude Code requests through a local LiteLLM proxy to GitHub Copilot?

To route Claude Code to GitHub Copilot, configure a LiteLLM config.yaml mapping a logical model_name to the github_copilot provider, start litellm on port 4000, and set ANTHROPIC_BASE_URL to http://localhost:4000 to redirect traffic and reduce direct API spend.

Why does LiteLLM show a model-not-found error when proxying Claude Code?

A model-not-found error occurs when the LiteLLM config.yaml model_name does not exactly match the ANTHROPIC_MODEL environment variable. Ensure both values are identical so the proxy can correctly map the Claude Code request to the github_copilot provider.

How do I fix GitHub 401 or 403 authorization errors with LiteLLM proxy?

GitHub 401 or 403 errors indicate failed device authorization. Initiate the GitHub Copilot device authorization flow through LiteLLM, confirm the authentication tokens are valid, and ensure your GitHub account has active Copilot access before retrying.

Can I use Claude Code with GitHub Copilot locally to avoid Anthropic API costs?

Yes, you can use Claude Code with GitHub Copilot locally by running a LiteLLM proxy. This setup forwards Claude Code requests to the Copilot Chat API, using drop_params to strip Anthropic-specific fields, effectively reducing direct Anthropic spend.

Why is LiteLLM not receiving localhost traffic from Claude Code?

If LiteLLM shows no inbound localhost traffic, verify the ANTHROPIC_BASE_URL environment variable points to http://localhost:4000. Also check temporary environment exports or merged settings in ~/.claude/settings.json to ensure Claude Code targets the proxy correctly.

Do I need to update ~/.claude/settings.json for persistent LiteLLM proxy configuration?

For persistent LiteLLM proxy configuration, merge specific environment keys into ~/.claude/settings.json. For quick tests, use temporary shell environment exports, but persistent setup requires safely updating the settings file to retain the proxy routing.