@mengzai1/cce
v1.1.1
Published
Claude Code 配置切换工具 - 管理多个 API Provider/Profile 并快速切换
Maintainers
Readme
claude-code-env (cce)
A CLI tool for managing multiple Claude API configurations via a Provider-Profile architecture, configuring both Claude Code and OpenCode simultaneously.
Features
- Provider-Profile architecture: separate API endpoint definitions from user configurations
- Switch profiles to update Claude Code and OpenCode configs at once
- Secure API key management with strict file permissions (0o600/0o700)
- Interactive CLI with Inquirer.js
- WebUI management dashboard
- Built-in configuration diagnostics (
cce doctor)
Installation
npm install -g @mengzai1/cceRequires Node.js >= 16.0.0.
Quick Start
# 1. Initialize config directory (~/.config/cce)
cce init
# 2. Add a provider (e.g. Volcano Engine)
cce provider add volcano
# 3. Create a profile referencing the provider
cce create work
# 4. Activate the profile
cce use workCommands
Profile Management
| Command | Alias | Description |
|---------|-------|-------------|
| cce init | | Initialize the configuration directory |
| cce create <name> | | Create a new profile (interactively select a provider) |
| cce use [name] | | Activate a profile (interactive selection if name is omitted) |
| cce list | ls | List all profiles |
| cce current | c | Show the currently active profile |
| cce show <name> | | Show profile details |
| cce edit <name> | | Edit a profile |
| cce remove <name> | rm | Remove a profile |
Provider Management
| Command | Description |
|---------|-------------|
| cce provider add <type> | Add a new provider |
| cce provider list | List all providers |
| cce provider show <name> | Show provider details |
| cce provider edit <name> | Edit a provider |
| cce provider remove <name> | Remove a provider |
Supported provider types: openai-compatible, anthropic-compatible, custom
Other Commands
| Command | Description |
|---------|-------------|
| cce doctor | Check configuration for issues |
| cce ui | Launch the WebUI dashboard |
cce ui options:
-p, --port <port>— specify a port--no-open— don't auto-open the browser
How It Works
Profile (references) -> Provider (resolves) -> EffectiveConfig (generates) -> Config FilesWhen you run cce use <profile>:
- Loads the profile and resolves the referenced provider
- Merges into an
EffectiveConfig(baseURL, apiKey, model) - Writes Claude Code config (
~/.claude/settings.json) and OpenCode config (~/.config/opencode/opencode.json)
Configuration
Directory Layout
~/.config/cce/
├── providers/ # Provider definitions
│ └── volcano-prod.json
├── profiles/ # User profiles
│ └── work.json
└── active # Currently active profile nameProvider Example
{
"name": "volcano-prod",
"displayName": "Volcano Engine Production",
"type": "openai-compatible",
"baseURL": "https://ark.cn-beijing.volces.com/api/v3",
"apiKey": "your-api-key",
"models": ["ep-20250101-xxxx", "ep-20250201-yyyy"],
"defaultModel": "ep-20250201-yyyy"
}Profile Example
{
"name": "work",
"description": "Work environment",
"provider": "volcano-prod",
"model": "ep-20250101-xxxx",
"createdAt": "2024-01-01T00:00:00.000Z",
"updatedAt": "2024-01-01T00:00:00.000Z"
}FAQ
Q: What does cce use actually modify?
A: It writes to ~/.claude/settings.json (Claude Code) and ~/.config/opencode/opencode.json (OpenCode).
Q: How are API keys secured?
A: The ~/.config/cce directory is set to 700, config files to 600 (owner read/write only).
Q: Can I override the model in a profile?
A: Yes. A profile can specify a model field to override the provider's defaultModel.
License
MIT
