Usage & Cost Analytics

Real-time usage summaries, time-series data, cost tracking, and breakdowns by app, team, model, provider, user, or session.

Overview

Ingate aggregates recorded exchanges and available cost estimates from observed token counts and configured prices. Unknown or incomplete accounting is not free usage or a complete invoice. Usage data can be queried as summaries, time-series, or breakdowns across multiple dimensions. All analytics endpoints are scoped to the current organization and require a valid API key.

Analytics data powers both the API responses documented below and the built-in Dashboard Views available in the Ingate console.

Usage Summary

GET
/api/v1/usage/summary

Aggregate usage statistics for the current org.

ParameterTypeDefaultDescription
sinceRFC333930 days agoStart of time range
untilRFC3339nowEnd of time range
app_idUUIDoptionalFilter by app
team_idUUIDoptionalFilter by team
providerstringoptionalFilter by provider name
modelstringoptionalFilter by model name
user_idstringoptionalFilter by end-user ID (passed via X-Ingate-User-Id header)
session_idstringoptionalFilter by session ID (passed via X-Ingate-Session-Id header)
bash
curl "https://api.ingateai.com/api/v1/usage/summary?since=2026-03-01T00:00:00Z" \
  -H "Authorization: Bearer <token>"
jsonIllustrative response
{
  "total_requests": 2, "total_tokens": 15, "total_cost": null, "unpriced_rows": 2,
  "avg_latency_ms": 432, "error_count": 0, "error_rate": 0,
  "period": {"since": "2026-03-01T00:00:00Z", "until": "2026-04-01T00:00:00Z", "default_window": false},
  "cached_input_tokens": null, "cache_write_input_tokens": null, "reasoning_tokens": null,
  "input_tokens_observed_rows": 1, "output_tokens_observed_rows": 1,
  "cached_input_tokens_observed_rows": 0, "cache_write_input_tokens_observed_rows": 0,
  "reasoning_tokens_observed_rows": 0, "cache_hit_ratio_eligible_rows": 0, "cache_hit_ratio_scoped_rows": 2,
  "cache_hit_ratio": null, "cache_hit_ratio_reason": "no_cached_tokens_reported"
}

Time-Series

GET
/api/v1/usage/timeseries

Usage data bucketed by time period.

Returns usage metrics grouped into fixed-width time buckets. The granularity parameter controls bucket width: hour (default) or day. All summary filters (since, until, app_id,team_id, provider, model, user_id,session_id) apply.

bash
curl "https://api.ingateai.com/api/v1/usage/timeseries?granularity=day&since=2026-03-01T00:00:00Z" \
  -H "Authorization: Bearer <token>"
jsonIllustrative response
{
  "granularity": "day", "period": {"since": "2026-03-01T00:00:00Z", "until": "2026-04-01T00:00:00Z", "default_window": false},
  "buckets": [{
    "timestamp": "2026-03-01T00:00:00Z", "requests": 2, "tokens": 15,
    "cost": 0.01, "unpriced_rows": 1, "errors": 0, "avg_latency_ms": 432,
    "cached_input_tokens": null, "cache_write_input_tokens": null, "reasoning_tokens": null,
    "input_tokens_observed_rows": 1, "output_tokens_observed_rows": 1,
    "cached_input_tokens_observed_rows": 0, "cache_write_input_tokens_observed_rows": 0,
    "reasoning_tokens_observed_rows": 0, "cache_hit_ratio_eligible_rows": 0, "cache_hit_ratio_scoped_rows": 2,
    "cache_hit_ratio": null, "cache_hit_ratio_reason": "no_cached_tokens_reported"
  }]
}

Breakdown

GET
/api/v1/usage/breakdown

Usage grouped by a dimension.

The group_by parameter is required. Valid values:

ValueGroups by
appApplication
teamTeam
modelModel name
providerProvider name
userEnd-user ID
sessionSession ID

All summary filters apply. Results are sorted by total_requests descending and limited to the top 100 groups by default (use limit to adjust).

bash
# Breakdown by model for the last 7 days
curl "https://api.ingateai.com/api/v1/usage/breakdown?group_by=model&since=2026-03-28T00:00:00Z" \
  -H "Authorization: Bearer <token>"
jsonIllustrative response
{
  "group_by": "model", "period": {"since": "2026-03-01T00:00:00Z", "until": "2026-04-01T00:00:00Z", "default_window": false},
  "items": [{
    "key": "illustrative-model", "total_requests": 2, "total_tokens": 15,
    "total_cost": 0, "unpriced_rows": 0, "error_count": 0, "avg_latency_ms": 432,
    "cached_input_tokens": null, "cache_write_input_tokens": null, "reasoning_tokens": null,
    "input_tokens_observed_rows": 1, "output_tokens_observed_rows": 1,
    "cached_input_tokens_observed_rows": 0, "cache_write_input_tokens_observed_rows": 0,
    "reasoning_tokens_observed_rows": 0, "cache_hit_ratio_eligible_rows": 0, "cache_hit_ratio_scoped_rows": 2,
    "cache_hit_ratio": null, "cache_hit_ratio_reason": "no_cached_tokens_reported"
  }]
}
bash
# Per-user breakdown for a specific app
curl "https://api.ingateai.com/api/v1/usage/breakdown?group_by=user&app_id=app-uuid-here" \
  -H "Authorization: Bearer <token>"

Cost Tracking

Cost availability

Plan entitlement, available model pricing and observed counts determine cost availability. Inspect actual nullable fields instead of treating an absent estimate as zero.

Costs use observed token classes and the available price table. A missing model price or unusable usage can leave cost null. Aggregate total_cost sums priced rows only; inspect unpriced_rows. The examples show an unpriced summary, partially priced bucket, and known-zero group. A bare token total cannot determine input/output pricing or full billing coverage.

cache_hit_ratio describes provider token caching only. OpenAI/Gemini use cached_over_input_tokens; Anthropic uses cached_over_billed_input_tokens, whose denominator includes uncached input, cache reads and cache writes. Do not add OpenAI cached-input or reasoning subsets to totals again. Inspect observed-row counts and eligible/scoped coverage. Mixed conventions return null with mixed_usage_conventions; missing classes stay null, while explicit zero remains observed. A null ratio carries cache_hit_ratio_reason; a usable ratio carries cache_hit_ratio_basis. Neither measures response reuse or savings.

jsonIllustrative selected summary fields: priced, complete OpenAI cache coverage
{
  "total_requests": 1, "total_tokens": 15, "total_cost": 0.01, "unpriced_rows": 0,
  "cached_input_tokens": 2, "cache_hit_ratio": 0.2, "cache_hit_ratio_basis": "cached_over_input_tokens",
  "cache_hit_ratio_eligible_rows": 1, "cache_hit_ratio_scoped_rows": 1
}
jsonIllustrative selected summary fields: mixed conventions
{
  "total_requests": 2, "total_cost": 0.02, "unpriced_rows": 0,
  "cache_hit_ratio": null, "cache_hit_ratio_reason": "mixed_usage_conventions",
  "cache_hit_ratio_eligible_rows": 2, "cache_hit_ratio_scoped_rows": 2
}

Native cache-cost evidence

This source-qualified contract requires the matching collector and service described in native collection setup. Inspect each stored metadata.token_pricing record: cost_basis: api_equivalent_estimate, rate_source, price_table_version and the detached rates snapshot describe the configured estimate. They do not establish a subscription charge, invoice, current billing tier or measured savings. Estimates are not upper bounds and do not turn budgets into provider billing caps.

ConventionInterpretation
OpenAI / GeminiCached input is inside input; reasoning is inside output. Do not add subsets again.
AnthropicCache reads and writes are beside ordinary input; reasoning is inside output.
Five-minute / one-hourThese are partitions of cache writes, never extra tokens. Their complete sum must match aggregate writes.

Native Claude lifetime fields are labelled cache_write_ttl_source: client_reported. Captured Anthropic provider usage takes priority; caller tags or pricing metadata cannot invent a lifetime. Inspect cache_write_ttl, nullable cached_inside_input and cache_write_inside_input alongside usage and pricing versions. Missing/null observations are unknown; explicit zero is observed zero, not a missing value.

Complete reported partitions use configured lifetime rates. Partial or inconsistent partitions leave cost unavailable with cache_write_ttl_incomplete or cache_write_ttl_mismatch. Missing models remain unpriced; an unavailable calculator preserves reported lifetime evidence with rate_source: unavailable_calculator. Other supported fallback paths can still return a numeric partial estimate: aggregate-only Anthropic writes use the shortest configured write rate and an assumption; unknown cache rates can use ordinary input rates with disclosed assumptions. Inspect actual assumptions and refusal reasons. Numeric cost does not prove all classes were observed or billed.

Previously stored records keep their historical estimate and rate evidence. Upgrading or canonical replay does not backfill or reprice them. Read stored rows to confirm asynchronous persistence; a checkpoint records terminal intake outcomes. For uncertain admission, reconcile the scoped identity or applicable receipt before retrying unchanged input. Do not delete a checkpoint to force replay. These observations do not route native subscription inference or provide strict unknown-cost budget enforcement.

Supported Models

ProviderModels
OpenAIgpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-4, gpt-3.5-turbo, o1, o1-mini, o3-mini, o4-mini
Anthropicclaude-sonnet-4-20250514, claude-3.5-sonnet, claude-3.5-haiku, claude-3-opus, claude-3-sonnet, claude-3-haiku
OllamaKnown zero only where the configured model price establishes it

Deployment price table

Query the active table below; do not assume every new model has a known price or that the table refreshes itself. Values are estimates, not verified invoices or measured savings.

Price Table API

GET
/api/v1/cost/prices

Returns the current price table with per-million-token rates.

bash
curl "https://api.ingateai.com/api/v1/cost/prices" \
  -H "Authorization: Bearer <token>"
jsonIllustrative response
{
  "openai:gpt-4o": {"input_per_m_token": 2.5, "output_per_m_token": 10}
}

Dashboard Views

The shipped dashboard is under /ui/; its usage view is /ui/#/usage. It offers 7/30/90-day presets, hour/day buckets, requests and total-token charts, and provider/model/app breakdowns. The API supports additional filters documented above.

Use the overview for recorded request/token summaries and mean latency. The public usage structs expose nullable cost and provider-token cache coverage; they do not promise a percentile-latency chart or a gateway response-cache hit widget.

Reading partial accounting

Compare the selected period, unpriced rows and observed-row coverage alongside totals. Missing usage is not zero; a priced subset is not complete billing. Enabling the dashboard's optional auto-refresh does not make asynchronous capture complete or crash-safe.