get__v2_stats_ai
GET /v2/stats/ai
Get AI Gateway Stats
Time-series for AI gateway metrics (excludes Private Chat).
Parameters
scope
query
string
true
Scope level: org, workspace, or repo
id
query
string
false
Required when scope is workspace or repo
window
query
string
true
Time window, e.g. 24h, 7d, 30d
timeBucketSize
query
string
false
Time grouping size, e.g., 1h, 1d
model
query
string
false
Filter by LLM model
apiKeyId
query
string
false
Filter by Repo API Key ID
aiLlmId
query
string
false
Filter by AI configuration (LLM config) ID
TypeScript Client Library
// Using the Flashgate TypeScript client
import { FlashgateClient } from '@flashgatetech/flashgateclient';
const client = new FlashgateClient({
accessToken: 'your-access-token'
});
try {
const result = await client.getAiGatewayStats({
scope: 'org',
id: 'org-id',
window: '24h'});
console.log('Get AI Gateway Stats:', result);
} catch (error) {
console.error('Failed to retrieve get ai gateway stats:', error);
}Code Samples
Example responses 200 Response
Responses
Response Schema
Status Code 200
» success
boolean
true
none
Indicates if the request was successful
» meta
object
true
none
Metadata for the response
» summary
object
true
none
Statistical summary
» series
[object]
true
none
Array of time-series points
»» ts
integer
true
none
Unix timestamp
»» tokensIn
integer
true
none
Input tokens
»» tokensOut
integer
true
none
Output tokens
»» policyTokensIn
integer
true
none
Policy evaluation input tokens
»» policyTokensOut
integer
true
none
Policy evaluation output tokens
»» requests
integer
true
none
Total requests
»» activeConversations
integer
true
none
Active conversations
»» latencyMs
number
true
none
Average latency in ms
Status Code 400
» success
boolean
true
none
Always false for error responses
» message
string
true
none
Error message
Status Code 500
» success
boolean
true
none
Always false for error responses
» message
string
true
none
Error message
Last updated
Was this helpful?