跳到主内容
智客 ZICQ

技能库 智客分类:Agent 工作流 running-claude-code-via-litellm-copilot

Running Claude Code Via Litellm Copilot

在通过本地的LitelLLM代理给 GitHub Copilot 时使用 Claude 代码, 减少直接的 Anthropic 开支, 配置 ANTHROPIC_ BASE_ URL 或 ANTHROPIC_ MODEL 覆盖, 或 排除 Copilot 代理设置出故障, 如模型未找到, 没有本地主机流量, 或 GitHub 401/403 认证错误 .

13 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

在通过本地的LitelLLM代理给 GitHub Copilot 时使用 Claude 代码, 减少直接的 Anthropic 开支, 配置 ANTHROPIC_ BASE_ URL 或 ANTHROPIC_ MODEL 覆盖, 或 排除 Copilot 代理设置出故障, 如模型未找到, 没有本地主机流量, 或 GitHub 401/403 认证错误 .

何时用

当用户想要以下任何一项时使用此技能 :

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Overview、When To Use、Core Rules、Workflow、1. Preflight、2. Choose Temporary vs Persistent Setup。 其中含规范建议的小节:分步指令。

文件分析

文件分析:除 SKILL.md 外,正文引用了 references/doc-verified-notes.md,属于带资源的技能包,这些文件按需再读。

官方 description(原文)

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.

OverviewWhen To UseCore RulesWorkflow1. Preflight2. Choose Temporary vs Persistent Setup3. Create LiteLLM `config.yaml`4. Install and Start LiteLLM5. Explain GitHub Device Authorization6. Configure Claude Code7. Verify The Request Chain8. Troubleshooting

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
running-claude-code-via-litellm-copilot
description
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.
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 1
  • references/doc-verified-notes.md

以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「running-claude-code-via-litellm-copilot」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-bf047f6caa48359c-%E8%BF%90%E8%A1%8C-Claude-%E4%BB%A3%E7%A0%81-Via-Litellm-%E5%89%AF%E9%A9%BE%E9%A9%B6.html
请存为 .cursor/skills/running-claude-code-via-litellm-copilot/SKILL.md 或 .claude/skills/running-claude-code-via-litellm-copilot/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/xixu-me/skills 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/xixu-me/skills' --list

npx skills add 'https://github.com/xixu-me/skills' --skill 'running-claude-code-via-litellm-copilot'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: running-claude-code-via-litellm-copilot description: 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. --- ## 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/` - `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: litellm_params: model: github_copilot/ 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/` 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 - 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 already has evidence that a specific environment behaves better with editor-style headers Example fallback: ```yaml model_list: - model_name: claude-opus-4.5 litellm_params: model: github_copilot/claude-opus-4.5 drop_params: true extra_headers: editor-version: "vscode/1.85.1" editor-plugin-version: "copilot/1.155.0" Copilot-Integration-Id: "vscode-chat" user-agent: "GithubCopilot/1.155.0" ``` Present this as an advanced fallback, not the universal default. ## Output Checklist When answering a real user request with this skill, include: - the brief compliance caveat - the exact `config.yaml` or the delta to apply - shell-appropriate commands - whether the setup is temporary or persistent - the verification path - the smallest relevant troubleshooting section if something failed ## Safety Reminders - Do not state that GitHub officially supports this workaround. - Do not imply that a dummy `ANTHROPIC_AUTH_TOKEN` is a real Copilot credential. - Do not recommend replacing `~/.claude/settings.json` wholesale. - Do not present stale model names as guaranteed current availability; if the user asks for a specific model, keep the `github_copilot/` pattern and note that Copilot-exposed model availability may change.

相关技能

Agent 工作流

Skill Creator

创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.

Agent 工作流

Clawdhub

使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.

Agent 工作流

Agent Team Orchestration

管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.

Agent 工作流

Superpowers

Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…