npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

claude-config-switcher

v1.1.0

Published

A command-line tool for switching between different Claude API configurations

Readme

Claude配置切换工具 (CCS)

一个用于在不同的 Claude Code API 配置之间进行切换的命令行工具。

功能

  • 列出所有可用的API配置并提示选择
    • 支持交互式菜单(光标上下移动选择)
    • 支持手动输入序号
  • 切换当前使用的API配置
  • 显示当前配置
  • 显示版本信息
  • 错误处理和帮助提示

安装

本地安装

npm install -g claude-config-switcher

使用方法

配置文件

工具需要两个配置文件,都位于 ~/.claude/ 目录下:

1. apiConfigs.json - API配置列表

存储所有可用的Claude API配置,格式如下:

[
  {
    "name": "wenwen-ai",
    "config": {
      "env": {
        "ANTHROPIC_AUTH_TOKEN": "sk-XXXXXXX",
        "ANTHROPIC_BASE_URL": "https://code.wenwen-ai.com",
        "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
      },
      "permissions": {
        "allow": [],
        "deny": []
      },
      "model": "opus"
    }
  },
  {
    "name": "zone",
    "config": {
      "env": {
        "ANTHROPIC_AUTH_TOKEN": "sk-XXXXXXX",
        "ANTHROPIC_BASE_URL": "https://zone.veloera.org/pg",
        "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
      },
      "permissions": {
        "allow": [],
        "deny": []
      },
      "model": "opus"
    }
  }
]

2. settings.json - 当前激活配置

存储当前使用的配置,格式如下:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://zone.veloera.org/pg",
    "ANTHROPIC_AUTH_TOKEN": "sk-XXXXXXX",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
  },
  "permissions": {
    "allow": [],
    "deny": []
  },
  "model": "opus"
}

注意:切换配置时,整个 settings.json 文件会被选中配置的 config 对象完全替换。

命令

输出当前配置

ccs current

输出示例:

当前激活的配置: zone

配置详情:
{
  "name": "zone",
  "config": {
    "env": {
      "ANTHROPIC_AUTH_TOKEN": "sk-xxxx",
      "ANTHROPIC_BASE_URL": "https://zone.veloera.org/pg",
      "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
      "HTTPS_PROXY": "http://127.0.0.1:7890",
      "HTTP_PROXY": "http://127.0.0.1:7890"
    },
    "permissions": {
      "allow": [],
      "deny": []
    }
  }
}

列出所有可用的API配置并提示选择

ccs list

输出示例:

? 请选择要切换的配置: (Use arrow keys)
> 1. [wenwen-ai   ]  sk-XXXXXXX  https://code.wenwen-ai.com (当前)
  2. [zone        ]  sk-XXXXXXX  https://zone.veloera.org/pg
  3. [co.yes.vg   ]  sk-XXXXXXX  https://co.yes.vg/api
  4. [a-generic   ]  sk-XXXXXXX  https://a-generic.be-a.dev/api
  ──────────────
  输入序号...

? 请选择要切换的配置: 2. [zone        ]  sk-XXXXXXX  https://zone.veloera.org/pg

当前选择的配置:
{
  "name": "zone",
  "config": {
    "env": {
      "ANTHROPIC_AUTH_TOKEN": "sk-xxxx",
      "ANTHROPIC_BASE_URL": "https://zone.veloera.org/pg",
      "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
    },
    "permissions": {
      "allow": [],
      "deny": []
    },
    "model": "opus"
  }
}

? 确认切换到此配置? Yes

成功切换到配置: zone

交互方式:

  1. 光标选择: 使用键盘上下箭头选择配置,按Enter确认
  2. 手动输入: 选择"输入序号..."选项,然后输入配置的序号

直接设置当前使用的API配置

ccs use <序号>

例如:

ccs use 2

输出示例:

当前选择的配置:
{
  "name": "zone",
  "config": {
    "env": {
      "ANTHROPIC_AUTH_TOKEN": "sk-xxxxxx",
      "ANTHROPIC_BASE_URL": "https://zone.veloera.org/pg",
      "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
    },
    "permissions": {
      "allow": [],
      "deny": []
    },
    "model": "opus"
  }
}

? 确认切换到此配置? Yes

成功切换到配置: zone

显示版本信息

ccs --version
# 或
ccs -v

输出示例:

ccs 版本: 1.0.0

显示帮助信息

ccs --help

输出示例:

Usage: ccs [options] [command]

Claude配置切换工具

Options:
  -v, --version      显示版本信息
  -h, --help         display help for command

Commands:
  list               列出所有可用的API配置并提示选择
  use <index>        设置当前使用的API配置
  help [command]     display help for command

错误处理

当输入不存在的命令时,会显示错误信息和可用命令列表:

ccs unknown

输出示例:

错误: 未知命令 'unknown'

可用命令:
  list
  use

使用 --help 查看更多信息

注意事项

  • 确保 ~/.claude/apiConfigs.json~/.claude/settings.json 文件存在并包含有效的配置信息
  • 工具会自动创建 ~/.claude 目录(如果不存在)
  • 确认操作时默认为"是",直接按Enter键即可确认
  • 切换配置时会完全替换 settings.json 文件内容