Skip to content

mmaaaa1a/ccswitch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ccc - Claude Code Configuration Switcher

A Go-based command-line tool to switch between different Claude Code API configurations.

Platform Support

  • macOS/Linux: Direct binary execution with shell configuration updates
  • Windows: Shell function wrapper for immediate environment variable changes

Quick Start

macOS/Linux (Recommended)

# Clone and build
git clone <repository_url>
cd ccc
make build

# Install (user-level, no sudo required)
./unix/install-mac.sh

# Initialize configuration
ccc init

# Switch providers
ccc qwen      # 阿里云百炼
ccc k2        # Moonshot
ccc glm       # 智谱

Windows

# Clone and build
git clone <repository_url>
cd ccc
make build

# Install with shell function wrapper
./windows/install-user.sh

# Initialize configuration
ccc init

# Switch providers (immediate effect)
ccc qwen      # 阿里云百炼
ccc k2        # Moonshot
ccc glm       # 智谱

Features

  • Cross-platform: Works on macOS, Linux, and Windows
  • Multiple providers: Built-in support for Qwen, Moonshot, GLM, and custom providers
  • Configuration persistence: Settings saved across terminal sessions
  • Easy to use: Simple command-line interface
  • No dependencies: Single binary with no external dependencies

Platform-Specific Behavior

Feature macOS/Linux Windows
Basic Mode Direct binary Direct binary
Immediate Effect Mode Optional shell function Optional shell function
Environment Variables Next session (basic) or Immediate (shell function) Next session (basic) or Immediate (shell function)
Configuration .zshrc/.bashrc .zshrc/.bashrc
Installation ./unix/install-mac.sh ./windows/install-user.sh

Built-in Providers

  • qwen: 阿里云百炼 (Dashscope)
  • k2: Moonshot AI
  • glm: 智谱 AI (Big Model)

Installation

macOS/Linux

# User-level installation (recommended)
./unix/install-mac.sh

# System-level installation (requires sudo)
./unix/install.sh

# Manual installation
make build
mkdir -p ~/.local/bin
cp ccc ~/.local/bin/
export PATH="$HOME/.local/bin:$PATH"

Post-Installation Setup

After installation, configure your shell for immediate environment variable effects:

  1. Basic Mode: Environment variables take effect in the next terminal session
  2. Immediate Effect Mode: Configure shell functions for instant changes

For detailed shell function configuration, see SHELL_SETUP.md.

Windows

# User-level installation with shell function wrapper
./windows/install-user.sh

# System-level installation
./windows/setup.sh

Usage

# Initialize configuration
ccc init

# List available providers
ccc list

# Switch provider
ccc qwen
ccc k2
ccc glm

# Add custom provider
ccc add my-provider https://api.example.com

# Show version
ccc version

# Show shell information (macOS/Linux)
ccc shell

Configuration

The tool stores configuration in ~/.cc-switch-config and updates shell configuration files:

  • macOS/Linux: ~/.zshrc or ~/.bashrc
  • Windows: ~/.zshrc or ~/.bashrc (WSL)

Environment variables set:

  • ANTHROPIC_AUTH_TOKEN
  • ANTHROPIC_BASE_URL
  • ANTHROPIC_MODEL (optional)

Development

Build

make build                # Build for current platform
make build-macos-universal # Build universal macOS binary
make clean                # Clean build artifacts

Test

./unix/verify-install.sh  # Verify installation
ccc list                  # Test basic functionality
ccc shell                 # Show shell information

Architecture

ccc/
├── main.go          # Core Go application
├── Makefile         # Build configuration
├── CLAUDE.md        # Developer documentation
├── README.md        # User documentation
├── unix/            # Unix-specific scripts
│   ├── install-mac.sh
│   ├── install.sh
│   └── verify-install.sh
└── windows/         # Windows-specific scripts
    ├── install-user.sh
    └── setup.sh

License

This project is licensed under the MIT License.

About

用于claude code的集成灵活切换工具

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published