Claude Code Mux is an AI routing proxy that automatically routes requests to the best available AI provider. It supports 15+ providers, including Anthropic, OpenAI, and Cerebras. It is built in Rust for high performance and includes automatic failover and priority-based routing. Operations teams use it to ensure reliable AI service delivery.
git clone https://github.com/9j/claude-code-mux.githttps://github.com/9j/claude-code-mux
["1. **Install Rust**: Ensure you have Rust installed on your system. You can install it using the following command:\n\n```bash\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n```\n\n2. **Clone the Repository**: Clone the Claude Code Mux repository from GitHub:\n\n```bash\ngit clone https://github.com/yourusername/claude-code-mux.git\ncd claude-code-mux\n```\n\n3. **Build the Project**: Build the project using Cargo:\n\n```bash\ncargo build --release\n```\n\n4. **Configure the Proxy**: Create a `config.toml` file in the root directory and specify your primary and fallback providers, priority criteria, and endpoints.\n\n5. **Run the Proxy**: Start the proxy server:\n\n```bash\n./target/release/claude-code-mux\n```\n\n6. **Test the Setup**: Use a tool like `curl` to send a request to the proxy and verify that it routes to the correct provider based on your configuration."]
Automatically route AI requests to the best available provider based on task type.
Implement fallback mechanisms to ensure continuous service during provider outages.
Utilize multiple AI models in a single session for diverse task handling.
Stream real-time responses from various AI providers for enhanced user interaction.
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/9j/claude-code-muxCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
I need to set up Claude Code Mux to route requests to the best available AI provider. My primary provider is [PRIMARY_PROVIDER], but I want to use [FALLBACK_PROVIDER] as a backup. My priority is [PRIORITY_CRITERIA]. Can you provide the configuration steps and sample code?
To set up Claude Code Mux for routing requests to the best available AI provider, follow these steps:
1. **Installation**: First, ensure you have Rust installed on your system. Then, clone the Claude Code Mux repository and build the project using `cargo build --release`. This will compile the Rust code and generate the executable.
2. **Configuration**: Create a configuration file named `config.toml` in the root directory. Here is a sample configuration:
```toml
[providers]
primary = "Anthropic"
fallback = "OpenAI"
[priority]
criteria = "cost"
[endpoints]
primary_endpoint = "https://api.anthropic.com/v1/complete"
fallback_endpoint = "https://api.openai.com/v1/completions"
```
3. **Running the Proxy**: Start the proxy by running the executable generated in the first step. Use the command `./target/release/claude-code-mux`. This will start the proxy server on the default port 8080.
4. **Testing the Setup**: To test the setup, you can use a tool like `curl` to send a request to the proxy. For example:
```bash
curl -X POST http://localhost:8080/v1/completions \
-H "Content-Type: application/json" \
-d '{"prompt": "What is the capital of France?", "max_tokens": 5}'
```
The proxy will route the request to the primary provider, and if it fails, it will automatically switch to the fallback provider based on the priority criteria specified in the configuration file.AI for humanity, built with safety first
Your one-stop shop for church and ministry supplies.
Automate your browser workflows effortlessly
We create engaging workshops for companies and private events centred around plants, flowers and all things botanical.
AI assistant built for thoughtful, nuanced conversation
Advanced foundation models via API and ChatGPT
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan