Claude Code usage tracking by LangWatch works by piping Claude Code's own OpenTelemetry export into LangWatch's dashboard, where every session becomes a trace showing model turns, tool calls, tokens by class, and a theoretical cost. You turn it on with one command, npx langwatch claude, and it starts capturing sessions immediately — no code changes, no wrapper script around your normal workflow.
Short answer: Run
npx langwatch claudeto send Claude Code's built-in OpenTelemetry data to LangWatch. You get per-session traces with tool calls, token counts by class (input, output, cache read/write), and theoretical spend. It's free for individual use on LangWatch's Developer plan; prompts and code stay redacted unless you opt in.

I ran this setup on a real project — quick path first, then the manual OpenTelemetry variables — to see what actually shows up in LangWatch versus what Claude Code's own analytics dashboard gives you for free. Here's what you need, the exact steps, and where each option falls short.
What you'll need
Claude Code installed and a LangWatch account, which you can create at app.langwatch.ai without a credit card. You'll need Node.js available in your terminal, since the fast setup path runs through npx. If you'd rather configure things by hand — for a CI pipeline, a Docker image, or a shared team machine — you'll need your LangWatch API key from the dashboard instead, and a way to export environment variables before Claude Code launches. Nothing here touches your codebase or requires a paid Claude Code plan beyond whatever you're already on; the telemetry sits alongside your normal session and doesn't change how Claude Code behaves.
Step-by-step: Claude Code usage tracking by LangWatch
1. Create a LangWatch account and grab an API key
Sign up at app.langwatch.ai, then open the dashboard and copy your API key from the project settings. You'll need this key whether you use the quick command or the manual environment variables below.
2. Run the one-line setup
In your project directory, run:
“ npx langwatch claude “
In my testing this configured Claude Code's native OpenTelemetry export automatically — no separate config file to edit, no restart ritual beyond starting a fresh Claude Code session afterward.
3. Start a Claude Code session and check the dashboard
Open Claude Code normally and run a real task — edit a file, run a command, whatever you'd do anyway. Then check the LangWatch dashboard. When I tested this, a session trace appeared within about a minute, broken into individual spans for each tool call (Bash, file edits, MCP calls) with duration and token counts attached to each one.
4. Set the OpenTelemetry variables by hand if you skip the CLI
For CI runners or a machine where you can't run npx interactively, export these before launching Claude Code:
“ export CLAUDE_CODE_ENABLE_TELEMETRY=1 export OTEL_TRACES_EXPORTER=otlp export OTEL_LOGS_EXPORTER=otlp export OTEL_METRICS_EXPORTER=otlp export OTEL_EXPORTER_OTLP_PROTOCOL=http/json export OTEL_EXPORTER_OTLP_ENDPOINT=https://app.langwatch.ai/api/otel export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer YOUR_API_KEY" claude “
Per LangWatch’s Claude Code integration docs, Claude Code 2.1.x ships its cost-bearing events as OTLP logs rather than spans, so OTEL_LOGS_EXPORTER=otlp is required for cost data to show up at all — a step it's easy to skip if you're copying an older OpenTelemetry snippet from somewhere else.
5. Decide whether you want prompt and code content captured
By default, LangWatch only receives token counts and cost — no prompt text, no tool input or output, no raw API bodies. That's deliberate: API secrets are redacted automatically and never stored on LangWatch's side. If you want the actual prompts and tool content visible for debugging, you opt in separately with flags like OTEL_LOG_USER_PROMPTS and OTEL_LOG_TOOL_CONTENT, which is worth thinking through before you flip them on a shared or client project.
Example commands you can copy
A few variations I used while testing this, beyond the basic setup:
npx langwatch claude— the fast path for a solo project; run it once per machine.OTEL_LOG_USER_PROMPTS=1 OTEL_LOG_TOOL_CONTENT=1 claude— added on top of the base export to capture prompt and tool content for one debugging session, without making it permanent in your shell profile.unset OTEL_EXPORTER_OTLP_HEADERS && claude— quick way to confirm Claude Code still runs normally with telemetry off, useful when isolating whether an issue is telemetry-related.- Checking
echo $CLAUDE_CODE_ENABLE_TELEMETRYbefore a session — a one-second sanity check that the variable actually persisted, since a new terminal tab won't inherit variables exported in a different one.
None of these require touching Claude Code's own configuration files — it's all environment variables read at launch.
Common mistakes to avoid
The one that cost me the most time: exporting the environment variables in one terminal tab, then opening Claude Code in a different tab where they were never set. OpenTelemetry data silently doesn't show up, and there's no error — Claude Code just runs as normal, which makes the failure easy to miss. Second, forgetting OTEL_LOGS_EXPORTER=otlp and only setting OTEL_TRACES_EXPORTER=otlp — since Claude Code 2.1.x sends cost data as logs, you'll see spans without any cost numbers attached, which looks like a bug but is really a missing variable. Third, turning on OTEL_LOG_USER_PROMPTS and OTEL_LOG_RAW_API_BODIES out of habit on a client or work project without checking your data-handling policy first — those flags do send real prompt and tool content off your machine. Fourth, expecting this to replace Claude Code's own team analytics; LangWatch tracks tokens and cost per session, not the lines-of-code and pull-request metrics that Anthropic's own dashboard reports for teams.
Tools that make this easier
If you're setting this up because you want Claude Code to do more on its own between check-ins, Claude Code’s custom skill system is worth pairing with usage tracking, since standing goals tend to run longer sessions worth watching. Understanding what changed in the underlying model helps explain sudden token or cost shifts in your traces — my Claude Opus 5 breakdown covers that. If you're deciding whether Claude Code is the right coding agent at all, Claude vs ChatGPT and Cursor vs Copilot cover the field, including how each tool's usage reporting compares. For the basics of the Claude ecosystem beyond Claude Code — plans, Projects, pricing tiers — see how to use Claude AI. And if you're newer to AI coding tools generally, AI coding assistant: a beginner’s guide is a good starting point before you're deep into telemetry configuration.
LangWatch vs Claude Code's built-in analytics vs a local monitor
These solve different problems, and picking the wrong one wastes setup time.
| Approach | What it shows | Cost | Best for |
|---|---|---|---|
| LangWatch | Per-session traces: tool calls, tokens by class, theoretical cost, cross-machine history | Free (Developer plan, 50k events/month); Growth from €29/seat/month with 200k events included | Individuals and teams who want cost and token detail, persisted across machines |
| Claude Code built-in analytics | Lines of code accepted, suggestion accept rate, active sessions, PRs merged (needs GitHub integration) | Included with Team/Enterprise plans | Engineering leads tracking adoption, not raw token spend |
| Local CLI monitor (e.g. open-source usage trackers) | Real-time terminal view of the current session's usage | Free, self-hosted | Watching one session live, no history or team view needed |
Claude Code's own analytics, per the Claude Help Center, is restricted to Team and Enterprise account owners and admins, requires Claude Code 2.0.28 or later, and deliberately skips raw token counts and per-session cost in favor of productivity metrics. If you're on an individual Pro or Max plan, that dashboard isn't available to you at all — which is the main reason LangWatch's free tier is worth setting up even for a single developer.
My take
For a solo developer or small team, LangWatch's free Developer plan is the easier way to actually see what Claude Code is costing you session by session — Anthropic's own dashboard doesn't expose that to individual plans, only to Team and Enterprise owners. The setup is genuinely a one-line command, and the default redaction (no prompts, no tool content, no raw bodies) means you're not shipping sensitive project data off your machine by accident. Where it's less useful is exactly what it doesn't try to do: it won't tell you if your team is actually shipping more code, which is what the built-in analytics dashboard is for on a Team plan. I'd run both if you're managing a team — LangWatch for the honest token and cost picture, Claude Code's own analytics for adoption.
Frequently Asked Questions
Is Claude Code usage tracking by LangWatch free?
Yes, for individual use. LangWatch's Developer plan is free with no credit card required and includes 50,000 events per month and 14 days of data access — enough for a single developer watching their own Claude Code sessions. Teams that need more events, longer retention, or more users move to the Growth plan at €29 per seat per month.
How long does it take to set up?
About two minutes for the fast path: create a LangWatch account, copy your API key, run npx langwatch claude, and start a session. Setting the OpenTelemetry variables by hand for a CI environment takes a bit longer, closer to five to ten minutes the first time, mostly around getting the logs exporter variable right.
What is the easiest way to do this?
Run npx langwatch claude in your project directory rather than setting the OpenTelemetry environment variables manually. It configures the same underlying export with one command, and you can still add the manual variables later for a CI pipeline or a machine where the CLI isn't practical.
Does LangWatch see my prompts and my code?
Not by default. Only token counts and theoretical cost are sent unless you explicitly enable flags like OTEL_LOG_USER_PROMPTS or OTEL_LOG_TOOL_CONTENT. API secrets are redacted automatically on LangWatch's side even when those flags are on.
Is this the same as Claude Code's built-in usage analytics?
No. Claude Code's own analytics dashboard is available only on Team and Enterprise plans and reports adoption metrics like lines of code accepted and sessions over time, not token-level cost. LangWatch works on any plan and focuses on token and cost detail per session instead.