Skip to main content
Phoenix allows you to track token-based costs for LLM runs automatically. The costs are calculated from token counts and model pricing data, then rolled up to the trace and project level for comprehensive cost analysis. In most cases it is simplest to let Phoenix handle cost calculation using its built-in model pricing table. When custom pricing is required, you can create custom cost configurations in Settings > Models.

Send token counts

For Phoenix to accurately derive costs for LLM spans, you need to provide token counts in your traces:
  • If you are using OpenInference auto-instrumentation with OpenAI, Anthropic, or other supported instrumentation, token counts and model information are automatically captured.
  • If you are manually instrumenting your code, you should include the appropriate token count attributes in your spans.
  • If you are using OpenTelemetry directly, ensure that your LLM spans include the OpenInference semantic conventions for token counts.

Required span attributes for cost tracking

Phoenix uses the OpenInference semantic conventions for cost tracking. The following attributes are required:

Basic token counts

Model information

Detailed token breakdown (optional)

For more granular cost tracking, you can provide detailed token counts:

Prompt token details

Completion token details

Model pricing configuration

Phoenix includes a comprehensive model pricing table with built-in support for popular models from:
  • OpenAI: GPT-3.5, GPT-4, GPT-4 Turbo, GPT-4o, GPT-5, and newer models
  • Anthropic: Claude 1.x, Claude 2.x, Claude 3.x, Claude 3.5, Claude 4.x models
  • Google: Gemini 1.x, Gemini 2.x, Gemini 3.x models
  • Cerebras: Llama, Qwen, and other Cerebras-hosted models
  • Fireworks AI: Fireworks-hosted open-source and proprietary models
  • Groq: Llama, Mixtral, Gemma, and other Groq-hosted models
  • Moonshot (Kimi): Moonshot Kimi models
  • Other providers: Additional models as they become available

Keeping built-in prices current

The built-in pricing table is generated from LiteLLM’s model price list and kept up to date on Phoenix’s main branch. You don’t need to upgrade Phoenix to get new models and prices: shortly after startup, and then about once a day, the Phoenix server fetches the latest table from GitHub and applies it if it’s newer than the one it has. A Phoenix release also ships with a copy of the table, which is applied at startup only if it’s newer than the prices already in the database, so upgrading or restarting never rolls prices back. The fetch runs in the background and never delays startup. If it fails, Phoenix logs a warning and keeps using the prices it already has. Settings → Models shows when the built-in prices in use were generated, for example “Built-in prices from Oct 14, 2026”.
Costs are calculated when a span is ingested. New prices apply only to spans received after they’re applied; costs already recorded aren’t recalculated.
Custom models you add in Settings → Models are never changed by an update, and they take precedence over built-in models that match the same name. To turn off automatic updates, set PHOENIX_DISABLE_MODEL_COST_AUTO_UPDATE=true on the Phoenix server. Phoenix also skips them when PHOENIX_ALLOW_EXTERNAL_RESOURCES=false, as in air-gapped deployments. Either way, built-in prices then change only when you upgrade Phoenix, which still brings the bundled prices up to date.

Managing model prices

You can view and manage model pricing through the Phoenix UI:
1
Navigate to Settings → Models in the Phoenix interface
2
View existing models and their pricing information
3
Add custom models or override pricing for existing models
4
Set different prices for prompt (input) and completion (output) tokens

Adding a custom model

To add pricing for a model not in the built-in table:
  1. Click Add new model in the Models settings page
  2. Fill in the model details:
    • Model Name: Human-readable name for the model
    • Name Pattern: Regex pattern to match the model name in traces
    • Provider: Model provider (optional)
    • Prompt (Input) Cost: Cost per 1M input tokens
    • Completion (Output) Cost: Cost per 1M output tokens
    • Start Date: When this pricing becomes effective (optional)

Advanced pricing configuration

For models with complex pricing structures, you can configure detailed token pricing:
  • Prompt Price Breakdown: Different rates for cache_read, cache_write, audio, image, video tokens
  • Completion Price Breakdown: Different rates for reasoning, audio, image tokens
  • Provider Matching: Match models by provider to avoid naming conflicts

Viewing cost data

Once configured, Phoenix automatically displays cost information throughout the interface:

Trace-level costs

  • Total cost for the entire trace
  • Breakdown by prompt vs completion costs

Span-level costs

  • Individual span costs with detailed breakdowns
  • Token type-specific cost details

Session-level costs

  • Aggregated costs across all traces within a session
  • Session-based cost analysis for multi-turn conversations
  • Cost tracking for extended user interactions

Experiment-level costs

Phoenix automatically tracks costs for traced experiments, providing detailed cost analysis across experiment runs:
  • Total experiment cost: Sum of all LLM costs across all experiment runs
  • Cost per experiment run: Individual cost for each dataset example run through an experiment Experiment costs are automatically calculated when you:
  1. Run experiments on datasets through Phoenix
  2. Include proper token count and model information in your traced LLM calls
  3. Have model pricing configured for the models used in experiments

Project-level analytics

  • Total costs across all traces in a project
  • Cost trends over time (coming-soon)
  • Most expensive models (coming-soon)