A command-line tool for managing Claude Code API configurations with automatic environment variable management.
go install github.com/Inasayang/chcc@latest
-
Add your first Claude Code API configuration:
chcc add -n "Official" -u "https://api.anthropic.com" -t "sk-your-anthropic-api-key"
-
Add a proxy or alternative endpoint with specific model:
chcc add -n "Proxy" -u "https://your-proxy.example.com" -t "your-proxy-token" -m "claude-3-sonnet"
-
List all Claude Code API configurations:
chcc list # or simply chcc
-
Switch to a different configuration:
chcc set-default -n "Proxy"
-
Remove a configuration:
chcc remove -n "Old-Config"
chcc add -n <name> -u <url> -t <token> [-m <model>]
Flags:
-n, --name
: API site name (required)-u, --url
: API site base URL (required)-t, --token
: API site token (required)-m, --model
: API site model (optional)
Examples:
# Add site without model
chcc add -n "MyAPI" -u "https://api.example.com" -t "sk-token123"
# Add site with specific model
chcc add -n "MyAPI" -u "https://api.example.com" -t "sk-token123" -m "claude-3-sonnet"
chcc list
# or
chcc
chcc set-default -n <name>
This command will:
- Set the specified site as default
- Update environment variables:
ANTHROPIC_BASE_URL
,ANTHROPIC_AUTH_TOKEN
- Set
ANTHROPIC_MODEL
if the site has a model configured, or clear it if not - Provide OS-specific commands for current terminal session
chcc remove -n <name>
CHCC automatically manages these environment variables:
ANTHROPIC_BASE_URL
: The base URL of the selected API siteANTHROPIC_AUTH_TOKEN
: The authentication token for the selected API siteANTHROPIC_MODEL
: The model to use (only set if configured for the site)
This project is licensed under the MIT License - see the LICENSE file for details.