Platform

Analytics

Monitor API usage, track costs, and analyze performance metrics across all your proxy keys and providers.

Overview

GET/v1/analytics/overview

Get a high-level summary of your usage including total requests, token consumption, estimated cost, and error rates.

cURL
curl https://api.metriqual.com/v1/analytics/overview \
  -H "Authorization: Bearer YOUR_JWT"
TypeScript SDK
const overview = await mql.analytics.getOverview({ range: '7d' });
console.log('Total requests:', overview.total_requests);
console.log('Total cost:', overview.total_cost);
Python SDK
overview = mql.analytics.get_overview(start_date="2025-01-01")
print("Total requests:", overview["total_requests"])
print("Total cost:", overview["total_cost"])
CLI
mql analytics overview
mql analytics overview --json

Time Series

GET/v1/analytics/timeseries

Get usage data over time for charts and graphs. Supports daily, hourly, and weekly granularity with customizable time ranges.

cURL
curl "https://api.metriqual.com/v1/analytics/timeseries?range=7d&granularity=daily" \
  -H "Authorization: Bearer YOUR_JWT"
TypeScript SDK
const timeseries = await mql.analytics.getTimeseries({
  range: '7d',
  granularity: 'daily'
});
Python SDK
timeseries = mql.analytics.get_timeseries(
    start_date="2025-01-01",
    end_date="2025-01-07",
)

Provider Statistics

GET/v1/analytics/providers

Break down usage by provider (OpenAI, MiniMax, etc.) to see which providers are used most and their relative costs.

TypeScript SDK
const stats = await mql.analytics.getProviderStats();
stats.forEach(s => console.log(s.provider, s.total_requests, s.total_cost));
Python SDK
stats = mql.analytics.get_provider_stats()
for s in stats:
    print(s["provider"], s["total_requests"], s["total_cost"])

Usage Logs

GET/v1/usage
GET/v1/usage/logs

View individual request logs with model, tokens, latency, and cost for each API call. Useful for debugging and auditing.

cURL
curl "https://api.metriqual.com/v1/usage/logs?limit=50" \
  -H "Authorization: Bearer YOUR_JWT"
TypeScript SDK
const logs = await mql.analytics.getUsageLogs('proxy_key_id');
Python SDK
logs = mql.analytics.get_usage_logs("proxy_key_id")

Organization Analytics

GET/v1/organizations/:org_id/analytics/overview
GET/v1/organizations/:org_id/analytics/timeseries

Get analytics scoped to a specific organization rather than your personal account.

TypeScript SDK
const orgOverview = await mql.analytics.getOrgOverview('org_id');
const orgTimeseries = await mql.analytics.getOrgTimeseries('org_id', {
  range: '30d'
});
Python SDK
org_overview = mql.analytics.get_org_overview("org_id")
org_timeseries = mql.analytics.get_org_timeseries("org_id",
    start_date="2025-01-01",
)

SDK & CLI Reference

OperationTypeScriptPythonCLI
Overviewmql.analytics.getOverview()mql.analytics.get_overview()mql analytics overview
Timeseriesmql.analytics.getTimeseries()mql.analytics.get_timeseries()
Providersmql.analytics.getProviderStats()mql.analytics.get_provider_stats()
Usage logsmql.analytics.getUsageLogs(id)mql.analytics.get_usage_logs(id)
Org overviewmql.analytics.getOrgOverview(org)mql.analytics.get_org_overview(org)