# claude-code-switche **Repository Path**: open_source_base/claude-code-switche ## Basic Information - **Project Name**: claude-code-switche - **Description**: # claude-switcher 一个灵活的 Claude Code 中转站配置管理工具,用于快速切换不同的 API 配置。 ## 功能特点 - 支持多个中转站配置管理 - 一键切换配置文件 - 备份和恢复配置 - 环境变量管理 - 跨平台支持 - **Primary Language**: Unknown - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-09-02 - **Last Updated**: 2025-11-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # claude-code-switcher [中文](README.md) | English A flexible Claude Code configuration management tool supporting both Web UI and command-line interfaces. ## 🚀 Features ### Web UI Version - 🖥️ **Modern Web Interface** - Responsive design based on Flask - 📁 **Custom Config Path** - Support for any Claude configuration directory - 🔄 **One-Click Config Switching** - Dropdown selection with instant configuration application - 💾 **Multi-Config Management** - Create, edit, and delete multiple settings.json configurations - ✏️ **Real-time Editing** - JSON format validation and syntax highlighting - 🔄 **Auto Backup** - Automatic backup of current configuration when switching - 🌐 **Internationalization** - Support for Chinese and English languages ### Command Line Version - ⚡ **Lightweight & Fast** - No dependencies, run directly - 📝 **Simple Commands** - Intuitive command-line operations - 🔄 **Config Switching** - Quick switching between different configurations - 🌐 **Multi-language Support** - Chinese and English interface ## 📋 Use Cases - 🌐 **Multi-Proxy Switching** - Quickly switch between different API proxy servers - 🔧 **Configuration Testing** - Test performance of different configurations - 🔑 **Multi-API Key Management** - Manage multiple API key configurations - 💾 **Configuration Backup** - Quick backup and restore configurations ## 🚀 Quick Start ### Method 1: Web UI (Recommended) ```bash # Clone the project git clone https://github.com/viaco2ove/claude-code-switche.git cd claude-code-switche # Install dependencies pip install -r requirements.txt # Start Web service python app.py # Access http://localhost:5300 in browser # Start with English interface python app.py --lang en_US # Custom host and port python app.py --lang en_US --host 0.0.0.0 --port 8080 ``` ### Method 2: Command Line ```bash # Run directly python claude-switcher.py help # English interface python claude-switcher.py --lang en_US help # Common commands python claude-switcher.py list # List all configurations python claude-switcher.py save myconfig # Save current configuration python claude-switcher.py use myconfig # Use specified configuration ``` ## 🎯 Web Interface User Guide ### 1. Configuration Path Setup - Enter Claude configuration directory path in the top input box - Default path: `C:\Users\{username}\.claude` - Click "Apply" button to confirm path ### 2. Configuration Management - **View Configs**: View all saved configurations in dropdown - **Apply Config**: Select configuration and click "Apply" for immediate effect - **Save Config**: Click "Save As" after editing to create new configuration - **Delete Config**: Select configuration and click "Delete" ### 3. Real-time Editing - Directly modify settings.json content in the editor - JSON format validation support - Real-time save to current configuration - All saved configurations are stored in .claude-profiles directory ### 4. Language Switching - Click "中文" or "English" buttons in the top-right corner - Language preference is automatically saved in browser - All interface text and messages support bilingual switching ## 📁 File Structure ``` claude-code-switcher/ ├── app.py # Web UI main program ├── claude-switcher.py # Command line version ├── server_config.json # Server configuration file ├── locales/ # Internationalization files │ ├── zh_CN.json # Chinese translations │ └── en_US.json # English translations ├── templates/ │ └── index.html # Web interface template ├── requirements.txt # Python dependencies ├── README.md # Chinese documentation ├── README_EN.md # English documentation └── .gitignore # Git ignore file ``` ## 🔧 Tech Stack - **Backend**: Python + Flask - **Frontend**: HTML5 + TailwindCSS + Alpine.js - **Icons**: Font Awesome - **JSON Processing**: Python standard library ## ⚙️ Server Configuration The project supports customizing server startup parameters through the `server_config.json` file: ```json { "debug": true, "host": "0.0.0.0", "port": 5300, "language": "zh_CN", "messages": { "startup": "Starting Claude Config Web UI...", "address": "Access URL: http://localhost:5300", "stop_hint": "Press Ctrl+C to stop service" } } ``` ### Configuration Options - `debug`: Enable debug mode - `host`: Server listening address (0.0.0.0 means all interfaces) - `port`: Server port number - `language`: Default interface language (zh_CN/en_US) - `messages`: Custom startup message text If the configuration file doesn't exist, the program will run with default settings. ## ⚙️ Configuration Guide ### Default Config Paths - **Windows**: `C:\Users\{username}\.claude` - **Linux/Mac**: `~/.claude` ### Configuration Files - **settings.json**: Claude's main configuration file - **profiles/**: Directory for saved configuration backups ## 🌐 Internationalization ### Web Interface - Support for Chinese and English switching - Real-time language switching without page refresh - Language preference saved in browser localStorage - Startup language can be set via `--lang` parameter ### Command Line - Support `--lang` parameter for language switching - All help information, error messages, and success prompts support bilingual - Examples: ```bash python claude-switcher.py --lang en_US help python claude-switcher.py --lang zh_CN list ``` ## 🐛 FAQ ### Q: Missing dependencies error on startup A: Run `pip install -r requirements.txt` to install all dependencies ### Q: Cannot access configuration directory A: Ensure the configuration path exists and has read/write permissions ### Q: Configuration switch not taking effect A: Restart Claude client to apply new configuration ### Q: How to change default language? A: Use `--lang en_US` parameter or modify `language` in `server_config.json` ## 🤝 Contributing Issues and Pull Requests are welcome! ## 💖 Support the Project If this project helps you, please consider supporting us: - ⭐ Star this project on GitHub - 🐛 Report bugs and suggest improvements - 📖 Help improve documentation - 💰 Sponsor the project (donation options available in Web UI) ### Donation Methods The project has integrated donation functionality. You can support us through: - **WeChat Pay**: - WeChat Pay QR Code Thank you for your support! ## 📄 License MIT License - See LICENSE file for details ## 🔗 Links - **GitHub**: https://github.com/viaco2ove/claude-code-switche - **Gitee**: https://gitee.com/open_source_base/claude-code-switche --- ### Synchronization The project is successfully synchronized to both platforms: - Gitee: origin (https://gitee.com/open_source_base/claude-code-switche.git) - GitHub: github (https://github.com/viaco2ove/claude-code-switche.git) For future synchronization: - `git push origin master` to push to Gitee - `git push github master` to push to GitHub