Quickly switch between AI API configurations. Supports Anthropic, OpenAI, and other providers with a single command.
mkdir -p ~/.local/lib ~/.config/ai-keys
cp switch-ai.sh ~/.local/lib/
cp profiles.yaml ~/.config/ai-keys/
chmod 600 ~/.config/ai-keys/profiles.yamlAdd to ~/.zshrc:
echo 'source ~/.local/lib/switch-ai.sh' >> ~/.zshrc
echo 'alias ai="switch_ai"' >> ~/.zshrc
source ~/.zshrcEdit ~/.config/ai-keys/profiles.yaml:
aigocode:
ANTHROPIC_BASE_URL: https://api.example.com
ANTHROPIC_AUTH_TOKEN: your-token
ark:
ANTHROPIC_BASE_URL: https://ark.example.com/api
ANTHROPIC_AUTH_TOKEN: your-token
ANTHROPIC_MODEL: ark-code-latestai # interactive profile selection (fzf menu)
ai <profile> # switch directly to a profile
ai show # show current active environment variables
ai clear # clear all AI environment variablesAI API 配置快速切换工具,支持 Anthropic、OpenAI 等多服务一键切换。
mkdir -p ~/.local/lib ~/.config/ai-keys
cp switch-ai.sh ~/.local/lib/
cp profiles.yaml ~/.config/ai-keys/
chmod 600 ~/.config/ai-keys/profiles.yaml在 ~/.zshrc 中添加:
echo 'source ~/.local/lib/switch-ai.sh' >> ~/.zshrc
echo 'alias ai="switch_ai"' >> ~/.zshrc
source ~/.zshrc编辑 ~/.config/ai-keys/profiles.yaml:
aigocode:
ANTHROPIC_BASE_URL: https://api.example.com
ANTHROPIC_AUTH_TOKEN: your-token
ark:
ANTHROPIC_BASE_URL: https://ark.example.com/api
ANTHROPIC_AUTH_TOKEN: your-token
ANTHROPIC_MODEL: ark-code-latestai # 交互式选择 profile(fzf 菜单)
ai <profile> # 直接切换到指定 profile
ai show # 查看当前生效的环境变量
ai clear # 清除所有 AI 环境变量