Programmatic spend for the calling key
FlexAI-specific shape (intentionally not OpenAI’s /v1/organization/usage/*
— that surface requires org/team scoping which FlexAI does not yet model).
Returns total spend, total tokens, per-model breakdown, and a daily
history for the API key in the Authorization header. Cached per-key
for 60 seconds. The total_spend value reconciles against your
invoices within 1% tolerance.
Authorizations
Virtual API key. Create one from the
FlexAI dashboard. Pass as
Authorization: Bearer sk-xxxx.
Query Parameters
Number of trailing days to include in daily.
1 <= x <= 365Response
Successful response
usage USD Per-model spend rows. Group by canonical_model+modality
for reconciliation: canonical_model is the stable catalog
id (the same id /v1/pricing and /v1/models use), whereas
model is the raw ledger id (the served routing target, e.g.
an FP8 packaging name) and is NOT stable across the
request/served/ledger forms of the same model. Two rows can
share a canonical_model when the ledger recorded one model
under two raw forms. Multi-modality models appear once per
modality (image+image_edit, etc.). Text rows have
modality=text, units_consumed=null, billing_unit=tokens.