What is keymesh?
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.
What is keymesh used for?
API key rotation, rate-limit failover, circuit breaking for LLM APIs, multi-key pool management, Node.js LLM infrastructure
How much does keymesh cost?
Paid
No paid tiers published — visit the GitHub repository for current status
Pros and 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 about keymesh
What is Keymesh?
Keymesh is a zero-dependency Node.js library that manages a pool of API keys for LLM providers (OpenAI, Anthropic, Gemini). It automatically rotates to a healthy key when one hits a rate limit, uses a circuit breaker to sideline failing keys, and retries with exponential backoff — all transparently, without changing your existing SDK call syntax.
Is Keymesh free?
Yes. Keymesh is released under the Apache-2.0 open-source license and is free to install via npm (pnpm add @takk/keymesh). There are no paid tiers or subscription fees.
How does Keymesh handle API key rotation?
Keymesh wraps your existing SDK client through a deep proxy. On each request it picks an eligible key using a pluggable selection strategy (e.g. least-used). If the key returns a 429 or other transient error, Keymesh immediately retries on the next eligible key. After a configurable number of consecutive failures, the key's circuit opens for a cooldown period, then re-enters half-open to test recovery automatically.
Which AI providers does Keymesh support?
At v1.0.0, Keymesh ships named adapters for OpenAI, Anthropic, and Google Gemini SDKs. It also includes a generic HTTP adapter that works with any provider exposing an HTTP API.
Keymesh vs. manual retry logic?
Manual retry logic typically re-hits the same failing key, causing cascading timeouts and on-call pages. Keymesh automatically routes retries to a different key, respects upstream Retry-After headers, applies full-jitter exponential backoff, and self-heals without engineer intervention — as demonstrated by the library's own live integration test trace against the Google Gemini API.
What are the best alternatives to keymesh?
Reviews
Sign in to rate and review keymesh.
Sign in to reviewNo reviews yet. Be the first to review keymesh!
