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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@william-zxs/ccenv

v1.2.2

Published

便捷的命令行工具,用于在不同的 Claude API 配置之间快速切换 | A convenient CLI tool for quickly switching between different Claude API configurations

Readme

ccenv

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

中文

Features

  • 🔄 Interactive configuration selection menu
  • ⭐ Current active configuration marked with *
  • 🎯 Cursor defaults to the currently active configuration
  • 🔧 Automatic environment variable management (unset old config, set new config)
  • 🚀 Auto-launch claude command after switching
  • ⚙️ Support for direct configuration name specification for quick switching
  • 🌍 Internationalization support (English/中文)
  • 🔍 Smart language detection based on system locale
  • 📦 npm global installation support, cross-platform compatibility

Installation

Method 1: Install via npm (Recommended)

npm install -g @william-zxs/ccenv

Method 2: Local Development Installation

  1. Clone or download this project
  2. Run in the project directory:
    npm install -g .

npm installation will automatically:

  • Create configuration directory ~/.ccenv/
  • Generate default configuration file ~/.ccenv/settings.json
  • Install ccenv command to global PATH

Usage

Step 1: Configure API Keys (Required)

After installation, you need to configure your API keys first:

ccenv edit

This will open the configuration file in an editor. Fill in your API keys for each provider:

Replace the empty ANTHROPIC_AUTH_TOKEN values with your actual API keys.

Step 2: Switch Configurations

Interactive Selection

ccenv

This will display the configuration menu with color-coded token status:

  • 🟢 Green checkmark: API key configured
  • 🔴 Red X: API key missing

Direct Switching

ccenv kimi       # Switch to Moonshot AI (Kimi)
ccenv glm        # Switch to Zhipu AI (GLM)
ccenv qwen       # Switch to Alibaba Qianwen
ccenv deepseek   # Switch to DeepSeek

List All Configurations

ccenv ls

Shows all available configurations with their status.

Language Settings

ccenv lang              # Show current interface language
ccenv lang zh           # Set interface to Chinese
ccenv lang en           # Set interface to English
ccenv --lang en ls      # Temporarily use English for one command

ccenv supports internationalization with:

  • Automatic language detection based on system locale
  • Persistent language settings saved to configuration file
  • Temporary language override using --lang parameter
  • Supported languages: English (en), Chinese (zh)

Configuration File

The configuration file is located at ~/.ccenv/settings.json with the following format:

{
  "defaultProfile": null,
  "profiles": [
    {
      "name": "kimi",
      "env": {
        "ANTHROPIC_BASE_URL": "https://api.moonshot.cn/anthropic",
        "ANTHROPIC_AUTH_TOKEN": "sk-your-moonshot-api-key",
        "ANTHROPIC_MODEL": "kimi-k2-turbo-preview",
        "ANTHROPIC_SMALL_FAST_MODEL": "kimi-k2-turbo-preview"
      }
    },
    {
      "name": "glm",
      "env": {
        "ANTHROPIC_BASE_URL": "https://open.bigmodel.cn/api/anthropic",
        "ANTHROPIC_AUTH_TOKEN": "your-zhipu-api-key.xxx"
      }
    },
    {
      "name": "qwen",
      "env": {
        "ANTHROPIC_BASE_URL": "https://dashscope.aliyuncs.com/api/v2/apps/claude-code-proxy",
        "ANTHROPIC_AUTH_TOKEN": "sk-your-alibaba-api-key"
      }
    },
    {
      "name": "deepseek",
      "env": {
        "ANTHROPIC_BASE_URL": "https://api.deepseek.com/anthropic",
        "ANTHROPIC_AUTH_TOKEN": "sk-your-deepseek-api-key",
        "ANTHROPIC_MODEL": "deepseek-chat",
        "ANTHROPIC_SMALL_FAST_MODEL": "deepseek-chat"
      }
    }
  ]
}

Supported Environment Variables

  • ANTHROPIC_BASE_URL - API base URL
  • ANTHROPIC_AUTH_TOKEN - Authentication token
  • ANTHROPIC_MODEL - Default model
  • ANTHROPIC_SMALL_FAST_MODEL - Small fast model

Built-in Configurations

The following API configurations are included by default:

  1. kimi - Moonshot AI (月之暗面)
  2. glm - Zhipu AI (智谱AI)
  3. qwen - Alibaba Tongyi Qianwen (阿里通义千问)
  4. deepseek - DeepSeek AI (深度求索)

How It Works

  1. Read the ~/.ccenv/settings.json configuration file
  2. Detect the currently active configuration (via CCENV_PROFILE environment variable)
  3. Display interactive menu with current configuration marked and token status color-coded
  4. After user selects a new configuration:
    • Clear existing related environment variables
    • Set new configuration environment variables
    • Set CCENV_PROFILE to track active configuration

Development and Local Testing

If you want to develop or test locally:

# Clone project
git clone <repository-url>
cd ccenv

# Install dependencies
npm install

# Local testing
node src/cli.js

# Or link to global
npm link
ccenv

Important Notes

  • Environment variables are scoped to the current shell session only
  • Ensure claude command is properly installed
  • Node.js version requirement: >= 14.0.0

Custom Configuration

You can edit the ~/.ccenv/settings.json file to add or modify configurations. Modified configurations take effect immediately without reinstallation.

Publishing to npm

To publish a new version to npm:

# Update version number
npm version patch  # or minor, major

# Publish
npm publish