A TUI-based Claude Code configuration profile switcher
Project description
Claude Profile Switcher
English
A profile manager for Claude Code configurations. Easily switch between different API providers and model configurations via TUI or command line.
Features
- TUI Interface: Interactive terminal UI for managing profiles
- CLI Commands: Quick profile switching and launching from command line
- Support for multiple API providers (Anthropic, OpenAI-compatible, etc.)
- Add, edit, and delete custom profiles
- View current active configuration
- Auto-save after editing each field
- Model overrides for haiku, sonnet, and opus
Installation
Install from source
# Clone the repository
git clone https://github.com/junity/claude-profile-switcher.git
cd claude-profile-switcher
# Install in editable mode (for development)
pip install -e .
# Or install normally
pip install .
Build and install from wheel
# Build the package
pip install build
python -m build
# Install the built wheel
pip install dist/claude_profile_switcher-0.1.0-py3-none-any.whl
Usage
TUI Interface
Launch the interactive TUI interface:
claude-profile
Controls:
| Key | Action |
|---|---|
w / ↑ |
Navigate up |
s / ↓ |
Navigate down |
Enter |
Switch to selected profile |
→ / e |
Edit profile |
a |
Add new profile |
d |
Delete profile |
Esc / ← / q |
Go back / Quit |
Command Line Interface
List all profiles:
claude-profile list
# or using short form
claude-profile ls
# or
claude-profile show
Switch to a specific profile:
claude-profile switch my-profile
# or using short form
claude-profile s my-profile
Switch to a profile and launch claude-code:
claude-profile launch my-profile
# or using short form
claude-profile l my-profile
View help:
claude-profile --help
claude-profile switch --help
Configuration
Profiles are stored in ~/.config/claude-profile-switcher/profiles.json
Profile Fields
Each profile contains:
| Field | Required | Description |
|---|---|---|
name |
Yes | Profile name (unique identifier) |
base_url |
No | API base URL (e.g., https://api.anthropic.com) |
api_key |
No | API key for authentication |
haiku_model |
No | Custom model name for Haiku |
sonnet_model |
No | Custom model name for Sonnet |
opus_model |
No | Custom model name for Opus |
Optional fields can be left empty to use Claude Code defaults.
Example Profiles
Anthropic (default)
{
"name": "anthropic",
"base_url": "https://api.anthropic.com",
"api_key": "sk-ant-..."
}
OpenAI-compatible
{
"name": "openai-compatible",
"base_url": "https://api.openai.com/v1",
"api_key": "sk-...",
"haiku_model": "gpt-4o-mini",
"sonnet_model": "gpt-4o",
"opus_model": "o1-preview"
}
Local LLM (e.g., LM Studio, Ollama)
{
"name": "local",
"base_url": "http://localhost:1234/v1",
"api_key": "not-needed",
"haiku_model": "local-model-small",
"sonnet_model": "local-model-medium",
"opus_model": "local-model-large"
}
License
MIT License
简体中文
Claude Code 配置文件管理器。通过 TUI 或命令行轻松切换不同的 API 提供商和模型配置。
功能特性
- TUI 界面:交互式终端 UI 管理配置文件
- 命令行工具:快速切换配置和启动 Claude Code
- 多 API 提供商支持:Anthropic、OpenAI 兼容接口等
- 增删改查:添加、编辑、删除自定义配置
- 查看当前配置:显示当前激活的配置
- 自动保存:编辑字段后自动保存
- 模型覆盖:支持自定义 haiku、sonnet、opus 模型
安装
从源码安装
# 克隆仓库
git clone https://github.com/junity/claude-profile-switcher.git
cd claude-profile-switcher
# 开发模式安装(可编辑)
pip install -e .
# 或正常安装
pip install .
从 wheel 文件安装
# 构建包
pip install build
python -m build
# 安装构建好的 wheel
pip install dist/claude_profile_switcher-0.1.0-py3-none-any.whl
使用方法
TUI 界面
启动交互式 TUI 界面:
claude-profile
按键说明:
| 按键 | 功能 |
|---|---|
w / ↑ |
向上导航 |
s / ↓ |
向下导航 |
Enter |
切换到选中的配置 |
→ / e |
编辑配置 |
a |
添加新配置 |
d |
删除配置 |
Esc / ← / q |
返回 / 退出 |
命令行
列出所有配置:
claude-profile list
# 或使用短格式
claude-profile ls
# 或
claude-profile show
切换到指定配置:
claude-profile switch my-profile
# 或使用短格式
claude-profile s my-profile
切换配置并启动 claude-code:
claude-profile launch my-profile
# 或使用短格式
claude-profile l my-profile
查看帮助:
claude-profile --help
claude-profile switch --help
配置文件
配置文件存储在 ~/.config/claude-profile-switcher/profiles.json
配置字段
每个配置包含:
| 字段 | 必填 | 说明 |
|---|---|---|
name |
是 | 配置名称(唯一标识符) |
base_url |
否 | API 基础 URL(如 https://api.anthropic.com) |
api_key |
否 | API 认证密钥 |
haiku_model |
否 | 自定义 Haiku 模型名称 |
sonnet_model |
否 | 自定义 Sonnet 模型名称 |
opus_model |
否 | 自定义 Opus 模型名称 |
可选字段留空将使用 Claude Code 默认值。
配置示例
Anthropic(默认)
{
"name": "anthropic",
"base_url": "https://api.anthropic.com",
"api_key": "sk-ant-..."
}
OpenAI 兼容接口
{
"name": "openai-compatible",
"base_url": "https://api.openai.com/v1",
"api_key": "sk-...",
"haiku_model": "gpt-4o-mini",
"sonnet_model": "gpt-4o",
"opus_model": "o1-preview"
}
本地 LLM(如 LM Studio、Ollama)
{
"name": "local",
"base_url": "http://localhost:1234/v1",
"api_key": "not-needed",
"haiku_model": "local-model-small",
"sonnet_model": "local-model-medium",
"opus_model": "local-model-large"
}
许可证
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file claude_profile_switcher-0.1.0.tar.gz.
File metadata
- Download URL: claude_profile_switcher-0.1.0.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ecd7b8034d4ec98dc3a5a120841a7ed1bd30e8938889fad210519ba9dc5f2ccb
|
|
| MD5 |
fd99cbb20ae8cbae26528f3750a4d914
|
|
| BLAKE2b-256 |
a5c11eafeede260eb69e0d0d698d77717ac6da077d3206162ab6fc2f5c2a8e1a
|
File details
Details for the file claude_profile_switcher-0.1.0-py3-none-any.whl.
File metadata
- Download URL: claude_profile_switcher-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4fe99f2c0ba638c1eb825aaeb2db56df7cc1b4c167518770bc86e836692e3217
|
|
| MD5 |
6b843a70b1e44156610b93afc264ecfc
|
|
| BLAKE2b-256 |
4f9d19b5d688d7930fdd09d61be448758f05004dd14814c668328238928c3696
|