LLM cost tracking

LLM cost tracking tools: how they get the data and what they cost

LLM cost tracking tools get their numbers in one of three ways: a proxy that every request passes through (Helicone, Portkey, LiteLLM), an SDK that sends traces (Langfuse), or the provider's own usage and billing API (Costbrake, plus the OpenAI, Anthropic and OpenRouter consoles). That choice decides what each tool sees and whether it can stop spend.

Free tiers cover 10,000 requests on Helicone, 50k units on Langfuse and 10k logs on Portkey. Paid plans start at $79 a month for Helicone Pro, $29 for Langfuse Core, $49 for Portkey Production and $12 for Costbrake Pro.

Eight ways to track LLM cost, side by side

ToolHow it gets the dataWhat it seesCan it stop spend?Price
CostbrakeProvider usage and billing APIs; no proxySpend per provider, project, workspace or model, across 35 providersBrakes on 18 providers, after an admin confirmsFree $0; Pro $12 a month; Team $39 a month
HeliconeProxy, or async logging off the request pathEvery request with its tokens and costCost rate limits, proxy onlyHobby free (10,000 requests); Pro $79 a month; Team $799 a month
LangfuseSDKs, integrations or OpenTelemetryTraces with usage and cost per callNo; alerts notifyHobby free (50k units); Core $29 a month; Pro $199 a month
PortkeyAI gatewayLogs and cost per requestBudget limits expire a key (Enterprise, select Pro)Developer free (10k logs); Production $49 a month
LiteLLMSelf-hosted proxySpend per key, user and teamBudgets reject requests; needs a databaseOpen source; Enterprise through sales
OpenAI usage dashboard and APIBuilt into OpenAI; Admin keyUsage by project and line item; costs per dayHard spend limit returns a 429Built in
Anthropic Console and Usage and Cost APIBuilt into Anthropic; Admin APIUsage and cost, usually within 5 minutesWorkspace spend limit returns HTTP 400Built in
OpenRouter usage accountingBuilt into OpenRouterCost on every responsePer-key credit limitsBuilt in

Proxies and gateways: Helicone, Portkey and LiteLLM

A gateway sees each request as it happens, so it can tag cost by user, feature or customer and refuse a request before it costs anything. That is the strongest per-request control you can get. LiteLLM budgets reject requests once a key, user or team crosses max_budget. Portkey budget limits expire a key at a USD limit. Helicone can rate-limit by cost in cents.

The costs are real too. The gateway sits in your request path, unless you use Helicone's async logging, which is off the critical path but can't rate-limit. It only sees traffic sent through it, so a script or leaked key that calls the provider directly is invisible. And it prices tokens from its own model table: LiteLLM tracks spend "for all known models" and Portkey for models it has pricing support for. A new or custom model can be missing until the table catches up.

SDK tracing: Langfuse

Langfuse records a trace for each LLM call through its Python and JS SDKs, framework integrations, OpenTelemetry, or a gateway such as LiteLLM. Cost is either sent with the trace or inferred from usage and a model definition, and Langfuse ships prices for popular OpenAI, Anthropic and Google models. You get cost next to the prompt, the output and evaluation scores, which no billing API can give you.

Langfuse alerts can watch cost and notify Slack, PagerDuty, GitHub Actions or a webhook. They don't block requests. Pricing counts units, where a unit is any trace, observation or score you send: Hobby includes 50k a month, and Core and Pro include 100k, then $8 per 100k.

Billing APIs: the provider's own numbers, and Costbrake

Every major LLM provider reports usage itself. OpenAI's Usage API breaks usage down by project and line item, and its Costs API returns daily totals; both need an Admin key. Anthropic's Usage and Cost Admin API says data typically appears within 5 minutes. OpenRouter returns the cost of each request in the response. These numbers cover every key in the account, including ones your code doesn't know about.

Costbrake reads those APIs for you across 35 providers, so OpenAI, Anthropic, OpenRouter and your cloud bills sit in one place. It is not a proxy and never sees prompts. On OpenAI, monitoring needs only a read-only Admin key, which can't call models. Pro checks every 5 minutes and alerts on spikes, budgets, forecasts and new charges by email, Slack, Discord or webhook. Brakes on 18 providers can freeze an OpenAI project, disable an Anthropic key or zero an OpenRouter key's credit limit, but only after an admin clicks and confirms.

Where it is weaker: Costbrake can't attribute cost to a user or prompt unless the provider reports it that way, and it is only as fast as the provider's usage feed. See Costbrake pricing for plan limits.

Which one to pick

  • You need cost per prompt, user or feature: Langfuse or Helicone. Compare them with the bill in Costbrake vs Langfuse and Costbrake vs Helicone.
  • You want to cap each team or customer key: LiteLLM or Portkey budgets, with all traffic routed through the gateway.
  • You want to know the real bill across providers and act on a spike: Costbrake, plus each provider's own hard limit. Setup per provider is in AI API spend monitoring.
  • You only use one provider and want no new tool: its own dashboard and API, such as the OpenAI Usage API.

Many teams run a tracing tool for engineers and a billing monitor for whoever owns the bill. For the tools that can actually cut spend off, see which tools can actually stop cloud and AI spend.

Questions and answers

Do I need a proxy to track LLM costs?

No. OpenAI, Anthropic and OpenRouter all report usage and cost through their own consoles and APIs, and Costbrake reads those APIs without sitting in your request path. A proxy such as Helicone, Portkey or LiteLLM adds per-request detail and per-key budgets, but only for traffic you route through it.

Will an LLM cost tracking tool match my invoice?

Not always. Proxies and SDK tools multiply token counts by their own price table, so a model the table doesn't know, or a discount, can make them drift from the bill. The provider's billing API reports what it charges. Costbrake prices usage as it arrives and also reads the provider's billed dollars once a day.

Can Langfuse stop LLM spend?

No. Langfuse records traces and can alert on cost through Slack, PagerDuty, GitHub Actions or a webhook, but it doesn't sit in the request path, so it can't refuse a request. A webhook can start your own script. To block spend, use the provider's hard limit, a gateway budget such as LiteLLM or Portkey, or a brake.

Which tool tracks OpenAI, Anthropic and OpenRouter cost together?

Helicone, Portkey, LiteLLM and Langfuse all can, if every request goes through them or their SDK. Costbrake does it from the billing side by reading each provider's usage API, so it also counts keys used outside your app. It covers 35 providers on all plans, from Free with 2 connections to Team with 50.

What is the cheapest way to track LLM costs?

Start with the usage page and API each provider already includes. Past that, the free tiers are Helicone Hobby with 10,000 requests, Langfuse Hobby with 50k units, Portkey Developer with 10k logs a month, and Costbrake Free with 2 connections and hourly checks.

Sources

Updated