Skip to content

Model Stats

GET https://api.bve.me/admin/model-stats
Authorization: Bearer admin_bve_YOUR_ADMIN_KEY

Returns request counts, token sums (prompt, completion, total), and latency aggregates grouped by model name. Data is sourced from the 1%-sampled request_logs_sampled table, so all figures reflect approximately 1% of actual traffic volume. Rows are ordered by request_count descending by default; use sort_by and sort_dir to change the order.

Admin Bearer token required. See Admin API Overview for authentication details.

ParameterTypeRequiredDefaultDescription
key_idstringNoRestrict stats to a single API key UUID
providerstringNoFilter by model creator. One of: anthropic, cohere, cursor, deepseek, google, meta, mistral, openai, wasikan. Returns 400 for any other value.
endpointstringNoRestrict stats to a specific gateway endpoint path (e.g. /v1/responses). Only rows where request_logs_sampled.endpoint = ? are aggregated; models with no rows for that endpoint are excluded. Combines with key_id and provider.
sincestringNoInclude only log entries at or after this ISO 8601 timestamp. Invalid timestamps return 400 validation_error.
untilstringNoInclude only log entries at or before this ISO 8601 timestamp. Combine with since for a bounded window.
limitintegerNo50Maximum number of model rows to return (1–500)
sort_bystringNorequest_countColumn to sort results by. One of: request_count, error_count, total_tokens, avg_latency_ms, max_latency_ms, p95_latency_ms. Returns 400 validation_error for unrecognized values.
sort_dirstringNodescSort direction: asc (ascending) or desc (descending). Returns 400 validation_error for other values.

All parameters are optional and combinable. For example, ?since=2026-05-01T00:00:00Z&sort_by=total_tokens&limit=10 returns the top 10 models by total tokens since May 1.

{
"total": 12,
"models": [
{
"model": "gpt-4o",
"request_count": 142,
"prompt_tokens": 184320,
"completion_tokens": 62540,
"total_tokens": 246860,
"avg_latency_ms": 1240,
"max_latency_ms": 8340,
"p50_latency_ms": 980,
"p95_latency_ms": 6200,
"error_count": 3,
"client_error_count": 2,
"server_error_count": 1,
"error_rate": 2.11,
"top_endpoints": [
{ "endpoint": "/v1/chat/completions", "request_count": 120 },
{ "endpoint": "/v1/responses", "request_count": 22 }
]
},
{
"model": "text-embedding-ada-002",
"request_count": 89,
"prompt_tokens": 44800,
"completion_tokens": 0,
"total_tokens": 44800,
"avg_latency_ms": 120,
"max_latency_ms": 580,
"p50_latency_ms": 110,
"p95_latency_ms": 340,
"error_count": 0,
"client_error_count": 0,
"server_error_count": 0,
"error_rate": 0,
"top_endpoints": [
{ "endpoint": "/v1/embeddings", "request_count": 89 }
]
}
]
}
FieldTypeDescription
totalintegerTotal number of distinct model rows matching the current filters (ignores limit). When ?provider= is set, reflects the count after client-side provider filtering.
modelstringModel ID as returned by the upstream provider
request_countintegerNumber of sampled log entries for this model (~1% of actual requests)
prompt_tokensintegerSum of prompt tokens across all sampled entries for this model
completion_tokensintegerSum of completion tokens across all sampled entries. 0 for embedding models.
total_tokensintegerSum of prompt_tokens + completion_tokens for each entry
avg_latency_msnumber | nullAverage end-to-end latency in milliseconds (rounded to integer)
max_latency_msnumber | nullMaximum end-to-end latency in milliseconds seen in the sample window
p50_latency_msnumber | nullMedian (50th percentile) end-to-end latency in milliseconds. More representative than avg_latency_ms for skewed distributions.
p95_latency_msnumber | null95th percentile end-to-end latency in milliseconds. Useful for understanding tail latency for SLO alerting.
error_countintegerNumber of sampled requests that returned HTTP 400 or above for this model.
client_error_countintegerNumber of sampled requests that returned HTTP 4xx (client errors: bad request, auth failure, rate limit, validation).
server_error_countintegerNumber of sampled requests that returned HTTP 5xx (gateway or upstream failures).
error_ratenumberError rate as a percentage: (error_count / request_count) × 100, rounded to 2 decimal places. 0 when request_count is 0.
top_endpointsarrayGateway endpoint paths this model was requested through, ordered by request_count descending. Each element has endpoint (string, e.g. /v1/chat/completions) and request_count (integer). The array is empty if no endpoint data was recorded.

avg_latency_ms, max_latency_ms, p50_latency_ms, and p95_latency_ms are null if no latency data was recorded for that model.

Terminal window
curl "https://api.bve.me/admin/model-stats" \
-H "Authorization: Bearer admin_bve_YOUR_ADMIN_KEY"
Terminal window
curl "https://api.bve.me/admin/model-stats?since=2026-05-16T00:00:00Z&limit=10" \
-H "Authorization: Bearer admin_bve_YOUR_ADMIN_KEY"
Terminal window
curl "https://api.bve.me/admin/model-stats?key_id=550e8400-e29b-41d4-a716-446655440000" \
-H "Authorization: Bearer admin_bve_YOUR_ADMIN_KEY"
Terminal window
# Only Anthropic models
curl "https://api.bve.me/admin/model-stats?provider=anthropic" \
-H "Authorization: Bearer admin_bve_YOUR_ADMIN_KEY"
# Only OpenAI models, top 5 by request count
curl "https://api.bve.me/admin/model-stats?provider=openai&limit=5" \
-H "Authorization: Bearer admin_bve_YOUR_ADMIN_KEY"
Terminal window
# Only models used on the Responses API
curl "https://api.bve.me/admin/model-stats?endpoint=/v1/responses" \
-H "Authorization: Bearer admin_bve_YOUR_ADMIN_KEY"
# OpenAI models used on the Responses API, top 5 by request count
curl "https://api.bve.me/admin/model-stats?endpoint=/v1/responses&provider=openai&limit=5" \
-H "Authorization: Bearer admin_bve_YOUR_ADMIN_KEY"
Terminal window
curl "https://api.bve.me/admin/model-stats?sort_by=total_tokens" \
-H "Authorization: Bearer admin_bve_YOUR_ADMIN_KEY"

Sort by p95 latency (ascending — fastest models first)

Section titled “Sort by p95 latency (ascending — fastest models first)”
Terminal window
curl "https://api.bve.me/admin/model-stats?sort_by=p95_latency_ms&sort_dir=asc" \
-H "Authorization: Bearer admin_bve_YOUR_ADMIN_KEY"

Sort by error count, limited to a provider

Section titled “Sort by error count, limited to a provider”
Terminal window
curl "https://api.bve.me/admin/model-stats?sort_by=error_count&provider=anthropic" \
-H "Authorization: Bearer admin_bve_YOUR_ADMIN_KEY"
Terminal window
curl -s "https://api.bve.me/admin/model-stats" \
-H "Authorization: Bearer $ADMIN_KEY" | jq '.models[] | {model, request_count, total_tokens}'
const res = await fetch("https://api.bve.me/admin/model-stats?limit=20", {
headers: { Authorization: `Bearer ${adminKey}` },
});
const { models } = await res.json();
for (const m of models) {
console.log(`${m.model}: ${m.request_count} sampled requests, ${m.total_tokens} tokens`);
}
StatusCodeCause
400validation_errorsince or until is not a parseable ISO 8601 timestamp
400validation_errorprovider is not one of the recognized provider values
400validation_errorsort_by is not one of the recognized column names
400validation_errorsort_dir is not asc or desc
401missing_api_keyNo Authorization header
401invalid_api_keyAdmin key does not match the configured ADMIN_API_KEY secret

Find which models are consuming the most tokens:

Terminal window
curl -s "https://api.bve.me/admin/model-stats?sort_by=total_tokens&limit=5" \
-H "Authorization: Bearer $ADMIN_KEY" | jq '.models[] | {model, total_tokens, request_count}'

Detect models with the worst tail latency:

Terminal window
curl -s "https://api.bve.me/admin/model-stats?sort_by=p95_latency_ms&limit=10" \
-H "Authorization: Bearer $ADMIN_KEY" \
| jq '[.models[] | select(.p95_latency_ms != null) | {model, p95_latency_ms, avg_latency_ms}]'

Find models with the most errors:

Terminal window
curl -s "https://api.bve.me/admin/model-stats?sort_by=error_count&limit=5" \
-H "Authorization: Bearer $ADMIN_KEY" | jq '.models[] | {model, error_count, error_rate}'

Find which models are used on a specific endpoint:

Terminal window
curl -s "https://api.bve.me/admin/model-stats?endpoint=/v1/responses&sort_by=request_count" \
-H "Authorization: Bearer $ADMIN_KEY" | jq '.models[] | {model, request_count}'

Compare model usage for a specific key over a date range:

Terminal window
curl -s "https://api.bve.me/admin/model-stats?key_id=<uuid>&since=2026-05-01T00:00:00Z&until=2026-05-31T23:59:59Z&sort_by=total_tokens" \
-H "Authorization: Bearer $ADMIN_KEY" | jq '.'