Usage and metering
How many minutes you've used, what's left, and the per-request ledger behind the number.
Use Usage analytics to see consumption over time and the event ledger
to inspect individual model requests. Both are read-only views of your
workspace’s metered activity and require usage:read.
curl 'https://api.kejue.co/v1/usage/analytics?range=7d&grain=day' \
-H "Authorization: Bearer $KEJUE_API_KEY"Aggregate analytics
GET /usage/analytics covers non-eval call, tool, webhook, and inference
activity for the authenticated workspace (no org_id override). Totals:
call counts, failures, answered calls, minutes, concurrency; tool/webhook
counts with failure rates; inference counts, tokens, audio, characters,
failovers; latency percentiles; voice/duty-cycle measures. series
repeats the operational counters per bucket. Null latency or duty-cycle
means no qualifying sample, not zero.
Pick one time-range mode: range=24h|7d|30d|90d|12m (default 30d),
or from (inclusive) plus optional to (exclusive; defaults to now;
never in the future), each RFC 3339 or YYYY-MM-DD.
grain is hour, day, week, or month. Weeks start Monday; week
is never chosen for you — by range the server defaults to hour, day,
or month, so integrations keep their bucket shape unless they opt in.
Hour grain: max 45 days; any range: max 366 days. Unknown, duplicated,
mutually exclusive, or out-of-range parameters return a stable 400.
Filter usage
On the Usage page, combine agent, phone number, caller-number search, call direction, channel, AI/human handler, call status, and date filters. Agent and phone pickers are searchable and allow multiple selections, including archived resources. Filters persist in the URL, so a shared link or reload keeps its scope. Choose a relative range or custom calendar dates; hourly/daily/weekly/ monthly buckets adapt to the selected span.
Filters apply to historical totals and charts together. The allowance wallet and live-capacity cards remain workspace-wide. Custom date ranges include the last selected calendar day in your browser's timezone; today ends at the current time.
The analytics API accepts the same call filters:
| Parameter | Meaning |
|---|---|
agent_ids | Comma-separated agent UUIDs; includes their historical versions |
platform_numbers | Comma-separated exact platform phone numbers |
caller_number | Literal substring of the caller number |
directions | inbound, outbound |
channels | sip_inbound, sip_outbound, web_sdk, web_test, transfer_brief |
handled_by | ai, human |
statuses | ringing, queued, in_progress, ended, failed |
List filters accept up to 50 comma-separated values: OR within one list,
AND across different parameters. Empty, duplicated or invalid parameters return
400. Encode plus signs in phone numbers as %2B. The workspace always comes
from authentication; filters cannot select another workspace.
Filtered inference counters use retained session-linked requests because workspace rollups do not contain agent or phone identifiers. Unlinked requests are excluded from those views. Phone filters cannot match identifying fields already removed by retention. Eval activity remains excluded. A custom date window preserves its exact boundaries, even when the first chart bucket is partial.
The event ledger
GET /usage-events returns newest-first llm, stt, tts, speechlm,
embedding, and endpointing events: product display names, actor kind,
status, HTTP result, timing, token/audio/character measures, streaming and
failover facts, request/session correlation, and a strictly allowlisted
metadata object.
curl 'https://api.kejue.co/v1/usage-events?status=error&kind=llm&limit=100' \
-H "Authorization: Bearer $KEJUE_API_KEY"Exact filters AND together: kind,
actor=agent|caller|scorer|system|guardrail|analysis, status=ok|error|timeout, http_status,
streamed, session_id, request_id, turn_index with session_id for a
conversational turn, created_from (inclusive), created_to (exclusive),
and q across request ID, service_display_name, and model_display_name. limit is 1–200
(default 50); cursors follow the
pagination contract.
An endpointing row is one end-of-turn decision by our endpointing model.
It carries timing and metadata.turn_index but no tokens, audio or
characters, and its model_display_name may be null. The same six kinds appear in the
per-kind breakdown of GET /usage/analytics.
Request rows can also include provider_id and provider_instance_id as
opaque platform UUIDs, plus pipeline mode, pipeline role, and generation
correlation where available. Use the instance UUID to group requests served
by the same instance or quote it to support. Historical requests may lack
those fields. Service and model display names may be null when the catalog
cannot resolve them. The pipeline role describes the work performed; it
does not disclose the underlying model implementation. Internal model
names, service slugs, and instance names are not returned and cannot be
used as filters; sending model or upstream_provider returns 400.
Failure rows carry a sanitized failure — stable code, safe message,
retryable flag — with codes distinguishing invalid request,
authentication, permission, not-found, timeout, conflict, validation,
rate limiting, unavailability, and generic upstream failure. Raw upstream
bodies, unrecognized metadata and raw diagnostic detail are never returned.
Use the classified failure and request/session IDs when reporting a problem.
Minutes and rollover
If your team has a monthly minutes allowance, your minutes live in two buckets:
| Bucket | What's in it | At the end of the billing period |
|---|---|---|
| This period's minutes | The monthly allowance plus top-ups that expire | Unused minutes are retired |
| Rollover minutes | Top-ups granted as never expiring | Carried into the next period until used |
We never cut a call off mid-conversation, so a period can end slightly overdrawn. We take that overrun once from the next period's allowance — never from your rollover minutes. Calls use the current period's minutes first, then rollover minutes.
The Minutes card on the dashboard's Usage page shows the total remaining. When you have rollover minutes, it also shows how many, and the progress bar counts only this period's minutes. The "running low" email at 90% says how many of the remaining minutes are rollover minutes.
When you hit a quota
New calls are refused only when the total — this period's minutes plus
rollover minutes — reaches zero. They return 429 minutes_quota_exhausted;
in-progress calls are unaffected, and details.cycle_end says when the
allowance resets.
Per-code retry guidance: error-code catalog.
Complete response schemas: API reference.