Overview / Description
Keymesh is an AI API key management tool that handles automatic key rotation, rate-limit failover, and circuit breaking for Node.js applications calling OpenAI, Anthropic, or Gemini. Developers who integrate multiple LLM APIs frequently encounter 429 rate-limit errors that cause user-facing failures and on-call alerts. Keymesh solves this by maintaining a pool of API keys and transparently routing each request to an eligible key — no changes to existing call syntax required.
The library uses a per-key circuit breaker with a closed → open → half-open state machine. When a key accumulates a configurable number of consecutive failures (default: 3), the circuit opens and that key is sidelined for a cooldown period (default: 30 seconds). After the cooldown, keymesh places the key back into half-open state, sends one trial request, and closes the circuit on success. Retry logic uses AWS-style full-jitter exponential backoff with a total time budget and respects upstream Retry-After headers. The pool supports pluggable selection strategies — including least-used — so load is distributed evenly across keys.
Keymesh ships as a zero-runtime-dependency npm package (@takk/keymesh) with adapters for the official OpenAI, Anthropic, and Google Gemini SDKs, plus a generic HTTP adapter for any endpoint. It emits eight telemetry events (key.rotated, circuit.closed, etc.) so teams can pipe rotation signals into existing loggers or observability stacks. The package ships with 145 passing tests at 93% line coverage and includes SLSA provenance attestation. It is licensed under Apache-2.0.
Best for: Node.js developers and backend teams who run high-throughput LLM workloads across multiple API keys and need silent rate-limit recovery without custom retry infrastructure.
Used For
API key rotation, rate-limit failover, circuit breaking for LLM APIs, multi-key pool management, Node.js LLM infrastructure
Pricing
Pros & Cons
Pros
- Zero runtime dependencies — install @takk/keymesh with no transitive packages bloating production builds
- Per-key circuit breaker with closed → open → half-open state machine automatically re-enables keys after cooldown, no manual intervention
- Drop-in replacement: wraps existing OpenAI, Anthropic, and Gemini SDK clients via deep proxy — call signatures stay identical
- Eight built-in telemetry events (key.rotated, circuit.closed, etc.) integrate with existing logging and observability pipelines
- 145 passing tests at 93% line coverage with SLSA provenance attestation for supply-chain security
Cons
- Node.js only — no Python, Go, or other runtime support at v1.0.0
- Pricing not published — open-source Apache-2.0 library but enterprise support terms are unknown
- State persistence is pluggable but requires custom implementation; no built-in Redis or database adapter ships out of the box
- Early release (v1.0.0) — production stability across edge cases is not yet battle-tested at scale
Questions & Answers
Alternatives
Portkey AI, LiteLLM, OpenRouter, Helicone