RelayPlane

An npm-native, drop-in LLM proxy for Node.js — swap in as your OpenAI/Anthropic base URL to get per-request cost tracking, task-aware routing, budget enforcement, and anomaly detection running locally, for free.

186stars
31forks
MIT License
TypeScript

RelayPlane is built specifically for Node.js developers who don’t want to run Docker or Python just to get LLM cost visibility: it installs via npm install and acts as a drop-in replacement for OpenAI and Anthropic base URLs, so tools like Claude Code, Cursor, and OpenClaw work unchanged while every request gets tracked, costed, and routed through configurable logic.

Beyond basic cost tracking across 11 providers, it specifically accounts for Anthropic’s prompt caching (cache read savings, creation costs, true per-request costs) rather than treating cached and uncached requests the same. Task-aware routing supports complexity-based routing, cascading between models, and manual overrides, with a circuit breaker ensuring the agent doesn’t notice if the proxy itself fails.

MIT licensed and entirely local (a dashboard runs at localhost:4100), RelayPlane also includes budget enforcement (daily/hourly/per-request limits with block, warn, downgrade, or alert actions) and anomaly detection, plus a public live savings dashboard aggregating real-time savings data from developers using the open-source proxy worldwide.

What You Get

  • A drop-in npm proxy replacing OpenAI/Anthropic base URLs with no Docker or Python dependency
  • Per-request, cache-aware cost tracking across 11 LLM providers
  • Configurable task-aware routing: complexity-based routing, model cascades, and manual overrides
  • Budget enforcement with daily/hourly/per-request limits and anomaly detection, plus a local dashboard at localhost:4100

Common Use Cases

  • Tracking exactly where LLM spend goes across multiple providers and agents without a hosted observability service
  • Enforcing hard budget limits on AI agent spend to prevent runaway costs
  • Routing simple tasks to cheaper models and complex tasks to stronger ones automatically
  • Getting accurate cost accounting for Anthropic prompt caching instead of treating cached and fresh requests identically

Under The Hood

Architecture RelayPlane runs as a local Node.js proxy process that intercepts requests headed to OpenAI- or Anthropic-compatible base URLs, tracks and costs each one (with specific logic for Anthropic’s prompt-caching cost model), applies configurable routing rules, and serves a local dashboard for reviewing cost and health data — all without a required external service, since the entire proxy runs on the developer’s own machine. A circuit breaker sits in the request path so that a proxy failure fails open rather than blocking the agent’s normal operation.

Tech Stack TypeScript/Node.js, distributed as the @relayplane/proxy npm package, with a local dashboard served on localhost:4100, and integration via standard OPENAI_BASE_URL/ANTHROPIC_BASE_URL environment variables that most AI coding tools already support.

Code Quality Active, consistently maintained commit history and a specific, technically detailed feature (accurate Anthropic prompt-cache cost accounting) suggest close attention to real-world LLM billing nuances rather than a generic cost-estimation approximation; a public live savings dashboard aggregating real usage data adds a layer of externally visible validation.

What Makes It Unique Most LLM proxies require Docker or a Python environment; RelayPlane’s npm-native, zero-infrastructure design specifically targets Node.js developers who want cost tracking and routing without adding a deployment dependency, while its cache-aware cost accounting handles a billing nuance many simpler cost trackers miss entirely.

Self-Hosting

Licensing Model MIT licensed — fully open source with no license key.

Self-Hosting Restrictions Not applicable; the proxy runs entirely locally on the developer’s own machine using their own provider API keys.

License Key Required No.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack

No spam. Unsubscribe anytime.

Join 750+ subscribers
No spam. Unsubscribe anytime.

Search