Claude Reply Tokens
Claude Reply Tokens is a VS Code companion extension that shows the token usage for the latest Claude Code reply in the status bar.
It does not depend on private APIs from the official anthropic.claude-code extension. Instead, it reads Claude Code's local JSONL session logs and computes the latest full assistant reply chain for the current workspace.
Features
- Shows the latest Claude reply token usage in the VS Code status bar
- Aggregates a full reply chain instead of only the last assistant JSONL record
- Matches Claude sessions to the current workspace
- Refreshes automatically when Claude writes new transcript lines
- Opens a latest-turn analysis panel from the status bar
- Shows rolling cumulative usage for the current workspace (
1h / 1d / 3d / 7d / 30d)
- Estimates API cost using auto-synced Anthropic pricing or manual overrides
- Keeps the matching transcript available as a separate command
How It Works
The extension scans Claude's local projects/**/*.jsonl files, finds the most relevant session for the current workspace, and reconstructs the latest full turn by walking parentUuid across assistant records and intermediate tool_result user records.
The total includes:
input_tokens
output_tokens
cache_creation_input_tokens
cache_read_input_tokens
Clicking the status bar opens a latest-turn analysis panel that shows:
- Exact token buckets for the turn (
input / output / cache write / cache read)
- Rolling cumulative token usage for the current workspace (
1h / 1d / 3d / 7d / 30d)
- A heuristic content mix by message-block category (
user text / tool result / assistant tool use / assistant thinking / assistant text)
- Per-assistant-step totals so you can see which call in the turn was expensive
Claude's JSONL logs expose usage per assistant record, not per content block, so the content-category section is heuristic rather than exact token accounting.
Requirements
- VS Code
1.86.0 or later
- Claude Code installed and actively writing transcript files locally
Settings
This extension contributes the following settings:
claudeReplyTokens.dataDirectory
Override the Claude config directory. Point it at the folder that contains projects/.
claudeReplyTokens.refreshIntervalSeconds
Fallback full-rescan interval in seconds. Minimum: 30.
claudeReplyTokens.pricingMode
Cost pricing mode. auto syncs from Anthropic pricing pages and falls back to bundled defaults. manual uses your configured overrides.
claudeReplyTokens.pricingAutoSyncIntervalHours
Auto-sync interval for Anthropic pricing in hours. Minimum: 1.
claudeReplyTokens.manualPricing
Manual pricing overrides keyed by Claude model ID or alias. Values are USD per million tokens.
Example:
{
"claudeReplyTokens.manualPricing": {
"claude-sonnet-4-6": {
"inputPerMillionUsd": 3,
"outputPerMillionUsd": 15,
"cacheWritePerMillionUsd": 3.75,
"cacheReadPerMillionUsd": 0.3
}
}
}
Commands
Claude Reply Tokens: Refresh
Claude Reply Tokens: Open Latest Claude Turn Analysis
Claude Reply Tokens: Sync Claude Pricing Now
Claude Reply Tokens: Open Claude Transcript
Claude Reply Tokens: Open Claude Reply Tokens Settings
Development
Recommended local toolchain:
- Node.js
20.x LTS
- VS Code
1.86.0 or later
If you use nvm, run:
nvm use
Install dependencies:
npm install
Compile:
npm run compile
Run tests:
npm test
Launch an Extension Development Host:
- Open this project in VS Code
- Press
F5
Packaging
Create a VSIX package:
npm run package:vsix
This produces a file like:
claude-reply-tokens-0.3.0.vsix
Install locally:
code --install-extension ./claude-reply-tokens-0.3.0.vsix --force
Team Distribution
Recommended workflow:
- Run
npm run package:vsix
- Upload the generated
.vsix to your shared release location
- Ask teammates to install it with
code --install-extension ... --force
Notes
- This extension currently tracks the current workspace only
- It does not hook into the official Claude Code extension internals
- If multiple Claude sessions match the same workspace, it uses the one with the latest assistant activity
- Before publishing to VS Code Marketplace, replace
YOUR_PUBLISHER_ID in package.json with your real publisher ID