Introduction

LLM Cost Tracker Documentation

LLM Cost Tracker is a drop-in SDK and dashboard that answers "where is my AI bill coming from" in under 5 minutes. You wrap your existing LLM calls with one function, and immediately get per-feature, per-user, and per-model cost attribution in a live dashboard.

New here? Start with the Quickstart — you'll have data flowing in under 5 minutes.

How it works

There are two parts to LLM Cost Tracker:

  • The SDK — a lightweight wrapper around your existing Anthropic, OpenAI, Google, xAI, DeepSeek, Meta, and Perplexity calls. One import, one function call. Zero change to your response handling.
  • The dashboard — a live view of your LLM spend broken down by feature, user, model, and time.

What it tracks

Every tracked call captures:

  • Model used
  • Input and output token counts
  • Cost in USD (calculated automatically per model)
  • Latency in milliseconds
  • Feature tag — what part of your app made the call
  • User ID — which of your users triggered the call
  • Prompt version — label your prompt variants to compare cost before and after changes

Supported models

LLM Cost Tracker automatically calculates cost for the following models:

  • Anthropic: claude-opus-4-7, claude-sonnet-4-6, claude-haiku-4-5, and legacy Claude 4.x models
  • OpenAI: gpt-5.5, gpt-5.4, gpt-5.4-mini, gpt-5.4-nano, gpt-5, gpt-5-mini, gpt-4.1, gpt-4.1-mini, gpt-4.1-nano, o3, o3-pro, o4-mini
  • Google: gemini-3.1-pro-preview, gemini-3.1-flash-lite-preview, gemini-3-flash-preview, gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite
  • xAI: grok-4.20, grok-4, grok-4-fast-reasoning, grok-4-fast-non-reasoning, grok-code-fast-1
  • DeepSeek: deepseek-v4-flash, deepseek-v4-pro
  • Meta: meta-llama/llama-4-scout, meta-llama/llama-4-maverick, meta-llama/llama-3.3-70b-instruct
  • Perplexity: sonar, sonar-pro, sonar-reasoning-pro, sonar-deep-research

If a model string is not recognised, the event is still logged with token counts — cost will show as unknown. New models are added regularly. Pricing last verified 2026-04-29.


Next steps