/AI token caps

Rules and limits

AI token caps

Allowed AI models and a daily budget, in tokens or dollars.

Set dailyTokens to cap what a key can spend on AI, for example 2000000 tokens a day. We count tokens rather than dollars because prices change and differ by model; tokens are what every provider reports. Vallkey reads the usage each response reports, including streamed ones. For OpenAI, Groq and xAI streaming chat completions, it asks for usage with stream_options.include_usage, which adds a final chunk with empty choices.

Usage is only known when a response finishes, so the request that crosses the cap completes and the next one is refused with 429. Combine the cap with allowedModels to keep each request cheap.

Still have a question?

We read every email, usually within a day.

Contact support