A powerful CLI tool for managing multiple Claude Code configurations with ease. Switch between different Claude API endpoints, manage authentication tokens, and streamline your AI-powered development workflow.
- Multi-Configuration Management: Manage multiple Claude API configurations (official Anthropic, proxies, or alternative providers)
- Easy Switching: Quickly switch between configurations with an interactive selector
- Smart Directory Launch: Remember last working directory and support project aliases for quick access
- Environment Import: Automatically detect and import existing Claude configurations from environment variables
- Automatic Installation: Automatically installs and updates Claude CLI when needed
- API Validation: Tests API connectivity before saving configurations
- Cross-Platform: Support for Linux, macOS, and Windows (amd64 & arm64)
- Zero Configuration: Works out of the box with sensible defaults
Download the latest release for your platform from the releases page.
# Download and extract (example for linux-amd64)
curl -L https://github.com/ourines/codes/releases/latest/download/codes-linux-amd64 -o codes
chmod +x codes
# Install to system path
./codes install# Download the binary for your architecture
# Then run the install command
.\codes.exe installRequirements:
- Go 1.21 or later
- npm (required for Claude CLI installation)
# Clone the repository
git clone https://github.com/ourines/codes.git
cd codes
# Build the binary
make build
# Install to system PATH
./codes installcodes initThis will verify that everything is set up correctly and guide you if something is missing.
codes addYou'll be prompted to enter:
- Configuration name (e.g., "official", "proxy")
ANTHROPIC_BASE_URL(e.g.,https://api.anthropic.com)ANTHROPIC_AUTH_TOKEN(your API key)
The tool will automatically test the API connection before saving.
codesThis will launch Claude CLI with the selected configuration's environment variables.
codes selectAn interactive menu will appear showing all your configurations. Select one to switch and launch Claude.
Check your environment and validate your configuration. This command performs comprehensive checks including:
- Verifies Claude CLI installation
- Detects existing Claude configuration in environment variables
- Offers to import existing configuration if found
- Checks configuration file existence and validity
- Tests API connectivity for the default configuration
- Displays detailed status of all configurations
codes initExample output:
✓ Claude CLI is installed
✓ Found existing configuration in environment variables
✓ Configuration file exists
✓ Found 3 configuration(s)
✓ Default configuration is working
This is a great command to run after installation or when troubleshooting issues.
Runs Claude CLI with the currently selected configuration in the last used directory. If Claude CLI is not installed, it will be automatically installed. The tool remembers your last working directory for convenience.
codesYou can also specify a directory or project alias:
codes /path/to/project
codes my-project # if you've added a project aliasInteractively add a new Claude API configuration.
codes addDisplay all configurations and interactively select one to use.
codes selectUpdate or install a specific version of Claude CLI.
codes updateLists the latest 20 available versions from npm and allows you to:
- Select a version by number (1-20)
- Enter a specific version number (e.g.,
1.2.3) - Type
latestto install the newest version
Install the codes binary to your system PATH.
codes install- Linux/macOS: Installs to
/usr/local/binor~/bin - Windows: Installs to
~/go/bin
Start Claude Code in a specific directory or using a project alias. Without arguments, it uses the last working directory.
# Start in current directory (and remember it)
codes start .
# Start in specific path
codes start /path/to/project
# Start using project alias
codes start my-projectAdd a project alias for quick access to frequently used directories.
codes project add my-app /path/to/my-appList all configured project aliases.
codes project listRemove a project alias.
codes project remove my-appDisplay the current version of codes CLI.
codes versionThe tool searches for config.json in the following order:
- Current working directory:
./config.json - User home directory:
~/.codes/config.json
Create a config.json file with the following structure:
{
"configs": [
{
"name": "official",
"ANTHROPIC_BASE_URL": "https://api.anthropic.com",
"ANTHROPIC_AUTH_TOKEN": "sk-ant-xxxxx"
},
{
"name": "proxy",
"ANTHROPIC_BASE_URL": "https://your-proxy.com/api",
"ANTHROPIC_AUTH_TOKEN": "your-token"
}
],
"default": "official"
}name: Unique identifier for the configurationANTHROPIC_BASE_URL: Base URL for the Claude API endpointANTHROPIC_AUTH_TOKEN: Authentication token for the APIstatus: (optional) API status - "active", "inactive", or "unknown"default: The configuration name to use by default
See config.json.example for a complete example with multiple providers:
cp config.json.example config.json
# Edit config.json with your actual tokenscodes/
├── cmd/codes/ # Main entry point
├── internal/
│ ├── commands/ # Command implementations
│ ├── config/ # Configuration management
│ └── ui/ # User interface utilities
├── .github/workflows/ # CI/CD pipelines
├── Makefile # Build automation
└── config.json.example # Example configuration
# Build the binary
make build
# Run tests
make test
# Clean build artifacts
make clean
# Display version
make versionmake testThis project uses GitHub Actions for continuous integration and automated releases:
- CI Pipeline: Runs on every push to
mainand pull requests - Release Pipeline: Triggered by version tags (e.g.,
v1.0.0)
# Tag a new version
git tag v1.0.0
git push origin v1.0.0This will automatically build binaries for all supported platforms and create a GitHub release.
- Go: 1.21 or later (for building from source)
- npm: Required for installing/updating Claude CLI
- Claude CLI: Automatically installed by the tool if not present
If the tool can't find Claude CLI, run:
codes updateThis will install the latest version of Claude CLI via npm.
If API validation fails when adding a configuration:
- Verify your
ANTHROPIC_BASE_URLis correct - Check that your
ANTHROPIC_AUTH_TOKENis valid - Ensure you have network connectivity to the API endpoint
The configuration will still be saved but marked as "inactive" if validation fails.
If you get permission errors during installation:
# Use sudo for system-wide installation
sudo ./codes install
# Or install to user directory
mkdir -p ~/bin
cp codes ~/bin/
export PATH="$HOME/bin:$PATH"Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - feel free to use this project for any purpose.
This tool is a wrapper around the official Claude Code CLI by Anthropic.
Note: This is an unofficial tool and is not affiliated with or endorsed by Anthropic.