$npx -y skills add xixu-me/skills --skill running-claude-code-via-litellm-copilotUse when routing Claude Code through a local LiteLLM proxy to GitHub Copilot, reducing direct Anthropic spend, configuring ANTHROPIC_BASE_URL or ANTHROPIC_MODEL overrides, or troubleshooting Copilot proxy setup failures such as model-not-found, no localhost traffic, or GitHub 401
| 1 | ## Overview |
| 2 | |
| 3 | Use this skill for the specific workaround where Claude Code keeps its Anthropic-shaped client behavior, but the actual backend traffic is sent to a local LiteLLM proxy and then forwarded to GitHub Copilot. |
| 4 | |
| 5 | Treat this as an advanced workaround, not an officially guaranteed GitHub workflow. Help the user succeed technically, but do not promise GitHub support, policy approval, or long-term compatibility. |
| 6 | |
| 7 | This skill is guidance-first but execution-aware: |
| 8 | |
| 9 | - If the user wants explanation only, provide the smallest correct set of files, commands, and checks. |
| 10 | - If the user wants real setup work on the current machine, inspect first and adapt commands to the active shell and OS. |
| 11 | - Pause before persistent edits such as `~/.claude/settings.json` or shell profile files. |
| 12 | |
| 13 | Read [`references/doc-verified-notes.md`](./references/doc-verified-notes.md) before answering if you need to justify which parts come from the article and which parts were tightened against current LiteLLM docs. |
| 14 | |
| 15 | ## When To Use |
| 16 | |
| 17 | Use this skill when the user wants any of the following: |
| 18 | |
| 19 | - Claude Code to run against GitHub Copilot through LiteLLM |
| 20 | - lower direct Anthropic API spending while keeping the Claude Code workflow |
| 21 | - a local `config.yaml` for LiteLLM's GitHub Copilot provider |
| 22 | - `ANTHROPIC_BASE_URL`, `ANTHROPIC_MODEL`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` setup |
| 23 | - help understanding GitHub device authorization during LiteLLM startup |
| 24 | - help with model mismatch, 404-like errors, no requests reaching LiteLLM, or GitHub 401/403 failures |
| 25 | |
| 26 | Do not use this skill for: |
| 27 | |
| 28 | - deciding whether the workaround is allowed by GitHub terms |
| 29 | - general LiteLLM architecture unrelated to Claude Code plus Copilot |
| 30 | - direct Anthropic API setup with no Copilot or LiteLLM component |
| 31 | |
| 32 | ## Core Rules |
| 33 | |
| 34 | 1. Lead with a short compliance caveat. |
| 35 | Explain that this is a workaround based on a local proxy path, not a GitHub-promoted workflow, and the user must evaluate the latest Copilot terms and limits for themselves. |
| 36 | 2. Prefer the minimum viable path first. |
| 37 | Start with temporary environment variables and a local `config.yaml` unless the user explicitly wants a persistent setup. |
| 38 | 3. Keep `ANTHROPIC_MODEL` and LiteLLM `model_name` identical. |
| 39 | Exact string match matters more than clever explanation. |
| 40 | 4. Treat `ANTHROPIC_AUTH_TOKEN` as a local placeholder. |
| 41 | Claude Code expects a non-empty value locally, but it is not the GitHub Copilot credential and should not be presented as a reusable secret. |
| 42 | 5. Never overwrite `~/.claude/settings.json` wholesale. |
| 43 | Merge only the needed `env` keys and preserve unrelated settings. |
| 44 | |
| 45 | ## Workflow |
| 46 | |
| 47 | ### 1. Preflight |
| 48 | |
| 49 | Check these first when the user wants real setup work: |
| 50 | |
| 51 | - `claude --help` succeeds |
| 52 | - `uv --version` or `pip --version` succeeds |
| 53 | - the user has GitHub Copilot access |
| 54 | - the intended LiteLLM port is available, usually `4000` |
| 55 | |
| 56 | If the user only wants instructions, state the prerequisites instead of running them. |
| 57 | |
| 58 | ### 2. Choose Temporary vs Persistent Setup |
| 59 | |
| 60 | Use this rule: |
| 61 | |
| 62 | - Temporary setup: preferred default for first-time setup, debugging, and low-risk trials |
| 63 | - Persistent setup: only when the user explicitly wants the proxy path to apply every time Claude Code starts |
| 64 | |
| 65 | For persistent setup, confirm the target file and then merge keys into `~/.claude/settings.json`. Do not replace the file contents. |
| 66 | |
| 67 | ### 3. Create LiteLLM `config.yaml` |
| 68 | |
| 69 | Start from the article's flow, but keep the provider naming aligned with LiteLLM docs: |
| 70 | |
| 71 | ```yaml |
| 72 | model_list: |
| 73 | - model_name: claude-opus-4.5 |
| 74 | litellm_params: |
| 75 | model: github_copilot/claude-opus-4.5 |
| 76 | drop_params: true |
| 77 | ``` |
| 78 | |
| 79 | Explain the fields: |
| 80 | |
| 81 | - `model_name`: the logical name Claude Code will request |
| 82 | - `model`: the LiteLLM provider route, using `github_copilot/<model>` |
| 83 | - `drop_params: true`: strips unsupported Anthropic-specific fields before forwarding to Copilot |
| 84 | |
| 85 | If the user wants a different Copilot-backed model, keep the same pattern: |
| 86 | |
| 87 | ```yaml |
| 88 | model_list: |
| 89 | - model_name: <logical-name> |
| 90 | litellm_params: |
| 91 | model: github_copilot/<copilot-model> |
| 92 | drop_params: true |
| 93 | ``` |
| 94 | |
| 95 | Do not hardcode extra headers into the default path unless the user already hit a rejection that suggests header overrides are needed. |
| 96 | |
| 97 | ### 4. Install and Start LiteLLM |
| 98 | |
| 99 | Preferred install: |
| 100 | |
| 101 | ```bash |
| 102 | uv tool install "litellm[proxy]" |
| 103 | ``` |
| 104 | |
| 105 | Fallback: |
| 106 | |
| 107 | ```bash |
| 108 | pip install "litellm[proxy]" |
| 109 | ``` |
| 110 | |
| 111 | Start the proxy from the directory containing `config.yaml`: |
| 112 | |
| 113 | ```bash |
| 114 | litellm --config config.yaml --port 4000 |
| 115 | ``` |
| 116 | |
| 117 | Tell the user to keep that terminal open because the logs are the fastest truth source during verification. |
| 118 | |
| 119 | ### 5. Explain GitHub Device Aut |