Skip to content

Inasayang/chcc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CHCC - Change Claude Code API

A command-line tool for managing Claude Code API configurations with automatic environment variable management.

Installation

go install github.com/Inasayang/chcc@latest

Quick Start

  1. Add your first Claude Code API configuration:

    chcc add -n "Official" -u "https://api.anthropic.com" -t "sk-your-anthropic-api-key"
  2. 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"
  3. List all Claude Code API configurations:

    chcc list
    # or simply
    chcc
  4. Switch to a different configuration:

    chcc set-default -n "Proxy"
  5. Remove a configuration:

    chcc remove -n "Old-Config"

Commands

add - Add or update an API site

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"

list - List all API sites

chcc list
# or
chcc

set-default - Set default API site

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

remove - Remove an API site

chcc remove -n <name>

Environment Variables

CHCC automatically manages these environment variables:

  • ANTHROPIC_BASE_URL: The base URL of the selected API site
  • ANTHROPIC_AUTH_TOKEN: The authentication token for the selected API site
  • ANTHROPIC_MODEL: The model to use (only set if configured for the site)

Dependencies

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Change Claude Code API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages