Skip to main content
Query AI usage, cost, latency, Evaluator outcomes, and guardrail metrics programmatically. The Reporting API returns time-series data sliced by model, provider, project, identity, and more in a single JSON request.

Spend dashboards

Track cost by model, provider, project, or credential type. Build per-customer billing breakdowns.

Performance monitoring

Monitor p50, p95, and p99 latency over time across models and providers.

Evaluator quality

Quantify pass rate, average score, and result distribution per Evaluator and version.

Guardrail enforcement

Measure block rate, triggers, and outcomes by Policy and stage.

Endpoint

POST https://api.orq.ai/v2/reporting
  • All requests require a Bearer token. See API Keys for how to generate one.
  • The workspace and project scope are derived from the API key itself.
Trace events flow into reporting in near real time, with a small ingestion delay measured in seconds. Queries against very recent windows may not yet include the latest events.

See the API Reference

Interactive playground and full schema for POST /v2/reporting.

Quickstart

Request

The wire format is snake_case end-to-end. SDKs expose the same fields in each language’s native style (groupBy in TypeScript, group_by in Python).
See the API reference for the full field schema, types, defaults, and validation rules.
Value shaping with mode: the default timeseries mode returns one row per time bucket. Set "mode": "scalar" to aggregate the whole window instead: with group_by the response carries one row per dimension combination ordered by value (a top list, capped by limit; flip the order with "sort": "asc"), and without group_by exactly one row (a single aggregate). Scalar rows omit the timestamp field.

Response

Every successful response follows the same envelope. The data array contains time-ordered buckets. Each bucket carries:
  • a dimensions map: the group_by values for that row (see Dimensions)
  • a metrics map: shape depends on the metric requested
Scalar metrics return a single named value per bucket. Bundle metrics (such as genai.usage) return a full set of related fields in one call. totals is present only when include_totals: true is set in the request; otherwise the field is omitted. Metric values are rounded to 10 decimal places server-side.

Metric catalog

Quantile metrics (genai.latency.p*, genai.ttft.p*) carry a +/-1-2% error band typical of t-digest estimation at high cardinality. genai.ttft.* metrics cover streaming requests only and do not support entity dimensions such as agent or tool.
Evaluator and guardrail metrics read from the same source: every Evaluator run is recorded as a guardrail check regardless of the Evaluator implementation type. Pick the metric that matches the question being asked.

Dimensions

The API picks the right index for the query automatically. Asking for an entity dimension (agent, tool, tag, and so on) on a usage metric routes the query through entity attribution; everything else stays on the core usage path.
billing_billable is available as a filter field for usage metrics, but not as a group_by dimension. To break down Orq.ai-managed versus customer-owned credentials, use credential_type instead. The values orq_managed and customer_byok are derived at query time from the workspace billing setup, not stored on each event.
Pair these with genai.requests, genai.tokens, genai.cost, genai.errors, genai.latency.*, or genai.usage.

Examples by use case

Get request count, tokens, and cost in one call. Best for headline dashboards.
The response carries dimensions.credential_type as "orq_managed" or "customer_byok".
Grouping by an entity auto-routes the query to attribution storage.
metrics["genai.latency.p95"] is reported in milliseconds.
Quantile metrics are independent calls. Fire them concurrently from the client.
Fetch requests and errors in parallel and divide on the client.
Bucket boundaries align to midnight in the requested zone.

Errors

Errors come back as JSON envelopes with a numeric code, a human-readable message, and an empty details array.
Every successful response includes meta.request_id. Include it in support tickets for fast log correlation.

Limits