Gateway routing is for AI providers specifically. If you’re billing for non-AI usage (APIs, compute, storage, etc.), use Path 2: Post-Request + Billing.
The timing difference
With Path 2 (report usage), billing happens after the request. The operation already ran. You’re telling Lava about it retroactively. With Path 1 (route through Lava), billing happens during the request. We see it before it runs, while it streams, and after it completes. That timing difference matters.What you get with gateway routing
Block requests when customers are out of credits
With gateway routing: Customer exhausted their plan and hit their card limit. They try to make a request. Lava rejects it before it reaches OpenAI, Claude, or Gemini. No wasted API call. With post-request reporting: The request already ran. You’re out the provider cost for a customer who can’t pay.Enforce usage limits automatically
With gateway routing: You can set hard limits. Customer hits 100,000 tokens, requests stop. No code on your end. With post-request reporting: You’d have to check usage before every request and handle race conditions yourself.Know if a customer can afford an operation before running it
With gateway routing: Before an expensive agent loop, check if they have budget. Show “please upgrade” if not. With post-request reporting: You find out after you’ve already burned provider costs.One source of truth
With gateway routing: The request that hit the provider is the same request that generated the billing record. Nothing to reconcile. With post-request reporting: You have provider logs and Lava records. If they don’t match, you’re debugging two systems.Works across all providers
With gateway routing: Same billing flow whether you’re calling OpenAI, Claude, Gemini, Mistral, or any of 20+ supported providers. One integration, all providers metered the same way. With post-request reporting: You’re extracting usage data from each provider’s response format and normalizing it yourself.When post-request reporting makes sense
- You’re billing for non-AI usage (APIs, compute, storage, etc.)
- You’re deeply integrated with provider SDKs and can’t change the request path
- You need a provider Lava doesn’t proxy yet
- You want billing without touching request code