Usage & analytics
See what you spend, the mix of request types your traffic generates, and which application made each call — with no client setup beyond an optional header.
Usage & spend
Section titled “Usage & spend”The Overview summarizes requests, input and output tokens, and spend over a time window, each with a trend against the prior period. When caching is active it adds a savings strip and a cache timeline.
Analytics by request type
Section titled “Analytics by request type”DI Analytics breaks your traffic down by the request type each call was classified as — the same vocabulary returned per request in the X-DI-Request-Type header. The model behind each type stays private; the type itself is yours to analyze.
vision document long code json reason flash pro
Traces
Section titled “Traces”Traces lists individual requests — timestamp, endpoint, the model id you sent, request type, tokens, cost, cache breakdown, and latency — and each row expands to the raw request and response. Consistent with the rest of the platform, a trace shows your call and how it was classified, never the backend model that served it.
Per-application attribution
Section titled “Per-application attribution”Usage is automatically grouped by application so one key can power several apps and still report separately. The label comes from X-Title if you send it, otherwise the request’s Referer host (browser and web apps send this automatically), falling back to the API key’s name — so attribution works even with zero setup.
client = OpenAI( api_key="llm_live_...", base_url="https://api.directinference.com/di/v1", default_headers={"X-Title": "billing-worker"}, # names this app in analytics)const client = new OpenAI({ apiKey: "llm_live_...", baseURL: "https://api.directinference.com/di/v1", defaultHeaders: { "X-Title": "billing-worker" }, // names this app in analytics});curl https://api.directinference.com/di/v1/chat/completions \ -H "Authorization: Bearer llm_live_..." \ -H "X-Title: billing-worker" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.5-mini", "messages": [{ "role": "user", "content": "..." }] }'echo '{ "model": "gpt-5.5-mini", "messages": [{ "role": "user", "content": "..." }] }' \ | https POST api.directinference.com/di/v1/chat/completions \ Authorization:'Bearer llm_live_...' \ X-Title:billing-worker \ Content-Type:application/jsonREST API
Section titled “REST API”The same usage and per-request cost the dashboard shows are also available programmatically under your normal llm_live_... key — no portal session required. Both endpoints are read-only, scoped to your account, and exist on the root and …/di surfaces. For your balance, see Spend & limits.
Aggregate usage — GET /v1/usage
Section titled “Aggregate usage — GET /v1/usage”Spend and token counts bucketed by day (default), request_type, application, or api_key, optionally bounded by start_date / end_date (each YYYY-MM-DD or RFC 3339; a date-only end_date is inclusive). cost is your charge in USD.
curl "https://api.directinference.com/v1/usage?group_by=day&start_date=2026-06-01" \ -H "Authorization: Bearer llm_live_..."{ "object": "usage", "group_by": "day", "start_date": "2026-06-01T00:00:00Z", "data": [ { "bucket": "2026-06-01", "requests": 1234, "input_tokens": 90000, "output_tokens": 30000, "total_tokens": 120000, "cached_input_tokens": 4096, "cost": "1.840000" } ]}The request_type axis uses the same vocabulary as X-DI-Request-Type; the backend model is never part of a bucket. An unknown group_by returns 400.
Per-request cost — GET /v1/generation?id=
Section titled “Per-request cost — GET /v1/generation?id=”Look one call up by the id it returned in its response body — useful for attributing cost to a specific request after the fact.
curl "https://api.directinference.com/v1/generation?id=chatcmpl-..." \ -H "Authorization: Bearer llm_live_..."{ "id": "chatcmpl-...", "request_type": "code", "created_at": "2026-06-14T22:55:00Z", "streamed": false, "finish_reason": "stop", "total_cost": "0.001230", "usage": { "prompt_tokens": 100, "completion_tokens": 50, "total_tokens": 150, "cached_prompt_tokens": 0, "reasoning_tokens": 0 }, "latency_ms": 200, "generation_time_ms": 1500}A missing id returns 400; an unknown or another account’s id returns 404. As everywhere, total_cost is your charge — no provider, model, or upstream cost is included.