How to Check opencode Token Usage and Cost
opencode writes detailed session logs to disk by default — the problem is there's no built-in command to total them up and show your spend.
Quick answer
npx whoburnedmorein your terminal. It reads opencode's local session logs through the ccusage data layer, totals your tokens and estimated cost across every session, and puts your number on a public leaderboard so you can see how your opencode spend compares. 📊opencode is an open-source terminal AI agent built for developers who want full control over their model configuration. It supports multiple providers — Anthropic, OpenAI, AWS Bedrock, and more — and keeps a detailed JSON log of every session it runs. That log is exactly what the ccusage library (which powers whoburnedmore) knows how to read. Unlike a closed IDE like Cursor, opencode's transparency means a single command can give you token-level accuracy: which models you hit, how many tokens each session consumed, and what each session cost at current API rates.
opencode sessions
JSON logs on disk
ccusage reader
parses + aggregates
whoburnedmore
tokens + cost
Leaderboard
optional rank
Where does opencode store its usage logs?
opencode writes session logs to a local directory under your home folder. The exact path varies slightly by platform and version, but the canonical location is:
# macOS / Linux (XDG-compliant default)~/.local/share/opencode/ # Each session creates a file like:~/.local/share/opencode/sessions/2026-06-14T09-30-00_session.json # Quick check: how many sessions do you have?$ ls ~/.local/share/opencode/sessions/ | wc -l 47
Each session file contains the full message history, model identifiers, and token usage broken down by input and output for each turn. The ccusage library reads these files directly — no API calls required — so the count is exact, not estimated from request metadata.
What if the directory doesn't exist?
If ~/.local/share/opencode/sessions/is empty or missing, either opencode hasn't been run yet on this machine, or it was installed to a non-default location. You can check opencode's configuration file for a custom dataDir setting. If you used a package manager that installs to a different prefix, find ~ -name "*.opencode*" -type d 2>/dev/null will locate it.
ccusage is the underlying engine
whoburnedmore is built on the ccusage open-source library, which includes a dedicated data-source adapter for opencode. That adapter understands opencode's session JSON schema and converts raw token fields into the normalized format whoburnedmore uses for cross-tool comparison. You don't need to install ccusage separately — it ships inside the whoburnedmore package.How do I run the token total command?
No installation or account required. The command uses npx to pull the latest version every time:
$ npx whoburnedmore↳ scanning local usage logs… found opencode sessions: 47 TOOL TOKENS MODEL SPLIT EST. COST opencode 11.4M claude-3-5: 72% $33.10 gpt-4o: 28% claude code 8.9M claude-3-5: 100% $29.60 codex 4.2M gpt-4o: 100% $11.40 ───────────────────────────────────────────────────── total 24.5M $74.10
Notice the model split column: because opencode lets you switch providers mid-workflow (e.g. starting with Claude 3.5 Sonnet and falling back to GPT-4o for certain tasks), whoburnedmore tracks token counts per model within opencode so the cost estimate uses the correct per-token price for each.
How is opencode token cost calculated?
opencode supports multiple providers and model tiers, so the cost formula aggregates across all of them. For a given session, whoburnedmore calculates:
Where m ranges over each model used in the session, in and out are the input and output token counts for that model, and p is the published per-token price. The session costs are then summed across all sessions for the total. Input tokens are always cheaper than output tokens — on Claude 3.5 Sonnet, for example, input runs at $3/M versus $15/M for output, so a prompt-heavy workflow costs noticeably less than a generation-heavy one.
Cache hit savings
If you use Anthropic prompt caching in opencode (enabled via the provider config), cache read tokens cost roughly 10% of normal input price. whoburnedmore accounts for cache-read tokens separately when the session logs report them, so your cost estimate stays accurate rather than overstating cache-heavy workflows.Can I see opencode usage by day or project?
Yes — pass the --breakdown flag to get daily totals:
$ npx whoburnedmore --breakdown=daily↳ filtering to opencode sessions… DATE TOKENS SESSIONS COST 2026-06-14 2.1M 8 $6.20 2026-06-13 1.8M 6 $5.30 2026-06-12 3.4M 11 $9.90 2026-06-11 0.6M 2 $1.80 7-day avg 1.6M/day 5.4/day $4.80/day
Comparing opencode to other terminal agents
One of the most useful things the daily view reveals is how your opencode usage compares to other terminal agents on the same day. If you switch between opencode and Claude Code depending on the task, the breakdown shows you which tool you actually rely on more:
| Capability | opencode | Claude Code | Codex CLI |
|---|---|---|---|
| Local session logs | |||
| Multi-provider support | any LLM API | Anthropic only | OpenAI only |
| Built-in usage command | none | /usage | /status (windowed) |
| whoburnedmore reads it | |||
| Per-model cost breakdown | multi-model | single model | single model |
| Open source | proprietary CLI | proprietary CLI |
avg sessions before first audit
providers opencode supports
prompts or code transmitted
Is reading my opencode logs safe?
whoburnedmore reads the metadatain opencode's session files — token counts, model names, timestamps — and ignores the message content entirely. Your prompts, the code you pasted in, the files opencode read during a session — none of that is parsed or transmitted. Only aggregate numbers (total tokens, estimated cost per session) are ever sent to the leaderboard, and only if you choose to submit them. Run npx whoburnedmore --local to keep everything on your machine and open the dashboard in your browser instead of submitting to the public board. 🛡️
If you also use newer AI coding agents like Amp, Droid, or Goose alongside opencode, the guide to checking Amp, Droid, and Goose usage covers the same one-command workflow for those three tools, with tool-specific log locations and gotchas for each.
- 1
Run the command (30 seconds)
npx whoburnedmore— it finds your opencode sessions automatically. No config file to edit. - 2
Check the model split
If you mix Anthropic and OpenAI models in opencode, confirm the cost estimate reflects both rate schedules. The model column in the output shows you which models were hit. - 3
Bookmark the private dashboard
Runnpx whoburnedmore --localto open a browser dashboard that stays entirely on your machine. Useful for day-to-day monitoring without publishing to the leaderboard.
Related guides
How to Check Your AI Coding Token Usage
The cross-tool overview: one command that totals your token usage and cost across every AI coding agent you run.
How to Check Amp, Droid, and Goose Token Usage
The newer agents don't have usage dashboards yet — one command covers all three.
How to Check Claude Code Token Usage
See your Claude Code tokens by day, model, and project — and how the built-in /usage compares.