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 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 bairuo --description "Bairuo relay for daily work"

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 bairuo "Bairuo relay for daily work"

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.0

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.0
File Size Uploaded
ai_switch_cli-0.1.0.tar.gz 6.7 kB Details

Built distribution (wheel)

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

Total release size: 13.8 kB

Release files / ai_switch_cli-0.1.0.tar.gz

Download URL ai_switch_cli-0.1.0.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c0d2763aefca243351cededcad705f50a446e51daeb23ae61358ee6344659937
BLAKE2b-256 checksum
How to use checksums
3a6f7fbac73858842ee149cccaa6c80556f93d91c601b514d4f2ef2ae2907ca0
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.0-py3-none-any.whl

Download URL ai_switch_cli-0.1.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
011f48d4582ac148928cdec67239318e87267b4b5b978e7f66babe02e4ab9619
BLAKE2b-256 checksum
How to use checksums
a66fa9b7c6ddc640197c0d95edc22d76fc8e7c04f6091804125a4a18139e9a34
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

0.1.1

2 release files

This release

0.1.0 This release

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