jpskill.com
🛠️ 開発・MCP コミュニティ

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.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o running-claude-code-via-litellm-copilot.zip https://jpskill.com/download/21188.zip && unzip -o running-claude-code-via-litellm-copilot.zip && rm running-claude-code-via-litellm-copilot.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/21188.zip -OutFile "$d\running-claude-code-via-litellm-copilot.zip"; Expand-Archive "$d\running-claude-code-via-litellm-copilot.zip" -DestinationPath $d -Force; ri "$d\running-claude-code-via-litellm-copilot.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して running-claude-code-via-litellm-copilot.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → running-claude-code-via-litellm-copilot フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
2

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

LiteLLMとGitHub Copilot経由でClaude Codeを実行する

概要

このスキルは、Claude CodeがAnthropicクライアントの動作を維持しつつ、実際のバックエンドトラフィックがローカルのLiteLLMプロキシに送信され、その後GitHub Copilotに転送されるという特定の回避策のために使用します。

これは高度な回避策として扱ってください。GitHubが公式に保証するワークフローではありません。ユーザーが技術的に成功するのを助けますが、GitHubのサポート、ポリシー承認、または長期的な互換性を約束しないでください。

このスキルは、ガイダンスを優先しつつ、実行を意識しています。

  • ユーザーが説明のみを希望する場合は、最小限の正しいファイル、コマンド、およびチェックのセットを提供します。
  • ユーザーが現在のマシンで実際のセットアップ作業を希望する場合は、まず検査し、アクティブなシェルとOSに合わせてコマンドを調整します。
  • ~/.claude/settings.jsonやシェルプロファイルファイルなどの永続的な編集を行う前に一時停止します。

どの部分が記事からのもので、どの部分が現在のLiteLLMドキュメントに合わせて調整されたものかを正当化する必要がある場合は、回答する前にreferences/doc-verified-notes.mdを読んでください。

使用するタイミング

ユーザーが以下のいずれかを希望する場合に、このスキルを使用します。

  • LiteLLMを介してGitHub Copilotに対してClaude Codeを実行したい
  • Claude Codeのワークフローを維持しつつ、Anthropic APIへの直接支出を削減したい
  • LiteLLMのGitHub Copilotプロバイダー用のローカルなconfig.yamlが欲しい
  • ANTHROPIC_BASE_URLANTHROPIC_MODEL、またはCLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFICのセットアップが必要
  • LiteLLMの起動中のGitHubデバイス認証の理解に助けが必要
  • モデルの不一致、404のようなエラー、LiteLLMにリクエストが届かない、またはGitHub 401/403エラーに関する助けが必要

以下の目的にはこのスキルを使用しないでください。

  • 回避策がGitHubの規約で許可されているかどうかを判断する
  • Claude CodeとCopilotに関係しない一般的なLiteLLMアーキテクチャ
  • CopilotやLiteLLMコンポーネントを含まない直接的なAnthropic APIのセットアップ

コアルール

  1. 短いコンプライアンスに関する注意書きから始めます。 これがローカルプロキシパスに基づく回避策であり、GitHubが推奨するワークフローではないこと、そしてユーザー自身が最新のCopilotの規約と制限を評価する必要があることを説明します。
  2. まず最小限の実行可能なパスを優先します。 ユーザーが明示的に永続的なセットアップを希望しない限り、一時的な環境変数とローカルなconfig.yamlから始めます。
  3. ANTHROPIC_MODELとLiteLLMのmodel_nameを同一に保ちます。 賢い説明よりも正確な文字列の一致が重要です。
  4. ANTHROPIC_AUTH_TOKENをローカルのプレースホルダーとして扱います。 Claude Codeはローカルで空でない値を期待しますが、これはGitHub Copilotの認証情報ではなく、再利用可能なシークレットとして提示すべきではありません。
  5. ~/.claude/settings.jsonを丸ごと上書きしないでください。 必要なenvキーのみをマージし、無関係な設定は保持します。

ワークフロー

1. プレフライト

ユーザーが実際のセットアップ作業を希望する場合は、まずこれらを確認します。

  • claude --helpが成功する
  • uv --versionまたはpip --versionが成功する
  • ユーザーがGitHub Copilotへのアクセス権を持っている
  • 意図するLiteLLMポートが利用可能である(通常は4000

ユーザーが指示のみを希望する場合は、実行する代わりに前提条件を述べます。

2. 一時的なセットアップと永続的なセットアップの選択

このルールを使用します。

  • 一時的なセットアップ:初回セットアップ、デバッグ、低リスクの試行に推奨されるデフォルト
  • 永続的なセットアップ:ユーザーがClaude Codeの起動時に常にプロキシパスを適用したいと明示的に希望する場合のみ

永続的なセットアップの場合、ターゲットファイルを確認し、キーを~/.claude/settings.jsonにマージします。ファイルの内容を置き換えないでください。

3. LiteLLM config.yamlの作成

記事のフローから始めますが、プロバイダーの命名はLiteLLMのドキュメントに合わせてください。

model_list:
  - model_name: claude-opus-4.5
    litellm_params:
      model: github_copilot/claude-opus-4.5
      drop_params: true

フィールドを説明します。

  • model_name: Claude Codeがリクエストする論理名
  • model: github_copilot/<model>を使用するLiteLLMプロバイダールート
  • drop_params: true: サポートされていないAnthropic固有のフィールドをCopilotに転送する前に削除します

ユーザーが別のCopilotバックエンドモデルを希望する場合は、同じパターンを維持します。

model_list:
  - model_name: <logical-name>
    litellm_params:
      model: github_copilot/<copilot-model>
      drop_params: true

ユーザーがヘッダーのオーバーライドが必要であることを示唆する拒否にすでに遭遇していない限り、デフォルトのパスに余分なヘッダーをハードコードしないでください。

4. LiteLLMのインストールと起動

推奨されるインストール方法:

uv tool install "litellm[proxy]"

フォールバック:

pip install "litellm[proxy]"

config.yamlを含むディレクトリからプロキシを起動します。

litellm --config config.yaml --port 4000

検証中にログが最も速い真実のソースとなるため、そのターミナルを開いたままにしておくようにユーザーに伝えます。

5. GitHubデバイス認証の説明

GitHub Copilotプロバイダーへの最初のリクエストが成功すると、LiteLLMはデバイス認証フローを開く場合があります。

  1. LiteLLMが検証URLとデバイスコードを出力します
  2. ユーザーがURLを開き、リクエストを承認します
  3. LiteLLMは結果として得られる認証情報を将来の使用のためにローカルに保存します

オプションのトークン場所のオーバーライドが存在します。

  • GITHUB_COPILOT_TOKEN_DIR
  • GITHUB_COPILOT_ACCESS_TOKEN_FILE

これらは、ユーザーがカスタムトークンストレージ、共有環境、または期限切れや紛失した認証情報に関するトラブルシューティングが必要な場合にのみ言及してください。

6. Claude Codeの設定

一時的な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

一時的なBashまたはZshセッションの場合:

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

永続的な設定の場合、これらのキーを~/.claude/settings.jsonにマージします。

{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "sk-any-string",
    "ANTHROPIC_BASE_URL": "http://localhost:4000",
    "ANTHROPIC_MODEL": "claude-opus-4.5",
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

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 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:

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:

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:

uv tool install "litellm[proxy]"

Fallback:

pip install "litellm[proxy]"

Start the proxy from the directory containing config.yaml:

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:

$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:

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:

{
  "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:

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 already has evidence that a specific environment behaves better with editor-style headers

Example fallback:

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/<model> pattern and note that Copilot-exposed model availability may change.

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。