Usage & billing
Per-request usage ships in every response — bill from it with confidence. Balance snapshot available via GET /v1/dashboard/balance.
Per-request usage
Every /v1/messages response includes a usage object with token counts:
{
"usage": {
"input_tokens": 48,
"output_tokens": 92,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0
}
}For chat-completions, the same numbers appear as prompt_tokens, completion_tokens and total_tokens.
Key balance — GET /v1/dashboard/balance
This endpoint returns only your API-AI balance; provider quotas and capacity are never exposed.
Authorization: Bearer mdf-... header (unlike /v1/messages which also accepts x-api-key). Available on host api-ai.app/dashboard.curl -H "Authorization: Bearer mdf-YOUR_KEY" \
https://api-ai.app/v1/dashboard/balanceResponse 200 OK:
{
"object": "balance",
"balance_usd": 54.77,
"expires_at": "2026-07-29T19:00:00Z",
"is_active": true,
"last_synced_at": "2026-06-29T19:52:00Z"
}balance_usd— current customer-facing API-AI balance.expires_at— key expiry (ISO 8601 UTC,nullif no expiry).is_active—falseif key is paused/disabled.last_synced_at— last time we synced with the upstream provider.
Errors: 401 — missing/invalid Authorization: Bearer header; 429 — rate limit exceeded (30 requests per minute per IP). Balance and spend are also visible in the dashboard, or on request at admin@minedom-france.fr.
Effective rates
We bill flat per-1M tokens at the rate published on /pricing. There is no multiplier, no minimum, no rounding. The math is:
cost = (input_tokens / 1_000_000) * rate_in
+ (output_tokens / 1_000_000) * rate_out
+ (cache_read_input_tokens / 1_000_000) * (rate_in * 0.10)
+ (cache_creation_input_tokens / 1_000_000) * (rate_in * 1.25)- Cache reads are billed at 10% of the input rate.
- Cache creation (the first time the upstream stores a cache breakpoint) is billed at 125% of the input rate.
When the balance runs out
At balance_usd ≤ 0 the gateway rejects requests for that key with a 402 billing_error (insufficient_quota) before they ever reach the model. Top up from the Top up your balance page — the credit is added once the payment is confirmed, within 2 hours at most.
Rate-limit (429)
The gateway enforces per-key concurrency and burst rate. When you exceed it, you get a 429 rate_limit_error with a Retry-After header in seconds:
HTTP/1.1 429 Too Many Requests
Retry-After: 2
Content-Type: application/json
{
"type": "error",
"error": {
"type": "rate_limit_error",
"message": "Rate limit exceeded. Retry after 2s."
}
}Honor Retry-After exactly — do not retry sooner. If 429s are chronic, lower client-side concurrency; rate-limited requests do not consume balance.
Per-request usage accuracy
Per-request usage objects sum exactly to the real per-key spend. Verified 2026-05-08 across a 24h sample of 25 845 requests: max delta was <$0.001 (rounding at the 6th decimal). Bill from the per-request usage with confidence.