AI Analytics
Retrieve usage and performance analytics for AI models managed by the Strongly AI Gateway, counted in requests and tokens. All analytics endpoints are read-only and cover one date range: the last 24h, 7d, 30d or 90d.
Each figure counts the requests the caller may see: a platform administrator sees every request, on Strongly Cloud an organization's owners and admins see their organization's members' requests, and anyone else sees their own.
The per-user endpoints also take appId: then they count the calls made through that app, every user's and nothing else of theirs. An app's owner and a platform administrator may ask; to anyone else the app does not exist (404). An app reading its own users' usage calls them signed in as its owner.
GET /api/v1/ai-gateway/analytics/usage
Get usage statistics
Returns the range's totals: requests, tokens, latency, error rate, users and models.
Scope: ai-gateway:read
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
dateRange | query | string | Yes | 24h, 7d, 30d or 90d |
modelId | query | string | No | Only this model's requests |
Response: 200 OK
{
"data": {
"totalRequests": 145230,
"totalTokens": 28500000,
"promptTokens": 18200000,
"completionTokens": 10300000,
"avgResponseTime": 485,
"minResponseTime": 42,
"maxResponseTime": 9120,
"p95ResponseTime": 1500,
"p95OverBound": false,
"p99ResponseTime": 3000,
"p99OverBound": false,
"errorRate": 1.5,
"successRate": 98.5,
"uniqueUsersCount": 38,
"uniqueModelsCount": 7
},
"meta": { "requestId": "req_abc123" }
}
See UsageStats for the fields.
GET /api/v1/ai-gateway/analytics/performance
Get performance metrics
Returns request latency per model over the range, most requests first.
Scope: ai-gateway:read
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
dateRange | query | string | Yes | 24h, 7d, 30d or 90d |
modelId | query | string | No | Only this model |
Response: 200 OK
{
"data": [
{
"modelId": "model_abc123",
"modelName": "GPT-4 Production",
"provider": "openai",
"totalRequests": 52000,
"avgResponseTime": 420,
"minResponseTime": 38,
"maxResponseTime": 8800,
"p95ResponseTime": 1500,
"p95OverBound": false,
"p99ResponseTime": 3000,
"p99OverBound": false
}
],
"meta": { "requestId": "req_abc123" }
}
| Field | Type | Description |
|---|---|---|
modelId | string | Model ID |
modelName | string | Model name |
provider | string | Model provider |
totalRequests | integer | Requests in the range |
avgResponseTime | integer | null | Mean latency in milliseconds |
minResponseTime | number | null | Fastest request in milliseconds |
maxResponseTime | number | null | Slowest request in milliseconds |
p95ResponseTime | integer | null | 95th percentile latency in milliseconds, as the upper bound of its latency bucket |
p95OverBound | boolean | true when the 95th percentile is above the highest bucket bound (10000 ms), so the true value is over p95ResponseTime |
p99ResponseTime | integer | null | 99th percentile latency in milliseconds, as the upper bound of its latency bucket |
p99OverBound | boolean | As p95OverBound, for the 99th percentile |
GET /api/v1/ai-gateway/analytics/time-series
Get time-series data
Returns requests, tokens, mean latency and errors per provider, per hour or per UTC day, suitable for charting and trend analysis.
Scope: ai-gateway:read
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
dateRange | query | string | Yes | 24h, 7d, 30d or 90d |
granularity | query | string | Yes | hourly or daily. hourly is allowed only with 24h; any other range is refused with the message An hourly series is of the last 24 hours only |
provider | query | string | No | Only this provider (all means every provider) |
Response: 200 OK
{
"data": [
{
"timestamp": "2025-02-06",
"provider": "anthropic",
"requests": 1850,
"tokens": 410000,
"avgLatency": 540,
"errors": 12
},
{
"timestamp": "2025-02-06",
"provider": "openai",
"requests": 4200,
"tokens": 820000,
"avgLatency": 410,
"errors": 30
}
],
"meta": { "requestId": "req_abc123" }
}
data holds one point per period and provider, ordered by timestamp then provider. timestamp is YYYY-MM-DD HH:00 for hourly and YYYY-MM-DD for daily (UTC). With daily, every day of the range is present for each provider: a day with no requests has zero requests, tokens and errors and a null avgLatency (milliseconds).
GET /api/v1/ai-gateway/analytics/providers
Get per-provider statistics
Returns aggregated statistics grouped by AI provider, most requests first, useful for comparing providers side by side.
Scope: ai-gateway:read
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
dateRange | query | string | Yes | 24h, 7d, 30d or 90d |
Response: 200 OK
{
"data": [
{
"provider": "openai",
"modelsCount": 5,
"totalRequests": 82000,
"totalTokens": 18500000,
"avgLatency": 420,
"uniqueUsersCount": 31
},
{
"provider": "anthropic",
"modelsCount": 3,
"totalRequests": 45000,
"totalTokens": 12000000,
"avgLatency": 550,
"uniqueUsersCount": 22
}
],
"meta": { "requestId": "req_abc123" }
}
| Field | Type | Description |
|---|---|---|
provider | string | Provider name |
modelsCount | integer | Models of this provider with requests in the range |
totalRequests | integer | Requests in the range |
totalTokens | integer | Tokens in the range (prompt + completion) |
avgLatency | integer | null | Mean latency in milliseconds |
uniqueUsersCount | integer | Users with requests to this provider |
GET /api/v1/ai-gateway/analytics/users
List usage per user
Returns one row per user with requests in the range, most requests first, with each user's name and email. The list is paged (limit, default 50, max 200, and cursor, the previous page's meta.nextCursor).
Scope: ai-gateway:read
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
dateRange | query | string | Yes | 24h, 7d, 30d or 90d |
appId | query | string | No | Only the calls made through this app (its owner or a platform administrator) |
limit | query | integer | No | Rows per page (default 50, max 200) |
cursor | query | string | No | meta.nextCursor of the previous page |
Response: 200 OK
{
"data": [
{
"userId": "u_8f2k",
"userName": "Sam Lee",
"userEmail": "sam@example.com",
"totalRequests": 412,
"totalTokens": 96000,
"inputTokens": 61000,
"outputTokens": 35000,
"avgTokensPerRequest": 233,
"avgResponseTime": 640,
"errorRate": 0.49,
"uniqueModelsCount": 2,
"providersUsed": ["openai"],
"guardrailViolations": 3,
"flaggedRequests": 2,
"complianceScore": 99.51,
"requestsToday": 18,
"previousRequests": 300,
"trendPct": 37.3,
"lastRequestAt": "2026-11-17T21:04:11Z",
"lastActiveDay": "2026-11-17T00:00:00Z"
}
],
"meta": { "total": 1, "limit": 50, "nextCursor": null, "requestId": "req_abc123" }
}
| Field | Type | Description |
|---|---|---|
userId, userName, userEmail | string | Who the user is (null name and email for a user no longer on the platform) |
totalRequests, totalTokens, inputTokens, outputTokens | integer | Requests and tokens in the range |
avgResponseTime, p95ResponseTime, p99ResponseTime | integer | null | Latency in milliseconds (also minResponseTime, maxResponseTime and the …OverBound flags, as in performance) |
errorRate, successRate | number | null | Percent of requests that failed or succeeded |
guardrailViolations | integer | Guardrail rule firings |
flaggedRequests, complianceScore | integer, number | null | Requests a rule fired on, and the percent on which none did; null when not recorded for the range |
requestsToday | integer | Requests since UTC midnight |
previousRequests, trendPct | integer, number | null | The previous range of equal length and the change against it (null when it had none) |
lastRequestAt, lastActiveDay | string | null | The latest request the raw records hold (about the last week), and the latest UTC day with requests |
GET /api/v1/ai-gateway/analytics/users/:id
Get one user's usage
Returns one user's usage over the range: totals, latency, errors and compliance; per model (modelsUsed), per day (usageOverTime), by weekday (usageByDayOfWeek); and, over the part of the range the raw records hold (rawSince, about the last week), by hour of day (peakUsageHours), the workloads the calls came from (callsByWorkload), error types (errorTypes), the rules that fired (violationSummary) and the guardrail records (guardrailRecords).
Scope: ai-gateway:read
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The user's ID |
dateRange | query | string | Yes | 24h, 7d, 30d or 90d |
appId | query | string | No | Only the calls the user made through this app (its owner or a platform administrator) |
Without appId, a user you may not count is refused (403).
Response Models Reference
UsageStats
| Field | Type | Description |
|---|---|---|
totalRequests | integer | Total number of inference requests |
totalTokens | integer | Total tokens consumed (prompt + completion) |
promptTokens | integer | Total input/prompt tokens |
completionTokens | integer | Total output/completion tokens |
avgResponseTime | integer | null | Mean latency in milliseconds (null with no requests) |
minResponseTime | number | null | Fastest request in milliseconds |
maxResponseTime | number | null | Slowest request in milliseconds |
p95ResponseTime | integer | null | 95th percentile latency in milliseconds, as the upper bound of its latency bucket |
p95OverBound | boolean | true when the 95th percentile is above the highest bucket bound (10000 ms) |
p99ResponseTime | integer | null | 99th percentile latency in milliseconds, as the upper bound of its latency bucket |
p99OverBound | boolean | As p95OverBound, for the 99th percentile |
errorRate | number | null | Percentage of requests that failed (0 - 100), null with no requests |
successRate | number | null | Percentage of requests that succeeded (0 - 100), null with no requests |
uniqueUsersCount | integer | Users with requests in the range |
uniqueModelsCount | integer | Models with requests in the range |