Skip to main content
Lava Gateway is a transparent proxy that sits between your application and AI providers. It gives you access to 30+ providers through a single integration with zero markup — you pay exactly what providers charge.

Architecture

Lava operates as a transparent proxy between your application and AI providers. It sits in the middle of API requests, adding usage tracking and monetization without changing the developer experience.
Lava adds less than 20ms of latency to your AI requests through edge computing and Redis caching.

What Happens on Every Request

  1. Authorize — Lava validates the forward token and checks account balance
  2. Route — Lava strips its own auth headers and forwards the request to the target provider
  3. Respond — The provider processes the request and returns a response. For streaming requests, Lava passes SSE events through in real time
  4. Log — After the response is returned, Lava asynchronously records token counts, costs, provider, model, and any custom metadata
  5. Bill — Lava deducts usage costs from the relevant account balances

Why Use the Gateway

Fund your Lava account and start making requests to any supported provider — no need to sign up for OpenAI, Anthropic, Google, or any others:
  • Zero markup: you pay exactly what providers charge, at cost
  • One integration: swap the provider URL to switch between 30+ providers without managing separate accounts or API keys
  • Automatic tracking: every request is logged with token counts, costs, and model metadata
  • Monetize integration: charge customers per-request with balance checks, usage-based billing, and autopay — no extra infrastructure needed
Alternatively, bring your own provider keys (BYOK) if you already have provider accounts. Both modes work through the same proxy interface.

Two Modes: Track and Monetize

The gateway supports two levels of integration depending on whether you’re tracking your own usage or billing customers. Track your own usage — Use your self forward token (found in Gateway > Secrets) to route requests through Lava. You get usage tracking, cost logging, and provider switching. Costs are charged to your own Lava wallet. Charge customers — Generate forward tokens that include a customer’s connection_id and a meter_slug. Lava automatically checks the customer’s balance before forwarding, deducts usage costs after the response, applies your meter’s pricing, and triggers autopay if their balance runs low. See Quickstart: Charge Customers for the monetization setup flow.

Next Steps