running-claude-code-via-litellm-copilot
Use 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/403 auth errors.
What this skill does
# Running Claude Code via LiteLLM and GitHub Copilot
## Overview
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.
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.
This skill is guidance-first but execution-aware:
- If the user wants explanation only, provide the smallest correct set of files, commands, and checks.
- If the user wants real setup work on the current machine, inspect first and adapt commands to the active shell and OS.
- Pause before persistent edits such as `~/.claude/settings.json` or shell profile files.
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.
## When To Use
Use this skill when the user wants any of the following:
- Claude Code to run against GitHub Copilot through LiteLLM
- lower direct Anthropic API spending while keeping the Claude Code workflow
- a local `config.yaml` for LiteLLM's GitHub Copilot provider
- `ANTHROPIC_BASE_URL`, `ANTHROPIC_MODEL`, or `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` setup
- help understanding GitHub device authorization during LiteLLM startup
- help with model mismatch, 404-like errors, no requests reaching LiteLLM, or GitHub 401/403 failures
Do not use this skill for:
- deciding whether the workaround is allowed by GitHub terms
- general LiteLLM architecture unrelated to Claude Code plus Copilot
- direct Anthropic API setup with no Copilot or LiteLLM component
## Core Rules
1. Lead with a short compliance caveat.
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.
2. Prefer the minimum viable path first.
Start with temporary environment variables and a local `config.yaml` unless the user explicitly wants a persistent setup.
3. Keep `ANTHROPIC_MODEL` and LiteLLM `model_name` identical.
Exact string match matters more than clever explanation.
4. Treat `ANTHROPIC_AUTH_TOKEN` as a local placeholder.
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.
5. Never overwrite `~/.claude/settings.json` wholesale.
Merge only the needed `env` keys and preserve unrelated settings.
## Workflow
### 1. Preflight
Check these first when the user wants real setup work:
- `claude --help` succeeds
- `uv --version` or `pip --version` succeeds
- the user has GitHub Copilot access
- the intended LiteLLM port is available, usually `4000`
If the user only wants instructions, state the prerequisites instead of running them.
### 2. Choose Temporary vs Persistent Setup
Use this rule:
- Temporary setup: preferred default for first-time setup, debugging, and low-risk trials
- Persistent setup: only when the user explicitly wants the proxy path to apply every time Claude Code starts
For persistent setup, confirm the target file and then merge keys into `~/.claude/settings.json`. Do not replace the file contents.
### 3. Create LiteLLM `config.yaml`
Start from the article's flow, but keep the provider naming aligned with LiteLLM docs:
```yaml
model_list:
- model_name: claude-opus-4.5
litellm_params:
model: github_copilot/claude-opus-4.5
drop_params: true
```
Explain the fields:
- `model_name`: the logical name Claude Code will request
- `model`: the LiteLLM provider route, using `github_copilot/<model>`
- `drop_params: true`: strips unsupported Anthropic-specific fields before forwarding to Copilot
If the user wants a different Copilot-backed model, keep the same pattern:
```yaml
model_list:
- model_name: <logical-name>
litellm_params:
model: github_copilot/<copilot-model>
drop_params: true
```
Do not hardcode extra headers into the default path unless the user already hit a rejection that suggests header overrides are needed.
### 4. Install and Start LiteLLM
Preferred install:
```bash
uv tool install "litellm[proxy]"
```
Fallback:
```bash
pip install "litellm[proxy]"
```
Start the proxy from the directory containing `config.yaml`:
```bash
litellm --config config.yaml --port 4000
```
Tell the user to keep that terminal open because the logs are the fastest truth source during verification.
### 5. Explain GitHub Device Authorization
On the first successful request to the GitHub Copilot provider, LiteLLM may open a device authorization flow:
1. LiteLLM prints a verification URL and device code
2. the user opens the URL and approves the request
3. LiteLLM stores the resulting credential locally for future use
Optional token-location overrides exist:
- `GITHUB_COPILOT_TOKEN_DIR`
- `GITHUB_COPILOT_ACCESS_TOKEN_FILE`
Only mention these when the user needs custom token storage, shared environments, or troubleshooting around expired or misplaced credentials.
### 6. Configure Claude Code
For a temporary PowerShell session:
```powershell
$env:ANTHROPIC_AUTH_TOKEN = "sk-any-string"
$env:ANTHROPIC_BASE_URL = "http://localhost:4000"
$env:ANTHROPIC_MODEL = "claude-opus-4.5"
$env:CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC = "1"
claude
```
For a temporary Bash or Zsh session:
```bash
export ANTHROPIC_AUTH_TOKEN="sk-any-string"
export ANTHROPIC_BASE_URL="http://localhost:4000"
export ANTHROPIC_MODEL="claude-opus-4.5"
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
claude
```
For persistent configuration, merge these keys into `~/.claude/settings.json`:
```json
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "sk-any-string",
"ANTHROPIC_BASE_URL": "http://localhost:4000",
"ANTHROPIC_MODEL": "claude-opus-4.5",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
}
}
```
Merge-safe behavior:
- if the file does not exist, create it
- if it exists, preserve all unrelated top-level keys
- preserve existing `env` entries that are unrelated to this workflow
- update only the four keys above
- if the JSON is malformed, stop and report the parse problem instead of overwriting the file
### 7. Verify The Request Chain
Use two terminals when possible:
- Terminal A runs LiteLLM
- Terminal B runs `claude`
Ask for one small prompt such as a short script or code review request, then verify:
- Claude Code starts normally
- LiteLLM logs show an inbound request
- LiteLLM logs indicate the GitHub Copilot model route, typically `github_copilot/<model>`
The healthy path is:
```text
Claude Code -> LiteLLM -> GitHub Copilot -> LiteLLM -> Claude Code
```
### 8. Troubleshooting
If Claude Code reports model-not-found, 404-like failures, or LiteLLM says the model does not exist:
- compare `ANTHROPIC_MODEL` to `model_name` exactly
- check case, punctuation, and hyphens
If LiteLLM never receives a request:
- confirm `ANTHROPIC_BASE_URL` points to <http://localhost:4000>
- confirm LiteLLM is still running on that port
- confirm the environment variables were set in the same shell session that launched `claude`
- check local firewall or port conflicts if the URL is correct but still silent
If LiteLLM reaches GitHub Copilot but gets 401 or 403 responses:
- repeat the device authorization flow by restarting LiteLLM and retrying
- confirm the GitHub account still has Copilot access
- if custom token-directory variables are set, verify they point to the intended files
## Advanced Fallback: Header Overrides
The article uses explicit Copilot-style headers. Current LiteLLM docs expose GitHub Copilot as a provider and also document header override support.
Only reach for explicit `extra_headers` when:
- the basic provider flow reaches Copilot but still needs client-shape overrides
- the user Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.