Prompt

How do I track token usage across multiple AI apps and teams?

Artificial Intelligence / AI Infrastructure2 observationsLast seen Oct 24, 2026

Latest observation

Oct 24, 2026OpenAI APIWeb search: off

To track token usage across multiple AI apps and teams, you need a setup that gives you:

  1. A single source of truth
  2. Usage split by app/team/user
  3. Real-time or near-real-time cost visibility
  4. Alerts and budgets
  5. Easy reporting for finance and engineering

Here’s a practical way to do it.


1) Standardize how every request is identified

The biggest mistake is letting each app log usage differently. Instead, enforce a common structure for every AI request:

  • App name: support-bot, sales-copilot, research-tool
  • Team / department: support, sales, product
  • Environment: prod, staging, dev
  • User ID / account ID: internal user or customer
  • Request ID / trace ID: unique per call
  • Model name: gpt-4.1, gpt-4o-mini, etc.
  • Token counts:
    • input tokens
    • output tokens
    • total tokens
  • Cost: calculated from model pricing at request time

If all apps send these fields into a common logging pipeline, reporting becomes straightforward.


2) Capture usage at the API gateway or wrapper layer

There are three common places to measure token usage:

Option A: At the AI gateway

If all AI traffic goes through one gateway/proxy, this is the easiest approach.

Pros:

  • Centralized
  • Works across multiple apps and teams
  • Easier enforcement of quotas and rate limits

Cons:

  • Requires routing all traffic through the gateway

Option B: In a shared SDK/wrapper

Provide a standard client library that every app uses to call AI providers.

Pros:

  • Easy to enrich logs with app/team metadata
  • Works even if you use multiple providers

Cons:

  • Teams can bypass it unless enforced

Option C: From provider billing/usage APIs

Use OpenAI/Anthropic/etc. usage endpoints or billing exports.

Pros:

  • Good for reconciliation
  • Source of truth for provider-side totals

Cons:

  • Usually not enough detail by app/team unless you add metadata and correlate later

Best practice: use both:

  • gateway/wrapper logs for per-request detail
  • provider billing exports for reconciliation

3) Store usage in a central data store

Put all usage events into one place, such as:

  • Postgres / MySQL for smaller setups
  • BigQuery / Snowflake / Redshift for larger orgs
  • Datadog / ELK / Grafana Loki for observability
  • A warehouse + BI tool for finance reporting

A typical table might include:

timestampappteamenvuser_idmodelinput_tokensoutput_tokenstotal_tokenscost_usdrequest_id

This enables:

  • usage by team
  • usage by app
  • usage by model
  • usage over time
  • user-level breakdowns
  • anomaly detection

4) Tag usage with metadata and cost centers

To make chargeback/showback work, map each app to a cost center or budget owner.

Example:

  • support-bot → Support team
  • internal-research → R&D
  • customer-facing-chat → Product team

Add tags like:

  • cost_center
  • project
  • customer_id (if applicable)
  • campaign
  • region

This lets you answer:

  • “How much did Sales spend last month?”
  • “Which app is driving the most token usage?”
  • “Which customer uses the most expensive prompts?”

5) Build dashboards for different audiences

You’ll usually want separate views:

Engineering dashboard

  • tokens per request
  • top apps by volume
  • error rates
  • latency
  • model mix
  • prompt/output distributions

Team/manager dashboard

  • daily/weekly token usage
  • spend vs budget
  • usage trend by project
  • top users or workloads

Finance dashboard

  • monthly spend
  • forecasted spend
  • cost by department
  • budget variances
  • provider reconciliation

Tools commonly used:

  • Grafana
  • Metabase
  • Looker
  • Tableau
  • Power BI

6) Set budgets, alerts, and guardrails

Once you can measure usage, enforce policies:

  • Monthly budget per team/app
  • Daily soft limits
  • Hard cutoffs for runaway workloads
  • Alerting on spikes
  • Alerting on unusual model usage
  • Alerting when a team is close to budget

Example alerts:

  • “Support bot exceeded 80% of monthly budget”
  • “Token usage doubled in the last 24 hours”
  • “A dev environment is using production-rate volume”

7) Normalize costs across providers and models

If you use multiple AI providers, cost tracking gets trickier because each model has different pricing.

Create a pricing table:

  • provider
  • model
  • input token price
  • output token price
  • effective date

Then compute cost centrally based on:

  • actual token usage
  • pricing in effect at the time
  • any cached/reused tokens if relevant

This ensures consistent reporting even if pricing changes.


8) Use sampling only for analytics, not billing

If you need detailed prompt/response logging for analysis, consider:

  • logging metadata for all requests
  • storing full prompts/responses only for sampled or approved traffic

Reason:

  • privacy
  • storage cost
  • compliance risk

For billing/showback, always log usage metadata for every request.


9) Recommended architecture

A simple scalable architecture:

  1. App calls shared AI SDK or gateway
  2. Gateway logs request metadata + token usage
  3. Events go to streaming/logging system
  4. Data lands in warehouse
  5. Scheduled jobs enrich with pricing and team mapping
  6. Dashboards and alerts read from warehouse

10) If you want the simplest implementation

Start with this minimum viable setup:

  • Require every app to send:
    • app name
    • team
    • request ID
    • model
    • token counts
  • Log to a shared database or warehouse
  • Add a daily job that:
    • calculates cost
    • aggregates by app/team
  • Build one dashboard
  • Add budget alerts

That alone gets you 80% of the value.


Example schema

CREATE TABLE ai_usage_events (
  id BIGSERIAL PRIMARY KEY,
  timestamp TIMESTAMP NOT NULL,
  app_name TEXT NOT NULL,
  team_name TEXT NOT NULL,
  environment TEXT NOT NULL,
  user_id TEXT,
  request_id TEXT NOT NULL,
  provider TEXT NOT NULL,
  model TEXT NOT NULL,
  input_tokens INT NOT NULL,
  output_tokens INT NOT NULL,
  total_tokens INT NOT NULL,
  cost_usd NUMERIC(12,6) NOT NULL,
  metadata JSONB
);

Example aggregation query

SELECT
  team_name,
  app_name,
  DATE_TRUNC('month', timestamp) AS month,
  SUM(total_tokens) AS total_tokens,
  SUM(cost_usd) AS total_cost_usd
FROM ai_usage_events
GROUP BY 1, 2, 3
ORDER BY total_cost_usd DESC;

Key best practices

  • Enforce consistent metadata across apps
  • Centralize logging
  • Track usage per request, not just per invoice
  • Reconcile with provider billing data
  • Use budgets and alerts
  • Separate dev/test/prod
  • Keep privacy and compliance in mind

If you want, I can also give you:

  1. a tool comparison for token tracking platforms,
  2. a reference architecture for AWS/GCP/Azure,
  3. or a ready-to-use database schema + dashboard plan.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (2 observations for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.