Track credit consumption
Records credit consumption in one of two forms: draw an ad-hoc cost against the account’s open block (feature + cost), or settle a prior reservation with the amount used (reservation_id + used). A deny is returned as 200 { allowed: false }. When the credit gate is disabled for the organization, the endpoint fails closed with 200 { allowed: false }. Settlement is idempotent — a retry with the same Idempotency-Key replays the recorded outcome instead of double-settling.
Failure handling: a timed-out or 5xx settlement is safe to retry with the SAME Idempotency-Key (the retry replays the recorded outcome). Every live draw must send either unique_id or the Idempotency-Key header and must reuse that identity on retries; otherwise the request is rejected before credits are consumed. A retry always replays the same credit decision, but re-publication of the underlying usage event depends on the feature’s backend tier: a durable (Postgres strict-reservation) feature’s retry republishes with the identical deduplicated usage identity, so no metering is lost; a soft/memorydb-tier feature’s retry returns the prior decision WITHOUT re-publishing — the original publish either already succeeded or must be recovered out of band. If a call returns retryable and the response indicates publication is not yet durable, retry with the SAME idempotency identity rather than assuming the usage event was recorded. A 409 means the Idempotency-Key was already used with a different request body and will never succeed as-is: do not retry it unchanged. On 429, back off and retry after the indicated delay.
Authorizations
API key authentication. Pass your API key as a Bearer token.
Headers
2026-04-01 A unique string used to ensure the request is processed exactly once. If you retry a request with the same idempotency key within 24 hours, the original response is returned without re-executing the operation.
255"ik_a1b2c3d4e5f6"
Body
Customer account ID or alias; direct-consumption mode
"cust_abc123"
Credits to draw for this call; direct-consumption mode, mutually exclusive with reservation_id/used.
"5"
Usage event name recorded for metering/overflow billing; direct-consumption mode
"api_call"
Feature the credits are consumed against; direct-consumption mode
"llm_tokens"
Event properties used to resolve customer-specific filter groups; direct-consumption mode. Never a billing source of truth.
Reservation token returned by /check, to settle credit coverage; reservation-settlement mode. Mutually exclusive with feature/cost. Reservation settlement does not publish metered usage; send the raw usage event through /events before settling.
"crt_abc123"
Usage event timestamp (RFC3339); required in direct-consumption mode and must remain identical on retries.
"2026-04-01T10:00:00Z"
Stable dedupe identity for the recorded usage event. Live direct-consumption requests require either this field or the Idempotency-Key header; reuse the same identity on every retry.
"evt_abc123"
Credits actually used against the reservation; required in reservation-settlement mode (send "0" explicitly to settle as zero — omitting it is rejected, never treated as zero). Rejected when no matching raw usage stream is visible for the account and reservation window.
"3"
Response
Success
Whether the consumption was covered by available credit
Available credit balance for the account after this call
Credit quantity covered by this call
Quantity not covered by credit that overflows to metered billing
Reservation this call settled or opened. Empty for a direct-consumption draw that opened no block.
"crt_abc123"
True when the referenced reservation had expired and the work was re-resolved as a fresh consume