Every Tchavi API key can now have an expiry date and a spend limit in credits. You hand a key to an intern, a demo or a CI job, and it stops on its own, on the planned date or when the cap is reached.
In short
- Tchavi, an OpenAI-compatible AI API gateway you pay for with mobile money, adds two settings per key: an expiry and a spend limit.
- Expiry: never, 1 hour, 1 day, 3 days, 7 days, 1 month, or a custom date.
- Limit: the maximum number of credits the key can spend over its whole lifetime.
- At the cap, the request gets a 403
key_spend_limit_reachederror.
Expiry
In the key creation form, the Expiration field offers: Never, 1 hour, 1 day, 3 days, 7 days, 1 month and Custom date. A date in the past is refused. With Never, the key works until you revoke it.
Past the date, the key returns 403 key_inactive with details.status: "EXPIRED". In your key list it shows as Expired, even before its next use, and it no longer counts toward the maximum number of keys for your tier.
Spend limit
The Spend limit field is a number of credits. Leave it empty for no limit. It accepts up to 3 decimals. As a rough guide at October 2026 rates, a limit of 3,000 credits is about KES 227.
How it works: each request first reserves its estimated cost. If that reservation does not fit in what the key has left, the request is refused with a 403 error:
{
"error": "key_spend_limit_reached",
"message": "…",
"statusCode": 403
}
It is a 403 and not a 402, because a top-up would change nothing: the key is capped, not your balance. The error also shows the limit, what the key has already spent, what is left and what the request asked for.
Changing the limit
The key list shows each key's spend against its limit (for example "120 of 3,000") and its expiry. When a key reaches its limit, it is marked Limit reached. You can raise the limit, lower it or remove it from the dashboard; what the key has already spent is kept.
What to watch
Streaming can overshoot a little. A streaming request reserves its estimated cost at the start. If the final cost is higher, the difference is still billed: a key can end slightly above its limit. Conversely, because each request holds its estimate until it finishes, a key can stop a little before its cap. Leave a small margin.
The cap is cumulative. It covers the whole lifetime of the key, not a day or a month.
Three concrete uses
- An intern or a contractor: a key with 1,500 credits (about KES 114), expiring in 7 days.
- A client demo: a 1-hour key, capped at a few hundred credits.
- A CI job: a long-lived but capped key, so the job cannot drain your balance.
I give these figures as starting points to adjust. To see a real case, read how to use Claude Code with a capped key.
How to try it
- Open the API keys page of your dashboard.
- Create a key: choose the expiry and enter the limit.
- Read the Expiry and spend limit section of the documentation.
FAQ
Is a refused request billed?
No: the request is not served, so nothing is charged.
What do I do when a key reaches its limit?
Raise the limit from the key list, or create a new key. The key works again right after the change.
Can I cap a key that already exists?
Yes: the key list offers Spend limit for an active key.
create your account and top up KES 250
This article is part of the series "Building an AI product from Africa". Tchavi is an OpenAI-compatible AI API gateway: one key gives access to over 100 text, image, audio and video models, and you pay for it with mobile money, no bank card (countries and operators). More guides on the blog. Follow us: LinkedIn and X.