Package Exports
- ccenv-cli
- ccenv-cli/dist/cli.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ccenv-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Claude Env (ccx)
Environment Orchestrator and Context Switcher for Claude Code CLI
Switch AI backends with a single command. Like nvm for Node.js, but for your Claude Code AI provider.
Why?
Every time you want to switch Claude Code from the official Anthropic API to OpenRouter, DeepSeek, or a local Ollama instance, you have to manually set environment variables. This tool eliminates that friction by letting you:
- Save provider configurations as profiles
- Switch between them with a single command
- Keep your API keys encrypted and secure
- Support multiple shells (bash, zsh, fish, PowerShell, cmd)
Zero server required - Unlike proxy-based solutions, ccx just manages environment variables.
Installation
npm install -g ccenv-cliQuick Start
1. Create a profile
# Using a template
ccx create work --template openrouter --api-key sk-or-xxxxx
# Or use the interactive wizard
ccx setup2. Activate the profile
# Bash/Zsh
eval "$(ccx use work)"
# PowerShell
Invoke-Expression (ccx use work --shell powershell)
# Fish
ccx use work --shell fish | source3. Run Claude Code
claudeThat's it! Claude Code will now route through OpenRouter.
4. Switch back to official Anthropic
eval "$(ccx use official)"
# or
eval "$(ccx reset)"Commands
| Command | Description |
|---|---|
ccx list |
List all profiles |
ccx show <name> |
Show profile details |
ccx create <name> |
Create a new profile |
ccx edit <name> |
Edit an existing profile |
ccx delete <name> |
Delete a profile |
ccx use <name> |
Activate a profile (outputs shell script) |
ccx reset |
Reset environment to default |
ccx current |
Show current profile status |
ccx templates |
List available provider templates |
ccx setup |
Interactive profile setup wizard |
ccx export <name> |
Export profile as JSON |
ccx import <json> |
Import profile from JSON |
Available Templates
| Template | Description | Default Model |
|---|---|---|
official |
Anthropic Official API | claude-sonnet-4-20250514 |
openrouter |
OpenRouter multi-model | anthropic/claude-sonnet-4 |
openrouter-minimax |
MiniMax via OpenRouter | minimax/minimax-m1-80k |
openrouter-deepseek |
DeepSeek via OpenRouter | deepseek/deepseek-chat-v3-0324 |
deepseek |
DeepSeek Direct API | deepseek-chat |
gemini |
Google Gemini | gemini-2.5-flash |
ollama |
Local Ollama | qwen2.5-coder:latest |
lmstudio |
Local LM Studio | local-model |
groq |
Groq fast inference | llama-3.3-70b-versatile |
together |
Together AI | Meta-Llama-3.1-70B |
custom |
Custom endpoint | (your choice) |
Examples
Create profiles for different use cases
# High-stakes work with official Claude
ccx create pro --template official
# Budget-friendly coding with DeepSeek
ccx create budget --template openrouter-deepseek --api-key sk-or-xxxxx
# Local offline mode
ccx create local --template ollama
# Custom provider
ccx create myproxy --base-url http://localhost:8080/v1 --api-key my-key --model gpt-4Shell integration (add to .bashrc/.zshrc)
# Function to switch profiles easily
ccx-switch() {
eval "$(ccx use $1)"
echo "Switched to profile: $1"
}
# Aliases
alias cc-pro='ccx-switch pro'
alias cc-budget='ccx-switch budget'
alias cc-local='ccx-switch local'
alias cc-reset='eval "$(ccx reset)"'PowerShell integration (add to $PROFILE)
function Switch-Claude {
param([string]$Profile)
Invoke-Expression (ccx use $Profile --shell powershell)
Write-Host "Switched to profile: $Profile"
}
Set-Alias cc-switch Switch-ClaudeHow It Works
- Profiles are stored in
~/.config/claude-env/config.json(cross-platform viaconf) - API keys are encrypted using AES-256 with a machine-specific key
ccx useoutputs shell-specific export commands foreval- Environment variables set:
ANTHROPIC_BASE_URL- The API endpointANTHROPIC_AUTH_TOKEN- Your API keyANTHROPIC_MODEL- The model to useANTHROPIC_API_KEY- Unset when using proxies (important!)CCX_ACTIVE_PROFILE- Tracks the active profile
Security
- API keys are encrypted at rest using AES-256-CBC
- Encryption key is derived from machine-specific info (hostname + username)
- Keys are never logged or exposed in plain text
- Export command excludes API keys by default
Comparison with claude-code-router
| Feature | ccx | claude-code-router |
|---|---|---|
| Architecture | Env vars only | Local proxy server |
| Background process | No | Yes |
| Profile switching | Instant | Requires restart |
| Request routing | N/A | Yes (background/think/etc) |
| Custom transformers | N/A | Yes |
| Complexity | Low | High |
Use ccx if: You want simple, fast profile switching without running a server.
Use claude-code-router if: You need advanced request routing or custom transformers.
Troubleshooting
"Profile not taking effect"
Make sure you're using eval:
# Wrong
ccx use work
# Right
eval "$(ccx use work)""Shell not detected correctly"
Specify the shell explicitly:
ccx use work --shell zsh"Config file location"
ccx config-pathLicense
MIT