Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@william-zxs/ccenv

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@william-zxs/ccenv

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

latest
npmnpm
Version
1.2.2
Version published
Maintainers
1
Created
Source

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

npm install -g @william-zxs/ccenv

Method 2: Local Development Installation

  • Clone or download this project
  • 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:

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

How It Works

  • Read the ~/.ccenv/settings.json configuration file
  • Detect the currently active configuration (via CCENV_PROFILE environment variable)
  • Display interactive menu with current configuration marked and token status color-coded
  • 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

Keywords

ccenv

FAQs

Package last updated on 10 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts