get__ai_llm_stats
⚠️ TEST ENVIRONMENT ONLY
GET /ai/llm/stats
Get AI LLM Statistics
Retrieve usage statistics for AI/LLM configurations. This endpoint provides comprehensive metrics about API usage, token consumption, and policy enforcement.
Query Filtering:
Optionally filter by
aiLlmIdto get statistics for a specific configurationWithout filters, returns aggregated statistics across all your accessible configurations
Metrics Provided:
Total API Calls: Number of API requests made to the AI provider
Total Tokens In: Tokens consumed in requests
Total Tokens Out: Tokens generated in responses
Total LLM Tokens In: Language model-specific input tokens
Total LLM Tokens Out: Language model-specific output tokens
Policy Violations: Count of policy violations detected
Alerts: Number of alerts triggered
Blocks: Number of blocked requests
Use Cases:
Monitor AI usage and costs
Track compliance with AI policies
Analyze token consumption patterns
Identify potential issues or violations
TypeScript Client Library
public getAiLlmStats = async (aiLlmId?: string): Promise<AiLlmStatsResponse> => {
const queryParams = new URLSearchParams();
if (aiLlmId) {
queryParams.append('aiLlmId', aiLlmId);
}
return this.makeRequest<AiLlmStatsResponse>(
`ai/llm/stats${queryParams.toString() ? `?${queryParams.toString()}` : ''}`,
'GET',
null
);
};Code Samples
# You can also use wget
curl -X GET https://backend.flashback.tech/ai/llm/stats?aiLlmId=550e8400-e29b-41d4-a716-446655440000 \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access-token}'GET https://backend.flashback.tech/ai/llm/stats?aiLlmId=550e8400-e29b-41d4-a716-446655440000 HTTP/1.1
Host: backend.flashback.tech
Accept: application/jsonconst headers = {
'Accept':'application/json',
'Authorization':'Bearer {access-token}'
};
fetch('https://backend.flashback.tech/ai/llm/stats?aiLlmId=550e8400-e29b-41d4-a716-446655440000',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.get 'https://backend.flashback.tech/ai/llm/stats',
params: {
'aiLlmId' => 'string'
}, headers: headers
p JSON.parse(result)import requests
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.get('https://backend.flashback.tech/ai/llm/stats', params={
'aiLlmId': '550e8400-e29b-41d4-a716-446655440000'
}, headers = headers)
print(r.json())<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}',
);
$client = new \GuzzleHttp\Client();
try {
$response = $client->request('GET','https://backend.flashback.tech/ai/llm/stats', array(
'headers' => $headers,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...URL obj = new URL("https://backend.flashback.tech/ai/llm/stats?aiLlmId=550e8400-e29b-41d4-a716-446655440000");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://backend.flashback.tech/ai/llm/stats", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}Parameters
aiLlmId
query
string
false
Filter statistics by AI LLM configuration ID
Example responses
200 Response
{
"success": true,
"stats": [
{
"aiLlmId": "550e8400-e29b-41d4-a716-446655440000",
"totalApiCalls": "1523",
"totalTokensIn": "45678",
"totalTokensOut": "89012",
"totalLlmTokensIn": "43210",
"totalLlmTokensOut": "87654",
"totalPolicyViolations": "3",
"totalAlerts": "5",
"totalBlocks": "2"
}
]
}Responses
Response Schema
Status Code 200
» success
boolean
false
none
Operation success status
» stats
[object]
false
none
Array of statistics objects
»» aiLlmId
string
false
none
AI LLM configuration ID
»» totalApiCalls
string
false
none
Total number of API calls made
»» totalTokensIn
string
false
none
Total tokens consumed in requests
»» totalTokensOut
string
false
none
Total tokens generated in responses
»» totalLlmTokensIn
string
false
none
Total LLM-specific input tokens
»» totalLlmTokensOut
string
false
none
Total LLM-specific output tokens
»» totalPolicyViolations
string
false
none
Total policy violations detected
»» totalAlerts
string
false
none
Total alerts triggered
»» totalBlocks
string
false
none
Total requests blocked
Note: Numeric values are returned as strings to support large numbers without precision loss.
Status Code 403
» success
boolean
false
none
none
» message
string
false
none
none
Status Code 500
» success
boolean
false
none
none
» message
string
false
none
none
To perform this operation, you must be authenticated by means of one of the following methods: BearerAuth
Last updated
Was this helpful?