Track your Codex Usage

Or Claude Code, OpenCode, Copilot, Cursor and Pi. Capture full trace history to improve your flow, and track how much you're spending in tokens.

Start tracking right away:
$npx langwatch codex
Star on GitHub
Ask AI
+
Trace (summary)Duration
2hI did the gcloud auth login hopefully you can continue?2307.1s

Input  I did the gcloud auth login hopefully you can continue?

Output The scan came back empty: **no project in your account has the Google Ads API enabled at all**, which actually pins the diagnosis. Modern Ads API accounts declare their Cloud project explicitly in th…

5hI have several design change requests here [Image #7]5623.4s

Input  I have several design change requests here [Image #7]

Output All three are in: clawd is a die-cut sticker on the right with the slow wobble, the trace colors match the app tokens, and the span tree groups repeats with ×N pills…

1dok merged! but /reuse-worktree cuz already found a bug513.9s

Input  ok merged! but /reuse-worktree cuz already found a bug

Output Worktree reset to latest main on a fresh branch. The bug reproduces: the retry queue drops the last event when the worker restarts. Writing the failing test first, fix goes on the same PR…

3dawesome, this is merged, but apply gave those errors:1543.9s

Input  awesome, this is merged, but apply gave those errors:

Output Both errors share one root cause: the migration runs before the enum exists. Reordered the migrations, apply is clean, and the seed passes on a fresh database…

4dcan you get rid of all those stale artifacts? clean them up, maybe commit first…1534.3s

Input  can you get rid of all those stale artifacts? clean them up, maybe commit first…

Output Committed the WIP first, then removed 14 stale artifacts: 9 orphaned preview deploys, 3 dangling worktrees, 2 cache volumes. 4.2GB freed, nothing CI references…

6dnah why would we keep it in the cluster? why not just ignore it? it was done on…374.9s

Input  nah why would we keep it in the cluster? why not just ignore it? it was done on…

Output Right, dropped it from the cluster and added it to the ignore list instead. The sync job no longer touches it and the drift alert that kept firing is gone…

I did the gcloud auth login hopefully you can …
3 / 41
Duration2307.1sSpans557CostBundledTokens76.8K in · 411.9K outModelgpt-5.6-solReasoning effortmax
Service codexOrigin coding_agentEval Presidio PII Detection 0.00
Summary 0Trace TConversation C2h ago
Conversation contextturn 3 of 41
Span
0ms2307.1s
I did the gcloud auth logi…2307.1s
gpt-5.6-sol×91 repeatedavg 24.2s · 4.5s–155.4s
Edit32ms
Bash×37 repeatedavg 2.7s · 4ms–33.3s
Bash2.0s
mcp_tool×33 repeatedavg 666ms · 12ms–2.9s
mcp_tool214ms
away_summarygpt-5.6-sol$0.546.9s
ToolBash2.0s
Input and outputPrettyTextJSONMarkdown
{
  "command": "gcloud services list --enabled | grep -i googleads",
  "description": "Check which projects have the Ads API enabled"
}
FLATJSON

Span attributes

span_id9a01f7d34cc8b52a
codex.cost_usd_micros0
codex.duration_ms2000
codex.event.nametool_result
codex.event.sequence3947
codex.query_sourcerepl_main_thread
codex.speednormal
codex.terminal.typetmux

Features

Everything a session leaves behind, in the platform's own UI.

Cache hit tracking

Cache reads and writes are separate token classes on every span, down to the 5m and 1h TTL split on writes.

Token accounting

Theoretical vs billed costs

Exact cost numbers, straight from the API response. See how much you would be spending if you weren’t on an individual or team plan.

Open cost analytics

Tools, skills, MCP

Every Bash command, file edit, skill invocation, and MCP call is a span with a duration. ×37 repeated unfolds into each one.

Trace tool calls

Codex can query it back

The MCP server exposes your traces to the agent itself: it inspects last week’s runs, finds where tokens go, and edits its own workflow.

LangWatch MCP

Plot any analytics

Any metric on the trace can go on a chart: sessions running in parallel, cost per session, idle time while it waits on your reply.

Build a graph

Insights to improve your skills

Run Claude over your own trace history: what you asked for, what helped most, and the friction patterns where sessions go wrong.

Analyze your sessions

Questions

How do I track my Codex usage?

Run npx langwatch codex. It configures the OpenTelemetry exporters Codex ships in config.toml to point at LangWatch. Every session lands as a trace: model turns, tool calls, tokens by class, and theoretical cost. ccusage-style local log readers see one machine; the OpenTelemetry route follows you across machines and survives local log cleanup.

Does it work with Claude Code, OpenCode, Copilot, Cursor, and Pi?

Yes. Each agent exports through the same OTLP endpoint, so everything lands in one store with the same token, cost, and trace treatment.

What does the "Bundled" cost label mean?

Sessions on a ChatGPT plan (Plus, Pro, Team) have no per-token invoice. LangWatch marks those sessions Bundled and computes a theoretical total at API list prices, per token class. That is the number behind "what would this have cost on the API".

Are cached tokens counted?

Cache read and cache write are separate token classes on every span, priced at their own rates. In long agent sessions cache reads are most of the volume, so a tracker that lumps them into input gets both the total and the cost wrong.

What if I accidentally paste any secret keys on my Codex session?

API secrets are automatically redacted and never stored on the LangWatch side. PII is redacted the same way, so personal information does not end up in the trace. For tighter control, enterprise policies and self-hosted setups are available.

One command, then keep working.

Free for individual use. Setup docs

$npx langwatch codex