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
/api/v1/usage/summaryAggregate usage statistics for the current org.
| Parameter | Type | Default | Description |
|---|---|---|---|
since | RFC3339 | 30 days ago | Start of time range |
until | RFC3339 | now | End of time range |
app_id | UUID | optional | Filter by app |
team_id | UUID | optional | Filter by team |
provider | string | optional | Filter by provider name |
model | string | optional | Filter by model name |
user_id | string | optional | Filter by end-user ID (passed via X-Ingate-User-Id header) |
session_id | string | optional | Filter by session ID (passed via X-Ingate-Session-Id header) |
curl "https://api.ingateai.com/api/v1/usage/summary?since=2026-03-01T00:00:00Z" \
-H "Authorization: Bearer <token>"{
"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
/api/v1/usage/timeseriesUsage 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.
curl "https://api.ingateai.com/api/v1/usage/timeseries?granularity=day&since=2026-03-01T00:00:00Z" \
-H "Authorization: Bearer <token>"{
"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
/api/v1/usage/breakdownUsage grouped by a dimension.
The group_by parameter is required. Valid values:
| Value | Groups by |
|---|---|
app | Application |
team | Team |
model | Model name |
provider | Provider name |
user | End-user ID |
session | Session 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).
# 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>"{
"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"
}]
}# 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
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.
{
"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
}{
"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.
| Convention | Interpretation |
|---|---|
| OpenAI / Gemini | Cached input is inside input; reasoning is inside output. Do not add subsets again. |
| Anthropic | Cache reads and writes are beside ordinary input; reasoning is inside output. |
| Five-minute / one-hour | These 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
| Provider | Models |
|---|---|
| OpenAI | gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-4, gpt-3.5-turbo, o1, o1-mini, o3-mini, o4-mini |
| Anthropic | claude-sonnet-4-20250514, claude-3.5-sonnet, claude-3.5-haiku, claude-3-opus, claude-3-sonnet, claude-3-haiku |
| Ollama | Known zero only where the configured model price establishes it |
Deployment price table
Price Table API
/api/v1/cost/pricesReturns the current price table with per-million-token rates.
curl "https://api.ingateai.com/api/v1/cost/prices" \
-H "Authorization: Bearer <token>"{
"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