Cc Portkey banner
NanmiCoder NanmiCoder

Cc Portkey

AI community

Description

A CLI tool for quickly switching Claude Code between different model providers (Claude, DeepSeek, GLM, MiniMax, etc.)

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

cc-portkey

![cc-portkey logo](assets/logo.png)

[English](./README_EN.md) | 中文

一个用于快速切换 Claude Code 模型服务商的命令行工具(支持 Claude、DeepSeek、GLM、MiniMax 等)

**为什么叫 Portkey?**

Portkey(门钥匙)是《哈利·波特》中的魔法物品——碰一下就能瞬间传送到另一个地方。

这个工具也一样:敲一个命令,就能把 Claude Code 瞬移到另一个模型服务商。

功能特性

  • 一条命令切换不同的 API 服务商
  • 支持环境变量引用 (${VAR_NAME})
  • 快捷别名命令 (ccc, ds, glm, mm) 秒切
  • 跨平台支持 (Windows, macOS, Linux)
  • 切换时保留现有的 Claude Code 配置

安装

下载预编译二进制

从 [Releases](https://github.com/NanmiCoder/cc-portkey/releases) 下载对应平台的二进制文件,放到 PATH 目录中。

从源码编译(所有平台)

需要 [Go 1.21+](https://go.dev/dl/)

# 克隆仓库
git clone https://github.com/NanmiCoder/cc-portkey.git
cd cc-portkey

# 编译
go build -o cc-portkey ./cmd/cc-portkey/

# 移动到 PATH 目录
# Linux/macOS:
sudo mv cc-portkey /usr/local/bin/

# Windows (管理员 PowerShell):
Move-Item cc-portkey.exe C:\Windows\System32\

快速开始

# 1. 初始化(自动创建配置 + 快捷命令)
cc-portkey init

# 2. 编辑配置,添加你的 API Keys
cc-portkey edit

# 3. 一键启动(切换 + 启动 Claude Code)
ds   # DeepSeek
glm  # GLM (智谱)
mm   # MiniMax
ccc  # Claude (官方)

配置说明

配置文件位置

  • cc-portkey 配置: ~/.cc-portkey/config.json
  • Claude 配置: ~/.claude/settings.json(由 cc-portkey 修改)

配置文件结构

{
  "current": "claude",
  "profiles": {
    "claude": {
      "display_name": "Claude (官方)",
      "base_url": "",
      "api_key": "${ANTHROPIC_API_KEY}",
      "timeout_ms": 120000,
      "models": {}
    },
    "deepseek": {
      "display_name": "DeepSeek",
      "base_url": "https://api.deepseek.com/anthropic",
      "api_key": "${DEEPSEEK_API_KEY}",
      "timeout_ms": 600000,
      "models": {
        "default": "deepseek-chat",
        "small_fast": "deepseek-chat"
      }
    },
    "glm": {
      "display_name": "GLM (智谱)",
      "base_url": "https://open.bigmodel.cn/api/anthropic",
      "api_key": "${GLM_API_KEY}",
      "timeout_ms": 3000000,
      "models": {
        "opus": "glm-4.6",
        "sonnet": "glm-4.6",
        "haiku": "glm-4.5-air"
      }
    },