通过 LiteLLM 让 Claude Code 可以使用 GitHub Copilot 中的 Claude 模型

查看 8|回复 0
作者:SayHelloHi   
创建 Python 虚拟环境
[ol]

  • 安装uv

  • uv venv
    [/ol]
    安装 LiteLLM
    pip install litellm[proxy]
    uv pip install litellm[proxy]
    配置 config.yaml
    litellm_settings:
      drop_params: true
    model_list:
      - model_name: claude-opus-4-6
        litellm_params:
          model: github_copilot/claude-opus-4.6
      - model_name: claude-sonnet-4-6
        litellm_params:
          model: github_copilot/claude-sonnet-4.6  
    配置 Claude Code
    [ol]
  • 打开 ~/.claude/settings.json
    [/ol]
    {
      "env": {
        "ANTHROPIC_AUTH_TOKEN": "sk-996",
        "ANTHROPIC_BASE_URL": "http://localhost:4000",
        "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
      },
      "permissions": {
        "allow": [],
        "deny": []
      },
      "model": "sonnet[1m]",
      "enabledPlugins": {
        "playwright@claude-plugins-official": true,
        "og-image@og-image-skill": true
      }
    }
    启动 LiteLLM
    litellm --config config.yaml
    注意:启动后会有设备码,你需要打开 Github 网页输入设备码授权
    参考
    https://docs.litellm.ai/docs/providers/github_copilot#usage---litellm-proxy
  • 您需要登录后才可以回帖 登录 | 立即注册

    返回顶部