Documentation Index
Fetch the complete documentation index at: https://www.truefoundry.com/llms.txt
Use this file to discover all available pages before exploring further.
Timeseries Queries
Basic timeseries (hourly)
Basic timeseries (hourly)
Get hourly request counts:
response = requests.post(
"https://{your_control_plane_url}/api/svc/v1/llm-gateway/metrics/query",
headers={
"Authorization": "Bearer <your_api_key>",
"Content-Type": "application/json"
},
json={
"startTs": "2025-01-21T00:00:00.000Z",
"endTs": "2025-01-22T00:00:00.000Z",
"datasource": "modelMetrics",
"type": "timeseries",
"aggregations": [
{"type": "count", "column": "modelName"}
],
"filters": [
{
"fieldName": "virtualModelName",
"operator": "IS_NULL",
"value": true
}
],
"intervalInSeconds": 3600
}
)
5-minute intervals
5-minute intervals
Get fine-grained metrics with 5-minute intervals:
response = requests.post(
"https://{your_control_plane_url}/api/svc/v1/llm-gateway/metrics/query",
headers={
"Authorization": "Bearer <your_api_key>",
"Content-Type": "application/json"
},
json={
"startTs": "2025-01-21T00:00:00.000Z",
"endTs": "2025-01-21T06:00:00.000Z",
"datasource": "modelMetrics",
"type": "timeseries",
"aggregations": [
{"type": "count", "column": "modelName"}
],
"filters": [
{
"fieldName": "virtualModelName",
"operator": "IS_NULL",
"value": true
}
],
"intervalInSeconds": 300
}
)
Timeseries by model
Timeseries by model
Get hourly counts grouped by model:
response = requests.post(
"https://{your_control_plane_url}/api/svc/v1/llm-gateway/metrics/query",
headers={
"Authorization": "Bearer <your_api_key>",
"Content-Type": "application/json"
},
json={
"startTs": "2025-01-21T00:00:00.000Z",
"endTs": "2025-01-22T00:00:00.000Z",
"datasource": "modelMetrics",
"type": "timeseries",
"aggregations": [
{"type": "count", "column": "modelName"}
],
"filters": [
{
"fieldName": "virtualModelName",
"operator": "IS_NULL",
"value": true
}
],
"groupBy": ["modelName"],
"intervalInSeconds": 3600
}
)
Timeseries by team
Timeseries by team
Get hourly counts grouped by team:
response = requests.post(
"https://{your_control_plane_url}/api/svc/v1/llm-gateway/metrics/query",
headers={
"Authorization": "Bearer <your_api_key>",
"Content-Type": "application/json"
},
json={
"startTs": "2025-01-21T00:00:00.000Z",
"endTs": "2025-01-22T00:00:00.000Z",
"datasource": "modelMetrics",
"type": "timeseries",
"aggregations": [
{"type": "count", "column": "team"}
],
"filters": [
{
"fieldName": "virtualModelName",
"operator": "IS_NULL",
"value": true
}
],
"groupBy": ["team"],
"intervalInSeconds": 3600
}
)
Timeseries with filters
Timeseries with filters
Apply filters to timeseries data:
response = requests.post(
"https://{your_control_plane_url}/api/svc/v1/llm-gateway/metrics/query",
headers={
"Authorization": "Bearer <your_api_key>",
"Content-Type": "application/json"
},
json={
"startTs": "2025-01-21T00:00:00.000Z",
"endTs": "2025-01-22T00:00:00.000Z",
"datasource": "modelMetrics",
"type": "timeseries",
"aggregations": [
{"type": "count", "column": "modelName"}
],
"filters": [
{
"fieldName": "virtualModelName",
"operator": "IS_NULL",
"value": true
},
{
"fieldName": "modelName",
"operator": "IN",
"value": ["gpt-4", "gpt-3.5-turbo"]
}
],
"groupBy": ["modelName"],
"intervalInSeconds": 3600
}
)
Timeseries with latency filter
Timeseries with latency filter
Filter timeseries by latency threshold:
response = requests.post(
"https://{your_control_plane_url}/api/svc/v1/llm-gateway/metrics/query",
headers={
"Authorization": "Bearer <your_api_key>",
"Content-Type": "application/json"
},
json={
"startTs": "2025-01-21T00:00:00.000Z",
"endTs": "2025-01-22T00:00:00.000Z",
"datasource": "modelMetrics",
"type": "timeseries",
"aggregations": [
{"type": "count", "column": "modelName"}
],
"filters": [
{
"fieldName": "virtualModelName",
"operator": "IS_NULL",
"value": true
},
{
"fieldName": "latencyMs",
"operator": "GREATER_THAN",
"value": 500
}
],
"groupBy": ["modelName"],
"intervalInSeconds": 3600
}
)
Timeseries with team filter
Timeseries with team filter
Filter timeseries by team:
response = requests.post(
"https://{your_control_plane_url}/api/svc/v1/llm-gateway/metrics/query",
headers={
"Authorization": "Bearer <your_api_key>",
"Content-Type": "application/json"
},
json={
"startTs": "2025-01-21T00:00:00.000Z",
"endTs": "2025-01-22T00:00:00.000Z",
"datasource": "modelMetrics",
"type": "timeseries",
"aggregations": [
{"type": "count", "column": "modelName"}
],
"filters": [
{
"fieldName": "virtualModelName",
"operator": "IS_NULL",
"value": true
},
{
"fieldName": "team",
"operator": "ARRAY_HAS_ANY",
"value": ["team-alpha", "team-beta"]
}
],
"groupBy": ["team"],
"intervalInSeconds": 3600
}
)
Timeseries by metadata
Timeseries by metadata
Group timeseries by metadata:
response = requests.post(
"https://{your_control_plane_url}/api/svc/v1/llm-gateway/metrics/query",
headers={
"Authorization": "Bearer <your_api_key>",
"Content-Type": "application/json"
},
json={
"startTs": "2025-01-21T00:00:00.000Z",
"endTs": "2025-01-22T00:00:00.000Z",
"datasource": "modelMetrics",
"type": "timeseries",
"aggregations": [
{"type": "count", "column": "modelName"}
],
"filters": [
{
"fieldName": "virtualModelName",
"operator": "IS_NULL",
"value": true
}
],
"groupBy": ["metadata.environment"],
"intervalInSeconds": 3600
}
)
Weekly timeseries
Weekly timeseries
Get daily data for a week:
response = requests.post(
"https://{your_control_plane_url}/api/svc/v1/llm-gateway/metrics/query",
headers={
"Authorization": "Bearer <your_api_key>",
"Content-Type": "application/json"
},
json={
"startTs": "2025-01-14T00:00:00.000Z",
"endTs": "2025-01-21T00:00:00.000Z",
"datasource": "modelMetrics",
"type": "timeseries",
"aggregations": [
{"type": "count", "column": "modelName"}
],
"filters": [
{
"fieldName": "virtualModelName",
"operator": "IS_NULL",
"value": true
}
],
"intervalInSeconds": 86400
}
)
Complex timeseries query
Complex timeseries query
Combine filters, groupBy, and metadata:
response = requests.post(
"https://{your_control_plane_url}/api/svc/v1/llm-gateway/metrics/query",
headers={
"Authorization": "Bearer <your_api_key>",
"Content-Type": "application/json"
},
json={
"startTs": "2025-01-21T00:00:00.000Z",
"endTs": "2025-01-22T00:00:00.000Z",
"datasource": "modelMetrics",
"type": "timeseries",
"aggregations": [
{"type": "count", "column": "modelName"}
],
"filters": [
{
"fieldName": "virtualModelName",
"operator": "IS_NULL",
"value": true
},
{
"fieldName": "modelName",
"operator": "IN",
"value": ["gpt-4", "gpt-3.5-turbo"]
},
{
"metadataKey": "environment",
"operator": "IN",
"value": ["production"]
}
],
"groupBy": ["modelName"],
"intervalInSeconds": 3600
}
)