Skip to navigation

Usage

Measured quantities from the platform meter, by agent or by call.

Usage reports quantities and events from the platform meter. It never reports prices.

export RASEN_API_BASE="https://api.rasen.ai/v1"
export RASEN_API_KEY="<your key>"
AUTH="Authorization: Bearer $RASEN_API_KEY"
curl -sS "$RASEN_API_BASE/usage?group_by=agent&start=2026-09-01T00:00:00Z&end=2026-10-01T00:00:00Z" -H "$AUTH"
curl -sS -X POST "$RASEN_API_BASE/usage/query" -H "$AUTH" -H "Content-Type: application/json" \
-d '{"filter": {"agent_id": ["agent_…"], "component": ["stt", "tts"]}, "group_by": ["call"]}'
{"state": "measured",
"items": [{"component": "stt", "unit": "second", "quantity": 90.0, "events": 2,
"agent_id": "agent_…", "call_id": null,
"started_at": "2026-09-01T00:00:00Z", "ended_at": "2026-10-01T00:00:00Z"}],
"next_cursor": null, "range": {"start": "2026-09-01T00:00:00Z", "end": "2026-10-01T00:00:00Z"}}
  • Grouping is optional: agent, call or both. Without grouping, matching facts combine by component and unit.
  • Different units are never added together. A correction the platform records nets into the same row, and a fact the platform received twice counts once.
  • agent_id or call_id is null on a row for usage that belongs to no single agent or call.
  • state is measured when there are rows, unmeasured when calls happened in the range but nothing metered them yet, and empty when nothing happened.
  • The range is UTC, start inclusive and end exclusive, at most 93 days, and the trailing 30 days by default.
  • POST /usage/query takes the same filter names in its body, for up to 1000 ID values (Filters and limits). It is a read: no Idempotency-Key.