Skip to main content
Lava Gateway is a transparent proxy that sits between your application and AI providers. It gives you access to 285+ providers through a single integration with zero markup — you pay exactly what providers charge.
New to Lava? Start with the Track Your First Request quickstart for a step-by-step tutorial. This page explains how the gateway works under the hood.

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 cost logging 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 your secret key or 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 your wallet balance

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 285+ providers without managing separate accounts or API keys
  • Automatic tracking: every request is logged with token counts, costs, and model metadata
Alternatively, use unmanaged (bring your own key): supply your own provider API key in the forward token; Lava still meters usage and can charge a service fee. Both managed and unmanaged work through the same proxy interface.

Track Your Own Usage

Pass your secret key directly in the Authorization header to route requests through Lava. You get usage tracking, cost logging, and provider switching. Costs are charged to your Lava wallet, and no token generation is needed. To bring your own provider key, send a forward token instead, as described in Forward Proxy & Authentication. To review what you sent, list your requests with the Requests API or lava.requests.list() in the Node.js SDK. Each request records its provider, model, token counts, and cost.

Next Steps

Quickstart: Track Usage

Route your first AI request through Lava in under 5 minutes

Forward Proxy Guide

Forward tokens, URL construction, error handling, and provider examples

Supported Providers

Full list of 285+ AI providers with base URLs and capabilities

Node.js SDK

Route requests, list your usage, and manage keys from Node.js