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

@vainjs/claude-code-env

v0.4.0

Published

Easily manage multiple anthropic specification model apis and switch between models with one command

Readme

Claude Code Env (CCE)

NPM version NPM downloads

English | 简体中文

Are you tired of manually editing environment variables to switch between different models? If you don't want to use claude-code-router, then CCE is a great choice. It's a lightweight command-line tool that allows you to manage and switch between various large models that comply with the Anthropic API specification through simple commands.

Why use CCE?

CCE solves common pain points when using Claude Code:

  • Multiple models - Quickly switch between official APIs, proxy servers, and enterprise networks.
  • Environment variables - Avoid frequently editing environment variables like ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN.
  • Team collaboration - Easily share and sync configurations with your team.

How is it different from claude-code-router?

It should be noted that CCE is not a proxy tool or request router. It's just a client-side environment variable switcher, whose only job is to help you manage and set environment variables (ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, etc.) for your terminal session. It doesn't intercept or forward any of your requests. This also means that the model service it points to (whether it's the official API, third-party proxy, or other services) must be compatible with the Anthropic API specification.

Install

pnpm add -g @vainjs/claude-code-env

Core Features

One-command Configuration

Adding a new model is simple:

cce add # Will prompt you to enter model name, address, token, etc.

Switch models anytime:

cce use claude

Clear Configuration Overview

View configuration list:

cce list
■ Configured Models

  NAME                     ANTHROPIC_MODEL
  ────────────────────────────────────────────────────────────
● claude                   Default
  kimi-k2                  moonshotai/Kimi-K2-Instruct

Current model: claude

Real-time Status Check

Confirm the environment variables you're actually using:

cce status

Managing Configurations for Different Models

# Add official API
cce add
# Name: claude, URL: https://api.anthropic.com

# Add third-party server
cce add
# Name: kimi-k2, URL: https://api.siliconflow.cn

# Quick switching
cce use claude
cce use kimi-k2

Environment Variable Management

CCE now supports dynamic environment variable management, allowing you to customize which variables are used when switching models.

View Environment Variables

cce env
■ Environment Variables

  1. ANTHROPIC_BASE_URL (required)
  2. ANTHROPIC_AUTH_TOKEN (required)
  3. ANTHROPIC_MODEL
  4. ANTHROPIC_MAX_TOKENS

Commands:
  cce env add <key>    - Add environment variable
  cce env remove       - Remove environment variable

Add Custom Environment Variables

cce env add CUSTOM_HEADER

Remove Environment Variables

cce env remove  # Interactive selection of removable variables

Note: Required environment variables (ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN) cannot be removed as they are essential for API functionality.

Supported Shells

CCE supports the following shells and automatically detects your current shell:

  • Bash - Uses ~/.bashrc
  • Zsh - Uses ~/.zshrc
  • Fish - Uses ~/.config/fish/config.fish

Configuration Structure

All configurations are saved in the ~/.claude-code-env.json file with the following format:

{
  "models": [
    {
      "name": "claude",
      "ANTHROPIC_BASE_URL": "https://api.anthropic.com",
      "ANTHROPIC_AUTH_TOKEN": "sk-ant-xxx",
      "description": "official API"
    },
    {
      "name": "kimi-k2",
      "ANTHROPIC_BASE_URL": "https://api.siliconflow.cn",
      "ANTHROPIC_AUTH_TOKEN": "sk-mcki-xxx",
      "ANTHROPIC_MODEL": "moonshotai/Kimi-K2-Instruct"
    }
  ],
  "currentModel": "claude",
  "envVars": [
    { "key": "ANTHROPIC_BASE_URL", "required": true },
    { "key": "ANTHROPIC_AUTH_TOKEN", "required": true },
    { "key": "ANTHROPIC_MODEL", "required": false },
    { "key": "ANTHROPIC_MAX_TOKENS", "required": false }
  ]
}