Skip to content

simplexforce/clauder-code-model-switcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Switch CC Model - Claude Code Model Switcher

A command-line tool for switching between different Claude Code model configurations.

Overview

This tool allows you to easily switch between different model configurations for Claude Code by updating the ~/.claude/settings.json file with environment variables from JSON configuration files.

Features:

  • Simple model switching between multiple configurations
  • Fast switching using Claude Code's built-in environment variables
  • Works with LLM models that natively support Anthropic API format

Comparison with claude-code-router

Feature switch-cc-model claude-code-router
Switching Speed Instant (environment variables) Slower (needs config file changes)
API Format Support Anthropic API only Anthropic + OpenAI APIs
Configuration Simple JSON files More complex routing rules
Dependencies None (uses Claude Code built-in) Requires proxy service
Resource Usage Minimal Additional service
Setup Complexity Very simple More involved

Choose switch-cc-model if:

  • You need fast switching between Anthropic-compatible models
  • You prefer simple setup and minimal resource usage
  • You want to use Claude Code's built-in configuration system

Choose claude-code-router if:

  • You need OpenAI API compatibility
  • You require advanced routing and transformation features
  • You need more complex model management

Requirements

  • Python 3
  • Claude Code installed
  • sudo access (for installation to /usr/local/bin)

Installation

  1. Clone or download this repository
  2. Run the installation script:
./install.sh

This will:

  • Copy all JSON configuration files to ~/.claude/my-models/
  • Install the switch-cc-model command to /usr/local/bin/

Usage

Basic Usage

# Use default configuration directory (~/.claude/my-models)
switch-cc-model

# Use custom configuration directory
switch-cc-model --config-dir /path/to/your/configs

# Show help
switch-cc-model --help

Adding New Models

This repository includes configurations for GLM and DeepSeek models, but you can add any model that supports the Anthropic API format:

  1. Create a new JSON file in your configuration directory (e.g., your-model.json)
  2. Use the configuration format shown below
  3. The new model will automatically appear in the selection menu

Configuration Files

Configuration files are JSON files with the following structure:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.example.com/anthropic",
    "ANTHROPIC_AUTH_TOKEN": "your-api-key-here",
    "ANTHROPIC_DEFAULT_HAIKU_MODEL": "model-name",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "model-name",
    "ANTHROPIC_DEFAULT_OPUS_MODEL": "model-name",
    "API_TIMEOUT_MS": 600000,
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1
  }
}

Note: The configuration files in this repository have empty ANTHROPIC_AUTH_TOKEN values. When you switch to a configuration with an empty API key, the script will automatically prompt you to enter your API key.

Adding API Keys

When you select a configuration with an empty API key, the script will:

  • Display a yellow warning message
  • Prompt you to enter your API key
  • Ask if you want to save the API key to the configuration file for future use
  • Apply the configuration with your API key

You can cancel the operation at any time by pressing Ctrl-C.

Configuration Directory

  • Default: ~/.claude/my-models/
  • Custom: Use --config-dir flag to specify a different directory

The tool looks for all .json files in the configuration directory and presents them as numbered options.

About

Fast Claude Code model switcher - Instantly switch between multiple LLM configurations with a simple command.

Topics

Resources

License

Stars

Watchers

Forks