Measured usage per minute of Call, for a cost estimate before a Call
GET /v1/analytics/usage-rates
| Property | Value |
|---|---|
| Operation | get_usage_rates |
| Group | Call trace and analytics |
| Scope | usage:read |
| Route class | read |
| Idempotency | No Idempotency-Key |
| Audit | Not audited: A metadata read; the figures are counts and averages only. |
| Released in | 1.28.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Estimates, per minute of Call, the TTS characters, model input tokens and model output tokens the caller's Organization used over the last window_days (30 when absent, at most 90), averaged over the Turns, the greeting included, of its answered Calls that ended in the window (1.28.0, workspace ADR 0077). Below the minimum Turn count (USAGE_RATES_MIN_TURNS, a target) the figures are measured over every Organization of the cell instead and basis says platform; from 1.29.0 that basis is answered only when at least 5 Organizations other than the caller's (a target) contributed a counted Call in the window, and otherwise every figure is null and both counts 0, so that no Organization learns another's averages. Every figure is an estimate measured from stored Turns, labelled with its basis and counts; it is not a price, a quote or a bill. Needs usage:read from 1.29.0 (workspace ADR 0078, decision 7), calls:read before it.
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the usage:read scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl "$VOCAL_API/v1/analytics/usage-rates" \
-H "Authorization: Bearer $VOCAL_API_KEY"const response = await fetch(`${process.env.VOCAL_API}/v1/analytics/usage-rates`, {
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
},
});
console.log(response.status, await response.text());import os
import requests
response = requests.get(
f"{os.environ['VOCAL_API']}/v1/analytics/usage-rates",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
window_days | query | integer | no | How many days back from now the Calls are read, 1 to 90; 30 when absent. |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
200 | application/json | UsageRates | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 200 answer
The shape is UsageRates.
| Field | Type | Required | Description |
|---|---|---|---|
basis | UsageRatesBasis | yes | |
calls_counted | integer | yes | The answered Calls that ended in the window behind the figures, on the basis, less those whose Agent ran a stage on the mock Provider; their minutes from answer to end are the denominator. |
computed_at | Timestamp | yes | When the api computed the figures. |
estimate | true | yes | Always true: every figure is an estimate measured from stored Turns, not a price, a quote or a bill. |
llm_tokens_in_per_minute | number or null | yes | An estimate: the model input tokens of every model round per minute of Call, summed over the counted Turns and divided by the minutes of the counted Calls, on the basis; null when no Call minute was counted. It estimates what a future Call uses from what earlier Calls used, and is never a price or a bill. |
llm_tokens_out_per_minute | number or null | yes | An estimate: the model output tokens of every model round per minute of Call, summed over the counted Turns and divided by the minutes of the counted Calls, on the basis; null when no Call minute was counted. It estimates what a future Call uses from what earlier Calls used, and is never a price or a bill. |
object | "usage_rates" | yes | |
tts_characters_per_minute | number or null | yes | An estimate: the characters of reply text sent to TTS per minute of Call, summed over the counted Turns and divided by the minutes of the counted Calls, on the basis; null when no Call minute was counted. It estimates what a future Call uses from what earlier Calls used, and is never a price or a bill. |
turns_counted | integer | yes | The Turns with usage of the counted Calls, the greeting included, behind the figures, on the basis. |
window_days | integer | yes | The window the figures were measured over, in days back from computed_at. |