Endpoint Stats
Endpoint
Section titled “Endpoint”GET https://api.bve.me/admin/endpoint-statsAuthorization: Bearer admin_bve_YOUR_ADMIN_KEYReturns request counts, error breakdowns, and latency aggregates grouped by the API endpoint path (e.g. /v1/chat/completions, /v1/embeddings). Data is sourced from the 1%-sampled request_logs_sampled table. Default sort order is request_count descending; use sort_by and sort_dir to change it.
Authentication
Section titled “Authentication”Admin Bearer token required. See Admin API Overview for authentication details.
Query parameters
Section titled “Query parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
key_id | string | No | — | Restrict stats to a single API key UUID |
model | string | No | — | Restrict stats to a single model ID. Only rows where request_logs_sampled.model = ? are counted. Endpoints with no rows for that model are excluded. Combines with key_id. |
since | string | No | — | Include only log entries at or after this ISO 8601 timestamp |
until | string | No | — | Include only log entries at or before this ISO 8601 timestamp |
limit | integer | No | 20 | Maximum number of endpoint rows to return (1–500) |
sort_by | string | No | request_count | Column to sort by. One of: request_count, error_count, avg_latency_ms, max_latency_ms, p95_latency_ms |
sort_dir | string | No | desc | Sort direction: asc or desc |
All parameters are optional and combinable.
Response (200)
Section titled “Response (200)”{ "endpoints": [ { "endpoint": "/v1/chat/completions", "request_count": 312, "error_count": 8, "client_error_count": 6, "server_error_count": 2, "avg_latency_ms": 1540, "max_latency_ms": 9200, "p50_latency_ms": 1100, "p95_latency_ms": 5800, "error_rate": 2.56 }, { "endpoint": "/v1/embeddings", "request_count": 87, "error_count": 0, "client_error_count": 0, "server_error_count": 0, "avg_latency_ms": 130, "max_latency_ms": 580, "p50_latency_ms": 120, "p95_latency_ms": 310, "error_rate": 0 } ]}Response fields
Section titled “Response fields”| Field | Type | Description |
|---|---|---|
endpoint | string | API endpoint path as recorded in the request log (e.g. /v1/chat/completions) |
request_count | integer | Number of sampled log entries for this endpoint (~1% of actual requests) |
error_count | integer | Number of sampled requests that returned HTTP 400 or above |
client_error_count | integer | Number of sampled requests that returned HTTP 4xx |
server_error_count | integer | Number of sampled requests that returned HTTP 5xx |
avg_latency_ms | number | null | Average end-to-end latency in milliseconds. null if no latency data was recorded. |
max_latency_ms | number | null | Maximum end-to-end latency in milliseconds across all sampled requests for this endpoint. null if no latency data was recorded. |
p50_latency_ms | number | null | Median (50th percentile) latency in milliseconds |
p95_latency_ms | number | null | 95th percentile latency in milliseconds — useful for tail-latency SLO alerting |
error_rate | number | Error rate as a percentage: (error_count / request_count) × 100, rounded to 2 decimal places. 0 when request_count is 0. |
cURL examples
Section titled “cURL examples”All endpoints by request count
Section titled “All endpoints by request count”curl "https://api.bve.me/admin/endpoint-stats" \ -H "Authorization: Bearer admin_bve_YOUR_ADMIN_KEY"Top 5 endpoints in the last 7 days
Section titled “Top 5 endpoints in the last 7 days”curl "https://api.bve.me/admin/endpoint-stats?since=2026-05-19T00:00:00Z&limit=5" \ -H "Authorization: Bearer admin_bve_YOUR_ADMIN_KEY"Endpoint breakdown for a single key
Section titled “Endpoint breakdown for a single key”curl "https://api.bve.me/admin/endpoint-stats?key_id=550e8400-e29b-41d4-a716-446655440000" \ -H "Authorization: Bearer admin_bve_YOUR_ADMIN_KEY"Endpoint breakdown for a specific model
Section titled “Endpoint breakdown for a specific model”# Which endpoints is gpt-4o being called through?curl "https://api.bve.me/admin/endpoint-stats?model=gpt-4o" \ -H "Authorization: Bearer admin_bve_YOUR_ADMIN_KEY"Combined filter — model usage for a specific key
Section titled “Combined filter — model usage for a specific key”curl "https://api.bve.me/admin/endpoint-stats?key_id=550e8400-e29b-41d4-a716-446655440000&model=gpt-4o" \ -H "Authorization: Bearer admin_bve_YOUR_ADMIN_KEY"Sort by p95 latency (slowest endpoints first)
Section titled “Sort by p95 latency (slowest endpoints first)”curl "https://api.bve.me/admin/endpoint-stats?sort_by=p95_latency_ms" \ -H "Authorization: Bearer admin_bve_YOUR_ADMIN_KEY"Sort by error count descending
Section titled “Sort by error count descending”curl "https://api.bve.me/admin/endpoint-stats?sort_by=error_count&limit=10" \ -H "Authorization: Bearer admin_bve_YOUR_ADMIN_KEY"Sort by avg latency ascending (fastest first)
Section titled “Sort by avg latency ascending (fastest first)”curl "https://api.bve.me/admin/endpoint-stats?sort_by=avg_latency_ms&sort_dir=asc" \ -H "Authorization: Bearer admin_bve_YOUR_ADMIN_KEY"Pretty-print with jq
Section titled “Pretty-print with jq”curl -s "https://api.bve.me/admin/endpoint-stats" \ -H "Authorization: Bearer $ADMIN_KEY" \ | jq '.endpoints[] | {endpoint, request_count, error_rate}'TypeScript example
Section titled “TypeScript example”const res = await fetch("https://api.bve.me/admin/endpoint-stats?limit=10", { headers: { Authorization: `Bearer ${adminKey}` },});
const { endpoints } = await res.json();
for (const ep of endpoints) { console.log(`${ep.endpoint}: ${ep.request_count} sampled requests, p95=${ep.p95_latency_ms}ms`);}Common errors
Section titled “Common errors”| Status | Code | Cause |
|---|---|---|
| 400 | validation_error | since or until is not a parseable ISO 8601 timestamp |
| 400 | validation_error | sort_by is not one of the accepted column names |
| 400 | validation_error | sort_dir is not asc or desc |
| 401 | missing_api_key | No Authorization header |
| 401 | invalid_api_key | Admin key does not match the configured ADMIN_API_KEY secret |
Use cases
Section titled “Use cases”Find the slowest endpoint by p95 latency:
curl -s "https://api.bve.me/admin/endpoint-stats?sort_by=p95_latency_ms&limit=1" \ -H "Authorization: Bearer $ADMIN_KEY"Find endpoints with the most errors:
curl -s "https://api.bve.me/admin/endpoint-stats?sort_by=error_count" \ -H "Authorization: Bearer $ADMIN_KEY" \ | jq '.endpoints[] | select(.error_rate > 5)'Find which endpoints a specific model is called through:
curl -s "https://api.bve.me/admin/endpoint-stats?model=gpt-4o" \ -H "Authorization: Bearer $ADMIN_KEY" | jq '.endpoints[] | {endpoint, request_count}'Compare endpoint usage for a specific key:
curl -s "https://api.bve.me/admin/endpoint-stats?key_id=<uuid>" \ -H "Authorization: Bearer $ADMIN_KEY" | jq '.'Next steps
Section titled “Next steps” Key Stats Top API keys by request count with token totals and latency percentiles
Model Stats Per-model aggregate request counts, token sums, and latency
Request Logs Browse individual sampled log entries with per-request detail
Admin API: Overview All admin endpoints in one table