Consumo
Consumo por proveedor y componente, con costos.
GET /v1/pricing
The prices behind the cost estimates
Solo para usuarios con sesión iniciada (sin API key) · Rol: viewer o superior
A signed-in member with `costs:read`. The read-only price table that usage is priced with: per provider and model, USD per million tokens (text, audio and cached parts), per minute of audio or per million characters, with the public pricing page each rate was read from. `version` is the date the prices were read; every stored usage row keeps the version it was priced with. A model that is not listed has no price and its cost is null. Estimates ignore volume discounts and taxes. 401 when the token is missing, expired or invalid.
Respuestas
200Successful Response · PricingResponseNombre Tipo Requerido Descripción currencystringsí pricesPriceEntryResponse[]sí prices[].componentstringsí prices[].modelstringsí prices[].notestringsí prices[].providerstringsí prices[].ratesPriceRatessí USD per unit; a rate that is null does not apply to the model. prices[].rates.audio_input_per_mtoknumber | nullsí prices[].rates.audio_minutenumber | nullsí prices[].rates.audio_output_per_mtoknumber | nullsí prices[].rates.cached_audio_input_per_mtoknumber | nullsí prices[].rates.cached_input_per_mtoknumber | nullsí prices[].rates.cached_text_input_per_mtoknumber | nullsí prices[].rates.input_per_mtoknumber | nullsí prices[].rates.output_per_mtoknumber | nullsí prices[].rates.per_mcharsnumber | nullsí prices[].rates.text_input_per_mtoknumber | nullsí prices[].rates.text_output_per_mtoknumber | nullsí prices[].sourcestringsí Public pricing page the rates were read from. unpricedstringsí What happens to a model that is not listed: its cost is null, never a guess. versionstringsí Date the prices were read, `YYYY-MM-DD`. 401Missing, expired or invalid token. · ErrorResponse403Cost permission required. · ErrorResponsedefaultDefault Response · ErrorResponse
GET /v1/usage
What my organization consumed, with cost estimates
API key con usage:read · Rol: viewer o superior
Any signed-in member, or an API key with the scope `usage:read`. The consumption recorded between `since` (inclusive) and `until` (exclusive), by default from the start of the current month (UTC) until now, up to 366 days. `group_by` is `component` (llm, realtime, stt, tts, embeddings, telephony), `provider`, `model`, `assistant`, `campaign`, `day` (midnight of `timezone`, an IANA name, UTC by default) or `source` (call, talk, ingest, search, builder, decider); `then_by` splits each group once more by any of them. Filters: `assistant_id`, `campaign_id`, `component`, `provider`, `model` and `source`; usage that belongs to no call (knowledge ingestion and search) has no assistant or campaign. Each group has its quantities (tokens with the cached, reasoning, audio and text parts, audio seconds, characters, requests) and `cost_usd`, an estimate at the prices of `GET /v1/pricing`: the sum of the rows that have a price, with `unpriced_rows` counting the ones that do not. At most 500 groups (`truncated`). 401 when the token is missing, expired or invalid; 422 for an empty or too long range, an unknown time zone or another invalid parameter; 503 when usage is not available.
Parámetros
| Nombre | En | Tipo | Requerido | Descripción |
|---|---|---|---|---|
since | query | string (date-time) | null | ||
until | query | string (date-time) | null | ||
group_by | query | string | ||
then_by | query | string | null | ||
timezone | query | string | ||
assistant_id | query | string (uuid) | null | ||
campaign_id | query | string (uuid) | null | ||
component | query | string | null | ||
provider | query | string | null | ||
model | query | string | null | ||
source | query | string | null |
Respuestas
200Successful Response · UsageResponseNombre Tipo Requerido Descripción group_bystringsí groupsUsageGroupResponse[]sí groups[].keystringsí The value of `group_by`: a component, provider, model or source name, a day (`YYYY-MM-DD`), or an assistant or campaign id (empty for usage without one). groups[].labelstring | nullsí Assistant or campaign name, if known. groups[].subkeystring | nullsí The value of `then_by`, when it is set. groups[].sublabelstring | nullsí groups[].totalsUsageTotalsResponsesí groups[].totals.cost_usdnumber | nullsí Sum of the rows that have a price; null when none has. groups[].totals.quantitiesUsageQuantitiessí groups[].totals.unpriced_rowsintegersí Rows whose model has no price: the cost is then incomplete. price_versionstringsí Version of the price table that new usage is priced with. sincestring (date-time)sí then_bystring | nullsí totalsUsageTotalsResponsesí totals.cost_usdnumber | nullsí Sum of the rows that have a price; null when none has. totals.quantitiesUsageQuantitiessí totals.quantities.audio_input_tokensintegersí totals.quantities.audio_output_tokensintegersí totals.quantities.audio_secondsnumbersí totals.quantities.cached_input_tokensintegersí Part of `input_tokens`. totals.quantities.charactersintegersí totals.quantities.input_tokensintegersí totals.quantities.output_tokensintegersí totals.quantities.reasoning_tokensintegersí Part of `output_tokens`. totals.quantities.requestsintegersí totals.quantities.text_input_tokensintegersí totals.quantities.text_output_tokensintegersí totals.unpriced_rowsintegersí Rows whose model has no price: the cost is then incomplete. truncatedbooleansí True when more than 500 groups matched. untilstring (date-time)sí 401Missing, expired or invalid token. · ErrorResponse403Role below the one in `x-min-role`, a suspended organization, or an API key without the operation's `x-api-key-scope` (any key, if the operation has none). · ErrorResponse422The range or a parameter is invalid. · ErrorResponse429The API key went over its requests per minute. · ErrorResponse503Usage is not available yet. · ErrorResponsedefaultDefault Response · ErrorResponse