POST /usage
This endpoint records usage; it does not decide anything. The call has already happened, so the kill switch, budgets and policies do not run on this path.
Request
Send
costUsd, or at least one of inputTokens and outputTokens. A report with none of them is refused with a 400. A field sent as null is treated as not sent. Every spend figure in the console includes these reports, so a report that would corrupt them is refused with a 400 and not stored:
- a negative, non-numeric or impossibly large
costUsd; - token counts that are negative, fractional, or too large to store;
- an
occurredAtthat is not ISO 8601, is not a real date or time (30 February, 24:30), is before 2000, or is in the future (a few minutes of clock difference is allowed); - a
modelthat is not text of at most 200 characters, or aproviderthat is not text of at most 100.
warning: the report may fall in a month, budget or bill that is already closed, and will not change it.
Response
A stored report answers201:
costSource says where the cost came from:
reported: you sentcostUsdand we used it.computed: we priced your token counts at that model’s rate, using your organisation’s declared price where you set one (the same price your proxied calls use) and otherwise the catalogue’s.unknown: we have no price for that model and did not invent one. The event is recorded with a null cost, which the console shows as unpriced, with a note that real spend is higher, never as$0.00.
unknown for a model you care about, tell us the id and we will add the price.