▲ 5 r/openrouter
I’m using OpenRouter directly via API key in a language model setup (no framework like LangChain, just raw calls).
I ran what I thought was a pretty innocent prompt (basically just asking it to modify a small UI thing in a Flutter admin dashboard), and it somehow burned $0.4787 in one go.
That feels way too high for what I expected.
So my question is:
- How do I set a hard max token limit per request?
- Or better, how do I enforce a cost cap / usage limit per API key in OpenRouter?
- Is there any built-in way to stop runaway token usage, or do I need to handle it client-side only?
Right now I’m just using a normal API key I created in OpenRouter dashboard, nothing fancy.
Any best practices to avoid getting surprised by charges like this would be appreciated.
u/Hungry-Presence-4421 — 18 days ago