Cost Analytics

Incompatible with
on-prem

Konnect Metering & Billing includes a built-in LLM cost database and cost analytics to help you track the actual cost of metered usage. These are useful when you are deciding what to charge for a feature. You can use the LLM cost database and cost analytics to determine how much a feature costs your company and use that information to decide how much to charge customers.

LLM cost database

The LLM cost database is a built-in, automatically updated catalog of per-token pricing for major LLM providers and models. The database pulls costs from each provider’s pricing information, unless you override it with custom costs. It allows you to calculate the real cost of LLM token usage without manually maintaining price lists.

Supported providers

The database includes pricing for the following providers:

Provider

Example models

OpenAI GPT-4, GPT-4o, GPT-3.5 Turbo, o1, o3
Anthropic Claude 3.5 Sonnet, Claude 3 Opus, Claude 3 Haiku
Google Gemini 1.5 Pro, Gemini 1.5 Flash
Mistral Mistral Large, Mistral Small, Mixtral
Cohere Command R+, Command R
DeepSeek DeepSeek V3, DeepSeek R1
xAI Grok
Ollama Self-hosted models
Minimax MiniMax models

Token types

LLM pricing varies by token type. The cost database tracks pricing for the following token types:

Token type

Description

Input Tokens sent to the model in the prompt. Also known as request tokens.
Output Tokens generated by the model in the response. Also known as response tokens.
Cache read Tokens served from the provider’s prompt cache, typically cheaper than regular input tokens.
Cache write Tokens written to the provider’s prompt cache.
Reasoning Tokens used for chain-of-thought reasoning in reasoning models (for example, o1, DeepSeek R1).

Price sources

Each price in the database has a source that indicates how it was set:

Source

Description

System Automatically synced from external pricing sources. These prices are kept up to date as providers change their pricing.
Manual Manually configured by a user. Use manual prices for models or providers that aren’t in the system database.

Effective dates

Prices include effective_from and effective_to timestamps. This allows the database to track historical pricing changes. When a provider updates their prices, a new price entry is created with a new effective date, and the previous entry’s effective_to is set accordingly. Cost calculations use the price that was effective at the time of usage.

Browsing the cost database

To view the LLM cost database in Konnect, do the following:

  1. In the Konnect sidebar, click Metering & Billing.
  2. In the Metering & Billing sidebar, click Cost Analytics.
  3. Click the LLM Cost tab.
  4. Browse or search by provider name or model name.

The table shows each model’s input and output token pricing, the price source, and the effective date.

Price overrides

You can create per-org price overrides to customize pricing for specific provider and model combinations. Overrides take precedence over system prices when calculating costs. A common use cases for overrides is when you’ve a negotiated rate with a provider that differs from their public pricing.

To create a price override, do the following:

  1. In the Konnect sidebar, click Metering & Billing.
  2. In the Metering & Billing sidebar, click Cost Analytics.
  3. Click the LLM Cost tab.
  4. Find the model you want to override and select “Override” from the actions menu.
  5. Enter your custom per-token pricing for the relevant token types (input, output, cache read, cache write, reasoning).
  6. Click Save.

To view and manage existing overrides, click the Show Overrides on the LLM Cost page. You can delete an override to revert to the system price.

Cost analytics queries

Cost analytics lets you query and visualize the computed cost of feature usage over time. It is available for any feature that has a unit cost configured. Metering & Billing computes the total cost by multiplying usage by the per-unit price.

You can group cost data by customer, subject, or custom dimensions (using the group by dimension, such as model, provider, or region). Each entry shows the metered usage value for the period, the computed cost in the configured currency, and the group by dimensions values.

View cost analytics

To see cost analytics, do the following:

  1. In the Konnect sidebar, click Metering & Billing.
  2. In the Metering & Billing sidebar, click Cost Analytics.
  3. Select a feature from the dropdown. Only features with a unit cost configured are shown.

You will see that feature’s cost breakdown by the filters you’ve selected.

Filtering

You can filter cost analytics data by:

Filter

Description

Feature Select which feature to analyze. Only features with unit cost are available.
Date range Set the time period to analyze with start and end dates.
Window size Choose the aggregation granularity: minute, hour, day, or month.
Customer Filter by one or more customers.
Subject Filter by one or more subjects.
Group by Filter by group by values.

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!