That was the breaking point, but the real problem had been building for a while. I use tools like OpenClaw and Cursor daily, each hitting various AI providers. But I had no idea what each tool was actually costing me. One shared key across everything, no per-tool visibility, no way to cap spend.
So I built AI Spend into Lava. The idea is simple. Create isolated API keys, each with their own:
- Spend limit (daily/weekly/monthly/total) - Model restriction (lock to a specific model or allow any) - Real-time usage tracking - Instant revoke
It works as a transparent proxy. Your tools point to a single OpenAI-compatible endpoint. Lava validates the key, checks the spend limit and model restrictions, then forwards the request to the right provider. Spend is tracked per key per cycle. When a key hits its limit, requests are rejected until the cycle resets. Under the hood it translates requests across 38+ providers (OpenAI, Anthropic, Google, Mistral, DeepSeek, etc.), so anything that works with the OpenAI API works with this. No SDK changes.
Would love to hear how others are handling AI cost control, especially if you're running agents in production.