@mayank3238/keymux 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # Keymux 🚀
2
+
3
+ **The Local Proxy for Claude Code — Use Claude Code for Free!**
4
+
5
+ 📚 **[Read the Official Documentation](https://keymux-docs.vercel.app/)**
6
+
7
+ Keymux is a lightweight local proxy that lets you use **Claude Code** (CLI, Desktop App, or IDE Extension) without paying for Anthropic credits. It acts as a middleman, intercepting Claude Code's native requests and translating them to use free or cheaper open-source models from providers like Groq, Mistral, OpenRouter, and more.
8
+
9
+ If you have a bunch of free-tier API keys, Keymux will smartly pool them together, balancing the load so you never hit a rate limit while coding.
10
+
11
+ ## 🎯 What Does It Do?
12
+
13
+ - **Native Claude Code Support:** Works seamlessly with the Claude Code CLI, Claude Desktop App, and Claude IDE Extensions.
14
+ - **Smart Vision Router:** Automatically detects image/computer-use requests and forces routing to Vision-enabled free models (like `ling-3.0-flash-vl`) so your coding agent never goes blind.
15
+ - **Multi-Provider Magic:** Automatically translates Anthropic-formatted tool calls (like file edits and bash commands) to work with:
16
+ - ⚡ Groq (LPU)
17
+ - 🧠 Mistral
18
+ - 🌐 OpenRouter
19
+ - 🟢 Nvidia NIM
20
+ - 🔮 Google Gemini
21
+ - **Multi-Key Multiplexing:** Add 5 different API keys for the same provider, and Keymux will balance the traffic across all of them to bypass free-tier rate limits.
22
+ - **Zero-Downtime Failover:** If an API key hits a rate limit (429) mid-request, Keymux silently translates the model name and retries on a different provider before Claude Code even notices.
23
+ - **100% Accurate Tracking:** In-memory tracking precisely monitors your token usage, Requests Per Minute (RPM), and Time-To-First-Token (TTFT) latency without double-counting.
24
+ - **Cyberpunk Terminal Dashboard:** Run `keymux -d` to see a beautiful, live-updating TUI (Terminal UI) showing your active keys, network latency, missing API key warnings, and routing stats.
25
+
26
+ ## 🧠 How It Routes Traffic (The Smart Selection)
27
+
28
+ Keymux doesn't just pick keys randomly. It uses a **Smart TTFT (Time To First Token)** algorithm:
29
+ 1. **Speed First:** It constantly pings your providers to check their latency.
30
+ 2. **Fast Pool:** It groups all keys that respond within a +100ms tolerance band.
31
+ 3. **Least Utilized:** From that fast pool, it picks the key that has been used the *least* recently (Lowest RPM).
32
+ 4. **Result:** You always get the fastest response without burning out a single API key.
33
+
34
+ ---
35
+
36
+ ## 🛠️ Installation & Setup
37
+
38
+ ### 1. Build and Link
39
+ Clone the repository and link it globally so you can run the `keymux` command anywhere.
40
+ ```bash
41
+ git clone https://github.com/Mayank332k/keymux.git
42
+ cd keymux
43
+ npm install
44
+ npm run build
45
+ npm link
46
+ ```
47
+
48
+ ### 2. Configure Your Keys
49
+ Keymux will automatically create a configuration file at `~/.keymux/config.json`.
50
+ You can add your free-tier API keys for whichever providers you want to use.
51
+
52
+ ### 3. Start the Proxy Daemon
53
+ Start the Keymux local server in the background. It runs locally on port 3002.
54
+ ```bash
55
+ keymux start --port 3002
56
+ ```
57
+ *(To stop it later, just run `keymux stop`)*
58
+
59
+ ### 4. Connect Claude Code
60
+ Tell Claude Code to send its requests to your local Keymux proxy instead of Anthropic's servers.
61
+
62
+ Just open your `.bashrc` or `.zshrc` and add this alias:
63
+ ```bash
64
+ alias free-claude='export ANTHROPIC_API_KEY="dummy-key" && export ANTHROPIC_BASE_URL="http://127.0.0.1:3002/v1" && claude'
65
+ ```
66
+ Now, just type `free-claude` in your terminal, and you're coding for free!
67
+
68
+ ---
69
+
70
+ ## 🖥️ The Dashboard
71
+
72
+ Want to see what's happening under the hood? Run the interactive dashboard:
73
+ ```bash
74
+ keymux -d
75
+ ```
76
+ This will open the TUI where you can monitor API health, change default models, and watch the load balancer in real-time.
77
+
78
+ ---
79
+ *Made for developers who want the Claude Code experience locally, without the enterprise price tag.*