Skip to main content

Chat Log Analyzer

Drop a Claude Code or OpenAI session file and get a per-turn token and cost breakdown.

100% client-side⌗ exact o200k tokenizer⌁ zero uploads

Session file (JSONL / JSON)

Never leaves your browser
demo-session.jsonlClaude Code session
$0.01

estimated session total on Claude Sonnet 4.58 turns, 54 in / 845 out. Token counts use the chars ÷ 3.6 estimate until the tokenizer loads.

Cost = input tokens × input rate + output tokens × output rate. Real bills add per-turn context re-sending and cache effects — FORG measures those live.

#RolePreviewTokensEst. $
1userFix the failing test in auth.test.ts10$0.0000
2assistantReading the test file to see the failure. {"file_path":"auth.test.ts"}180$0.0027
3userdescribe("login", () => { it("rejects expired tokens", () => { expect(verify(expired)).toB29$0.0001
4assistantThe test expects verify() to return false for expired tokens but it throws instead. Patchi410$0.0062
5userOK — file edited4$0.0000
6assistantRunning the test suite to confirm. {"command":"npm test"}95$0.0014
7userPASS auth.test.ts — 12 passed, 0 failed11$0.0000
8assistantFixed: verify() now returns false on expired tokens instead of throwing. All 12 tests pass160$0.0024
o200k
exact GPT tokenizer, in-browser
≈3.6
chars/token Claude estimate, documented
18
models in the cost dataset
0
network requests per keystroke

How it works

Agent sessions feel cheap turn by turn and expensive at the end of the month, and the gap lives in details no dashboard shows you: which turns carried the tokens. This analyzer takes a session file — a Claude Code JSONL log or an OpenAI-style export — parses it entirely in your browser, and produces a per-turn table of role, content preview, token count and estimated cost, plus a session total priced on the model you choose.

Format detection is automatic. Claude Code logs are JSONL with one message object per line, often including exact usage token counts which we use directly; OpenAI exports are JSON with a messages array, which we tokenize locally with the o200k encoding. Where counts are tokenized rather than recorded, rows carry a ≈ marker — and if the tokenizer fails to load, a documented characters ÷ 3.6 estimate keeps the tool functional. Nothing in the file ever leaves your machine; the parsing is FileReader plus JSON.parse, no upload, no exceptions.

The cost model is intentionally simple and stated: user and tool turns are priced as input tokens, assistant turns as output tokens, at the selected model's current list rates. Real provider bills differ — every turn re-sends accumulated history as input, and caching discounts apply — so treat the total as a lower bound on what the session actually cost and the per-turn column as the thing that matters: relative weight, which turns to blame.

What you will probably find: one or two tool results dominate everything else. A file read or test run that dumped 20k tokens into history is then re-sent on every later turn, multiplying its own cost. Truncating oversized tool results is the highest-leverage fix in most agentic setups. For ongoing visibility instead of one-off forensics, FORG records this breakdown live for every session your team runs — the demo button above shows the shape of what it sees, on real traffic, without the export step.

Frequently asked questions

Which file formats are supported?

Two families are auto-detected. Claude Code session files — JSONL where each line carries a message object with role, content blocks and often usage token counts — and OpenAI-style exports, either a JSON object with a messages array or a bare array of role/content messages. Drop the file or pick it with the browser; the detected format is shown as a badge so you can confirm the parse did what you expected.

Is my session log uploaded anywhere?

No. The file is read with the browser's FileReader API and parsed entirely in JavaScript on your machine — there is no upload endpoint, no analytics on the content, and you can verify zero network requests in devtools. Session logs routinely contain proprietary code and secrets, which is exactly why this tool was built local-first.

How accurate are the token and cost numbers?

When the log includes usage fields (Claude Code records input and output tokens per assistant message) those exact values are used and shown without a ≈ marker. Otherwise text is tokenized in your browser with the o200k encoding, which is exact for GPT models and a close proxy for Claude. The dollar figure prices input and output at the selected model's current list rates — real bills additionally reflect caching discounts and context re-sending.

What should I look for in the per-turn table?

Three waste patterns show up constantly: tool results far larger than the model needed (a 20k-token file dump answered with one line), repeated context where the same content re-enters the conversation multiple times, and long tails of low-value turns after the task was effectively done. Each is a compaction or truncation opportunity — sort by the token column mentally and attack the biggest rows first.

Can I get this breakdown automatically for every session?

That is precisely what FORG does. Instead of exporting and dropping files after the fact, forg activate instruments your agent sessions live: per-turn tokens, per-session cost, per-developer rollups and alerts when a session runs away. This analyzer is the manual version of FORG's always-on view — useful for one-off forensics, replaced by telemetry for daily work.

FORG tracks this automatically across every agent session — live cost attribution, budgets, and alerts.

Start tracking with FORG