LangWatch Open-Source Tool: Making Every Token Cost in Claude Code Crystal Clear

LangWatch's open-source tool tracks Claude Code token costs and call chains with a single command.
LangWatch has launched an open-source tool on Product Hunt that lets developers track Claude Code and Codex session costs with a single `npx langwatch claude` command. It provides granular token breakdowns (including cache reads/writes), span-level call chain tracing for bash and MCP calls, theoretical vs. actual cost comparison for Max plan users, and full terminal session replay — bringing LLM observability to AI coding workflows.
When AI Coding Tools Meet the Cost Black Hole
As AI coding assistants like Claude Code and Codex rapidly integrate into developers' daily workflows, a previously overlooked problem is surfacing: How much are these sessions actually costing? For teams subscribed to Anthropic's Max plan or paying by usage, every line of AI-generated code corresponds to opaque token consumption.
In the billing system of large language models, tokens are the fundamental unit of measurement — one token roughly corresponds to 3/4 of an English word or 1-2 Chinese characters. API call costs are typically split into input tokens and output tokens. Taking Claude 3.5 Sonnet as an example, input costs approximately $3 per million tokens, while output runs as high as $15. In AI coding scenarios, because code context, file contents, and tool call results need to be passed frequently, token consumption per session often far exceeds normal conversation — easily reaching tens or even hundreds of thousands of tokens. Cache hits, tool calls, context expansion — these factors make actual bills unpredictable.
LangWatch's latest open-source tool launched on Product Hunt, Claude Code usage tracking, targets precisely this pain point. Its core promise is straightforward: "See what your Claude Code sessions actually cost."

One-Command Observability
The tool's biggest highlight is its extremely low barrier to entry. Developers only need to run once:
npx langwatch claude
After that, every Claude Code session is automatically tracked and recorded — no additional configuration or invasive modifications to existing workflows required. This "zero-friction" design philosophy aligns with the universal demand for usability in modern developer tools — the tool itself shouldn't become a new burden.
Notably, the tool supports not only Claude Code but also Codex, covering mainstream AI coding assistant scenarios. This is a bonus for teams using multiple AI tools simultaneously.
Cost Accounting Down to Token Categories
What truly distinguishes this tool from a simple billing meter is its granular breakdown of cost composition. It tracks cache reads and cache writes as separate token categories, rather than lumping everything into a single total.
This matters significantly in practice. Anthropic's prompt caching feature, launched in 2024, allows developers to cache frequently used context prefixes on the server side. Cache writes cost slightly more than normal input (typically 1.25x the normal price), but subsequent cache reads cost only 10% of the normal input price. This means that in scenarios like Claude Code, where project code structures, system prompts, and tool definitions need to be passed repeatedly, properly leveraging caching can reduce costs by 80-90%. However, caches have a 5-minute TTL (time-to-live), requiring re-writes after expiration, making actual savings highly dependent on usage patterns. Only by separating cache reads and cache writes can developers truly understand whether their caching strategy is effective and where optimization opportunities lie.
Session Replay and Call Chain Tracing
Beyond cost visualization, the tool introduces a classic concept from the software observability domain — span tracing.
A span is a core concept in distributed tracing, originally proposed in Google's Dapper paper and later widely adopted by open standards like OpenTelemetry. A span represents the start/end time and metadata of an operation, and multiple spans form a complete trace through parent-child relationships. In traditional backend systems, spans trace a request's complete path from gateway to database; in LLM applications, spans are redefined as the basic unit for recording each model call, tool execution, and intermediate processing step.
According to LangWatch, the tool records every bash command invocation and every MCP (Model Context Protocol) call as an independent span. MCP is an open protocol standard released by Anthropic in late 2024, designed to establish a unified communication interface between AI models and external tools/data sources — similar to how USB provides standardized connections for hardware devices. In Claude Code, MCP enables the AI assistant to execute code, read/write files, run tests, and more. Each MCP call generates additional token consumption because tool input parameters and return results must be serialized as tokens passed to the model.
This means developers can see not only "how much was spent" but also "where the money went at each step." When a session's cost is abnormally high, span-level tracing enables quick identification of which tool call or context segment caused the consumption spike — this level of observability transforms performance bottleneck and anomalous spending diagnosis from "guesswork" to "precise diagnosis."
Theoretical Cost vs. Actual Bill Comparison
For Max plan users, the tool also provides an insightful comparison dimension: theoretical cost versus billed amount.
Anthropic's Max plan is a fixed subscription offering for heavy users, available in multiple tiers (such as $100/month and $200/month), providing different message quotas and priority access. This pricing model resembles a mobile phone plan — users prepay a fixed fee for a certain usage allowance. However, since different operations (such as code generation vs. simple Q&A) consume vastly different token amounts, users can rarely judge intuitively whether they've maxed out their quota.
By showing "how much it would cost at API pricing," developers can intuitively assess whether their subscription is worth it — whether they're fully utilizing their plan's allowance or subscribing to a tier far exceeding their actual needs. This transparency is highly valuable for team cost decisions.
Complete Terminal Replay Experience
The tool provides full terminal session replay in its UI. This isn't merely a log — it lets developers replay the entire AI coding session like watching a recording.
For team collaboration, incident postmortems, or auditing AI-generated code, this replay capability provides invaluable traceability. When an AI assistant makes an unexpected operation, the replay function helps teams understand the decision path rather than facing a pile of inexplicable results.
Positioning and Value of an Open-Source Tool
Based on Product Hunt's category tags, the project falls under Open Source, Developer Tools, and Artificial Intelligence, clearly establishing its open-source, developer-focused positioning.
This positioning reflects a broader trend: as AI coding tool costs grow as a proportion of development budgets, LLM Observability is emerging as a new tool category. This category rapidly grew between 2023-2024, with representative products including LangSmith, Helicone, Braintrust, Arize Phoenix, and LangWatch. They borrow methodologies from traditional APM (Application Performance Monitoring, such as Datadog and New Relic) but adapt them for LLM-specific challenges: token-level cost attribution, hallucination detection, prompt version management, response quality evaluation, and more. According to industry observations, the median monthly enterprise spend on LLM APIs has grown from hundreds of dollars in 2023 to thousands or tens of thousands in 2024, transforming cost observability from a "nice-to-have" to a "hard requirement."
Just as APM tools helped teams understand and optimize system performance over the past decade, AI session cost tracking and call analysis will likely become standard equipment for engineering teams. LangWatch itself is a company focused on LLM observability, and launching a dedicated tracking tool for Claude Code is a natural extension of its product portfolio into the AI coding scenario.
Taking AI Coding from Black Box to Transparency
One of the biggest concerns with current AI coding tools is the opacity of their costs and behavior. Developers enjoy the efficiency gains AI provides while often remaining completely unaware of the underlying resource consumption. The value of LangWatch's tool lies precisely in opening this black box — from token categorization to call chain tracing, from theoretical cost comparison to terminal replay, it provides a complete transparency solution.
For teams scaling their use of Claude Code or Codex, tools like this may soon shift from "optional" to "essential." After all, in an era where AI is deeply embedded in the development process, you can't truly optimize what you can't clearly see.
Related articles

Persistent State Machines: How INT4 Memory Cells Reshape LLM Attention Mechanisms
Exploring how persistent state machines with INT4-quantized memory cells reshape LLM attention, breaking KV Cache memory bottlenecks for long-context inference on edge devices and high-concurrency scenarios.

How AI Technology Is Reshaping Cognitive Research on Wild Primates
Explore how AI is breaking through bottlenecks in wild primate cognitive research. From facial recognition and behavior classification to sound analysis, AI reveals secrets of primate memory, social cognition, and communication.

MacWages Index: Measuring the Economic Value of AI Tasks in Human Wages
MacWages Index borrows the Big Mac Index concept to convert AI task value into human wage equivalents, giving businesses an intuitive way to quantify AI ROI.