Track Your Session Cost with /cost
Token costs can creep up during a long session, especially when Claude is reading large files or looping through complex tasks. The /cost command gives you an instant snapshot.
Just type it mid-conversation:
/cost
You'll get a breakdown of input tokens, output tokens, and the estimated cost for everything since the session started — useful for keeping an eye on burn rate during a long refactor or an automated pipeline run.
This pairs well with /compact — if you notice the cost climbing and the context is bloated with earlier context you no longer need, run /compact to summarise and reset, then check /cost again to see the difference.
/compact
/cost
If you're running Claude in CI or scripted pipelines with --output-format stream-json, the cost data is also emitted in the final JSON event under usage, so you can log it programmatically:
claude -p "your task" --output-format stream-json | \
jq 'select(.type == "result") | .usage'
Run /cost whenever you're curious — it takes one second and keeps surprises off your bill.
Log in to leave a comment.
A PreToolUse hook can intercept test runner commands and filter output to show only failures, cutting thousands of tokens from Claude's context.
CLAUDE.md loads into every message. Move workflow-specific instructions into skills that load on demand to reduce token costs across your session.
Every event emitted while processing a single prompt shares a prompt.id UUID, letting you trace the complete chain of API calls and tool executions.