Analytics and debugging in AI Cost Management

AI Cost Management records the cost of each AI request that passes through AI Gateway as a usage event. If you need to see where AI spend goes, or check what the gateway reported for a request, you can use the Cost Management > Dashboard views in Konnect. They include an overview dashboard, an events explorer, and a debugger to further dig into individual events.

The views read stored usage events, so a request can take a short time to appear after it finishes. All times in the console are in UTC.

An event is considered late when it reaches AI Cost Management more than one hour after its time. AI Cost Management groups spend by the time of the event, so a late event changes the total for a period you’ve already viewed.

How the views relate

The views read the same usage events, and each answers a different question:

View

What it shows

When to use it

Access

My Usage The current user’s own spend. To check your own spend. Individual, Team manager, Admin
Dashboard Organization-wide spend, projected spend, budget status, and spend grouped by user, group, team, provider, model, harness, or tag. To check overall spend, find where it goes, and see which budgets are close to their limits. Team manager, Admin
Explorer Spend, requests, or tokens over time, grouped by one dimension. To answer a specific question, for example which model costs the most each day. Team manager, Admin
Events debugger The individual usage events, with their cost, tokens, user, and model. To check what the gateway reported for a request, or to find out why a cost or a user is missing. Admin

My Usage

My Usage shows your own spend. To open it, click Cost Management > My Usage in the sidebar.

Konnect links your account to your AI identity when you send your first request through AI Gateway. Your spend appears in My Usage after that request.

Dashboard

The Dashboard summarizes spend for a time range and shows where it goes. The chart and breakdown update every minute, and Refresh reloads every section.

Topic

What it shows

Spend over time Cumulative spend for the selected time range, compared with the previous period when one exists. For the current month, the chart also shows projected spend and the spending ceiling.

Unpriced calls (requests that reported tokens but have a cost of zero) are tracked separately from total spend.
Projection Predicted spend for the current UTC month and how far it is above or below the ceiling, regardless of the time range you select.
  • The ceiling is the limit set by an organization-wide monthly budget.
  • The projection is an estimate and requires at least two completed days of usage. See Budgets.
Where is it going? Spend broken down by a primary dimension, with an optional secondary dimension. You can group by users, groups, teams, providers, models, harnesses, or tags. Usage with no user appears as Unattributed.

When you group by Groups, shares can add up to more than 100% because an event counts under each of its groups.
Which budgets are at risk? Each budget ranked by the share of its limit that spend has consumed. See Budgets.

Explorer

The Explorer shows spend, requests, or tokens over time for any combination of filters and group-by dimensions. For traffic, latency, and error metrics, use the Observability Explorer.

Control

What it does

Group by The dimension to split the results by.
Add filter Narrows the events. See Filters and dimensions.
Time range The same presets as the Dashboard.
Granularity The size of each chart bucket: hour, day, week, or month. The default is Day.
Chart What the chart plots: Spend, Requests, Input tokens, Cached input tokens, or Output tokens.

The chart shows stacked bars, one series for each of the ten largest groups and an Other series for the rest. The group table title includes the dimension, for example Spend by User, and lists each group with its share, spend, requests, and tokens. Usage with no user appears with an unattributed badge. The query endpoint (POST /v1/ai-cost-management/events/query) supports the same grouping and filtering.

Events debugger

The Events debugger lists the individual usage events in the time range, newest first. You can narrow the list with filters. See Filters and dimensions.

You can select a row to open the Usage event panel, which shows the full event details.

Here’s what a sample event might look like. For the full schema, see the /v1/ai-cost-management/events API reference.

{
  "specversion": "1.0",
  "type": "ai.usage.v1",
  "source": "//control-planes/7c4d8e9f-a1b2-c3d4-e5f6-789012345678",
  "id": "req-abc123def456/inv-xyz789ghi012",
  "subject": "principal/9a8b7c6d-5e4f-3a2b-1c0d-ef9876543210",
  "time": "2026-10-30T14:23:11.042Z",
  "data": {
    "quantities": {
      "input_text_tokens": "1834",
      "input_cache_read_tokens": "512",
      "output_text_tokens": "402"
    },
    "reported_cost": { "value": "0.004372", "currency": "USD" },
    "reported_cache_cost": { "value": "0.000512", "currency": "USD" },
    "context": {
      "provider": "anthropic",
      "model": "claude-sonnet-4-6",
      "model_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "request_mode": "stream",
      "region": "us-east-1",
      "client": "claude_code"
    },
    "provenance": {
      "request_id": "req-abc123def456",
      "service_id": "b3c4d5e6-f7a8-b9c0-d1e2-f3a4b5c6d7e8",
      "route_id": "c4d5e6f7-a8b9-c0d1-e2f3-a4b5c6d7e8f9",
      "consumer_id": "d5e6f7a8-b9c0-d1e2-f3a4-b5c6d7e8f9a0",
      "plugin_id": "e6f7a8b9-c0d1-e2f3-a4b5-c6d7e8f9a0b1",
      "plugin_name": "ai-proxy-advanced"
    },
    "tags": {
      "project": "payments-api",
      "environment": "production"
    },
    "groups": ["principal/f7a8b9c0-d1e2-f3a4-b5c6-d7e8f9a0b1c2"]
  }
}

Filters and dimensions

The Explorer, the Events debugger, and the usage events API filter events using the same fields. An event must match every filter you add.

Filter

Field

What it matches

Operators

Provider provider The AI provider that served the request. eq, neq, oeq, contains, ocontains
Model model The model that the provider reports as served. eq, neq, oeq, contains, ocontains
User subject The subject accountable for the usage, for example principal/{uuid}, consumer/{uuid}, or oidc/{sub}. An unattributed event has no subject. eq, neq, oeq, contains, ocontains, exists, nexists
Request mode request_mode How the request was served: stream, oneshot, or realtime. eq, neq, oeq, contains, ocontains
Harness client The client that sent the request, as the producer reported it. eq, neq, oeq, contains, ocontains
Source source The producer of the usage event: a gateway’s control plane, as control-planes/{uuid}, or a principal that reported usage. eq, neq, oeq, contains, ocontains
Service service_id The ID of the gateway service that handled the request. eq, neq, oeq
Route route_id The ID of the gateway route that handled the request. eq, neq, oeq
Consumer consumer_id The ID of the consumer that sent the request. eq, neq, oeq
Application application_id The ID of the application that sent the request. eq, neq, oeq
Consumer groups consumer_group_ids The IDs of the consumer groups that the consumer belongs to. eq, oeq
Groups groups The groups that the usage belongs to, as group references, for example principal/{uuid} or oidc/{group}. eq, oeq
Teams teams The teams the usage belongs to. eq, oeq
Tag tags.<key> The value of one tag on the event. The tag key is part of the field name, as tags.<key>. eq, neq, oeq, contains, ocontains, exists, nexists

The Events debugger has additional filters. In the API, these are available on the list endpoint only.

Filter

Field

What it matches

Operators

Price reported_cost The cost of the event, compared with an amount in US dollars. eq, gt, gte, lt, lte
Arrival arrival Whether the event arrived late or on_time. An event is late when it reaches AI Cost Management more than one hour after its time. eq, neq, oeq
Token usage tokens Whether the event reported a positive quantity of any token kind. exists, nexists

Troubleshoot missing or wrong data

The following table lists common symptoms in the views and what to check:

Symptom

Likely cause

What to check

No events appear Only successful gateway requests become usage events. Failed or canceled requests produce no event. Send a request that returns a successful response, wait a short time, and select Refresh.
An event has a cost of $0 The model had no price when the request ran, and AI Cost Management stores an omitted cost as zero. Check the model’s price in the price catalog, then send a new request. The Unpriced calls card counts these events.
A user shows as unattributed AI Gateway recorded no accepted identity for the request. Check that the request used a supported credential, for example a consumer, a principal, or an OIDC token. New requests are attributed, and earlier events stay unattributed. See Attribution to set up identity.
A total changed after you viewed it A late event arrived for a period that you already viewed. In the Events debugger, filter by Arrival to find late events.
Group shares add up to more than 100% Grouping by Groups counts an event under each of its groups. Group by another dimension to see shares that add up to 100%.

Query usage data with the API

You can also use the events API to query usage. A query can group by up to two dimensions and span up to 400 buckets.

To list the usage events that arrived late, send a GET request to the /v1/ai-cost-management/events endpoint with the arrival filter set to late:

curl -X GET "https://us.api.konghq.com/v1/ai-cost-management/events?filter%5Barrival%5D=late" \
     --no-progress-meter --fail-with-body  \
     -H "Authorization: Bearer $KONNECT_TOKEN"

To total the cost and the unpriced requests for each provider and day of a month, send a POST request to the /v1/ai-cost-management/events/query endpoint:

curl -X POST "https://us.api.konghq.com/v1/ai-cost-management/events/query" \
     --no-progress-meter --fail-with-body  \
     -H "Authorization: Bearer $KONNECT_TOKEN"\
     -H "Content-Type: application/json"\
     -H "Accept: application/json, application/problem+json" \
     --json '{
       "from": "2026-10-01T00:00:00Z",
       "to": "2026-11-01T00:00:00Z",
       "granularity": "P1D",
       "dimensions": [
         "provider"
       ],
       "measures": [
         "reported_cost",
         "unpriced_events"
       ]
     }'

Each group in the response has its dimensions and its measures, and a series of buckets when you set a granularity.

An event with no value for a dimension appears in the null group for that dimension, so unattributed usage is the null group of subject.

FAQs

A usage event has a cost of $0 when the model had no price at the time of the request, because AI Cost Management stores an omitted cost as zero. If the request reported tokens, the event counts toward unpriced calls.

To fix it, check the following:

  • Check that the model has a price in the price catalog.
  • Check if the AI Model target has any cost management settings. If even one target cost management setting is configured, AI Gateway prices the request from the target’s settings only. See How a request is priced.
  • Check when the request ran. An event keeps the cost that the gateway reported, so send a new request after you add a price.

A usage event is unattributed when AI Gateway recorded no accepted identity for the request, so the event has no user. The Dashboard includes this spend in Unattributed spend, and the Events debugger shows an unattributed badge on the event. A new request is attributed after you fix the identity setup, and earlier events stay unattributed.

AI Cost Management groups spend by the time of the usage event, and an event can arrive after its time has passed. An event is late when it reaches AI Cost Management more than one hour after its time, and a late event changes the total of a period you have already viewed. To find late events, filter the Events debugger by Arrival or use the arrival filter in the usage events API.

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!