Skip to Content
Analytics

LLM session stats

Count, average, percentile bands and (optionally) the selected session's percentile ranks across sessions.

GET
/analytics/llm-session-stats

Count, average, percentile bands and (optionally) the selected session's percentile ranks across sessions.

Authorization

ApiKeyAuth
headerAuthorizationBearer <token>

Bearer token authentication. Send an API key (a saai_api_-prefixed token) as Authorization: Bearer <token>.

Required permission

view_llm_analytics

Query Parameters

scope?string

own returns only the caller's own records, even when they may see the whole organization. all, the default, returns everything the caller may see. It never widens what the caller may see.

Value in"all""own"
start_time*string

Start of the time range to report on, inclusive.

Formatdate-time
end_time*string

End of the time range to report on, exclusive.

Formatdate-time
telemetry_provider?array<>

Filter to OpenTelemetry providers; LLM gateway calls have none, so any value excludes them.

agent_slug?array<string>

Filter to agent types by catalog slug, such as claude-code.

agent_instance_id?array<>

Filter to specific agent instances.

model_provider_id?array<>

Filter to model providers: the inference connections that served the calls.

model?array<string>

Filter to specific model names.

user_id?array<>

Filter to specific users by id.

user_group?array<string>

Filter to users in specific groups.

Response Body

The request has succeeded.

application/json
  1. response

Aggregate session statistics over the sessions matching the filters.

session_count*integer

Number of sessions the statistics are computed over.

Formatint64
cost*

Average, median and peak (p95) for one session metric over the selected range.

tokens*

Average, median and peak (p95) for one session metric over the selected range.

duration*

Average, median and peak (p95) for one session metric over the selected range.

requests*

Average, median and peak (p95) for one session metric over the selected range.

Example Request
curl -X GET 'https://your-org.aisecurity.services.us.connect.secureauth.com/api/v1/analytics/llm-session-stats?start_time=2019-08-24T14%3A15%3A22Z&end_time=2019-08-24T14%3A15%3A22Z'
Example Response
{  "session_count": 0,  "cost": {    "avg": 0.1,    "p50": 0.1,    "p95": 0.1  },  "tokens": {    "avg": 0.1,    "p50": 0.1,    "p95": 0.1  },  "duration": {    "avg": 0.1,    "p50": 0.1,    "p95": 0.1  },  "requests": {    "avg": 0.1,    "p50": 0.1,    "p95": 0.1  }}