Credits
We charge for work performed, not for HTTP status. The upstream says how much.
Each endpoint has a fixed integer price. The gateway reserves that many credits before calling the upstream. The upstream returns X-FlashAPI-Bill with the credits to charge. The gateway commits that amount and refunds the rest.
Billing directive#
| Directive | Meaning |
|---|---|
X-FlashAPI-Bill: 1 | Charge 1 credit. Work was done, including some 404s. |
X-FlashAPI-Bill: 0 | Charge nothing. No upstream work (malformed input, cache, or a crash). |
| Header absent | Fallback: charge full price on 2xx only. 4xx/5xx are free unless billed explicitly. |
Responses include X-Credits-Charged and X-Credits-Remaining. You cannot spoof the bill header: inbound X-FlashAPI-* is stripped.
Hard stop#
If the reserved balance cannot cover
price, the gateway returns 402 INSUFFICIENT_CREDITS and never calls the upstream.Top up or upgrade in the dashboard. Gateway failures (bad route, auth, rate limit, 5xx, timeouts) are not billed.