Skip to main content

ai-switch

A small, secure command-line profile switcher for Codex and Claude Code. It works on headless servers and does not require administrator privileges.

Install

Install from PyPI (recommended):

python3 -m pip install --user ai-switch-cli

For a system or virtual-environment install:

pip install ai-switch-cli

Install the latest development version directly from GitHub:

python3 -m pip install --user "git+https://github.com/ZidongS/ai-switch.git"

Or install a local checkout:

python3 -m pip install --user .

If ai-switch is not found afterwards, add the user script directory to PATH:

export PATH="$HOME/.local/bin:$PATH"

Quick start

Save the configuration currently in use:

ai-switch init default --description "Default daily configuration"

Edit ~/.codex/config.toml and ~/.claude/settings.json for another provider, then save that configuration as a second profile:

ai-switch init glm --description "GLM Coding Plan"
ai-switch list
ai-switch use glm
ai-switch current

Create a profile through an interactive prompt (no editor required; API keys are hidden while typing). Choose the built-in glm preset to generate the complete ZAI Codex Responses configuration, Codex model catalog, and Claude Code model/environment mappings automatically. The deepseek preset creates the three DeepSeek model entries, including image input metadata for deepseek-v4-flash-vision-exp, plus the recommended Claude Code mappings:

ai-switch add

Update an existing profile description:

ai-switch describe default "Default daily configuration"

list shows the active marker, profile name, configured clients, description, detected models, and endpoint hostnames. API keys are never printed.

Safety and storage

Before activation, the current Codex and Claude files are backed up under ~/.config/ai-switch/backups/. Profiles are stored under ~/.config/ai-switch/profiles/; directories use mode 700 and files use mode 600. Restart claude or codex after switching so the process reloads its configuration.

Set AI_SWITCH_HOME to use a different profile directory.

Commands

ai-switch init NAME [-d DESCRIPTION]  Save current files as a new profile
ai-switch list                         List profiles and configuration summaries
ai-switch use NAME                    Back up and activate a profile
ai-switch current                     Print the active profile
ai-switch describe NAME TEXT          Set a profile description
ai-switch add                          Create a profile interactively (GLM, DeepSeek, or custom)
ai-switch --help                      Show full usage and examples

Development

python3 -m unittest -v

The project uses only the Python standard library.

Release files for ai-switch-cli 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-switch-cli 0.1.1
File Size Uploaded
ai_switch_cli-0.1.1.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ai-switch-cli 0.1.1
File Interpreter ABI Platform
ai_switch_cli-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 13.9 kB

Release files / ai_switch_cli-0.1.1.tar.gz

Download URL ai_switch_cli-0.1.1.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fac30a3ba603f87d640d1b08ee376136937f701155702f8cba9706fe96bf25a6
BLAKE2b-256 checksum
How to use checksums
367bb3554cecbd77eab2db80bf586b68f2ef457e4fc3e1bf2af492d5b1840a24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.9

Release files / ai_switch_cli-0.1.1-py3-none-any.whl

Download URL ai_switch_cli-0.1.1-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
666f8137d462ae7f009b13bead5351655af568b077707ea63c79354d9a2a331b
BLAKE2b-256 checksum
How to use checksums
87d669779fa47696d861b3686528f35908155a9ee13569f22506e87db107ba51
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.9

Release history Release notifications | RSS feed

0.5.0

2 release files

0.3.2

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.1.2

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page