Every tenant is billed one of two ways for POST /v1/ai/complete, decided
automatically per request — you never choose it in the request itself:
A tenant can switch between the two at any time from their dashboard — saving a BYOK key switches you to BYOK immediately; clearing it switches you back to metered billing.
Metered requests are priced in Kenyan shillings (KES) from real token
usage, not an estimate. The gateway reads the actual input_tokens and
output_tokens Anthropic reports for your completion and prices them
separately, because providers bill them very differently:
cost = input_tokens / 1,000 × input rate
+ output_tokens / 1,000 × output rate
The current rates are on the Pricing page, which always shows
the live numbers. For example, at KES 1.00 per 1,000 input tokens and
KES 5.00 per 1,000 output tokens, a request with 1,000 input and 500
output tokens costs 1.00 + 2.50 = KES 3.50. Costs aren't rounded per
request: a short prompt might cost "cost": "0.0457" (KES), and your
balance reflects exactly that.
Rates can change, but never retroactively. A new rate is always scheduled with a future effective date (announced on Pricing), and a request is priced at the rate in effect when it started. Each charge in your ledger records the rate that priced it, so past charges never change.
Before a metered request is sent to Anthropic at all, the gateway checks
that your balance can cover at least the smallest plausible exchange (one
input token, one output token) — if it can't, you get 402 Payment Required immediately (see Endpoint Reference), with no
Anthropic call made. This is a floor, not an exact pre-authorization: the
real cost isn't known until Anthropic's response comes back with actual
usage numbers, so it's possible for a large response to leave your
balance slightly negative afterward. A subsequent request is still
checked against that same floor as normal.
A BYOK-configured tenant's response always has "used_byok_key": true and
"cost": "0", and "balance_after" simply reports your current balance,
unchanged by the request — there's nothing to deduct, since you paid
Anthropic directly with your own key. See
Getting Started for a real example of both
response shapes side by side.