[FEATURE] Opt-in setting to show session cost/usage summary on exit

Open 💬 1 comment Opened Jun 10, 2026 by dannykansas

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

On API (pay-per-token) billing, the cost & usage summary that Claude Code printed on session exit was the primary lightweight way to gauge a session's cost against its length and complexity. It silently stopped appearing in some contexts (a regression in #27148 traces it to 2.1.49, but others report earlier versions - maybe it was A/B testing vs. an actual regression?) and is fully absent as of 2.1.163 on macOS 26.5, many releases later. So this appears to be the expected, current behavior - not a transient bug or something already fixed on latest.

This has been raised repeatedly, and every request to restore it has been closed without a stated rationale: #9293 and #9463 as duplicates, and #9675, #18550, and #27148 as "Not Planned." #7111 is regarding the statusline vs. exit behavior, and is not scoped tightly to users that need this feature.

This serves as a consolidated request scoped to the users the feature actually serves (API pay-per-token users) asking for reconsideration via an opt-in rather than a change to the new, intended default.

Proposed Solution

Any one of the following (listed by preference):

  1. An opt-in displayCostOnExit: true setting. Preferred as it leaves the default untouched, so subscription users are unaffected.
  2. Restore the on-exit cost/usage summary as the default for all.
  3. A PreExit / BeforeSessionEnd hook that fires while session cost state is still in memory. (Today /cost's data is torn down before SessionEnd runs as noted in #9675, so no existing hook can capture it.)

Alternative Solutions

The only alternatives are heavy-lift workarounds, and none replaces the prior zero-config behavior of displaying a usage & cost line on exit:

  • Run /cost manually before every session exit:
  • Manual and easy to forget, and once the session has exited the data is gone for good.
  • Can't be automated: /cost reads in-memory session state that's torn down before SessionEnd runs (see #9675), so no hook can capture it.
  • Enable OpenTelemetry (CLAUDE_CODE_ENABLE_TELEMETRY=1) and export the claude_code.cost.usage / claude_code.token.usage metrics
  • Requires standing up and maintaining a collector/backend, which is substantially disproportionate for a single summary line on exit.
  • Parse ~/.claude/projects/*.jsonl (written per session regardless of plan) with a community tool — technically works, but it's very "DIY" for a feature that used to be there by default.

Priority

High - Significant impact on productivity

Feature Category

Configuration and settings

Use Case Example

I start claude on per-token API Enterprise billing, and work through it over ~40 minutes of prompts and tool calls. When I'm done I exit with Ctrl+C twice.

Previously, a summary printed automatically on exit showing: total cost, tokens by model, duration, lines changed — so I could immediately judge the result: "that refactor was $3.70 for 45 minutes, reasonable," or "that 5 minute exploratory session burned $4, I should've scoped it tighter / disabled some MCP / dropped down on /effort or /model". The _per-session_ feedback is how I calibrate my prompting and when I split work across sessions.

Now the terminal just exits silently. The only way to have seen it was to remember to run /cost immediately before quitting. Worse, once I've exited, the data's gone for good.

With displayCostOnExit: true, the summary prints automatically again, restoring that critical cost-vs-complexity feedback loop with no manual step nor impact on users with non-usage-based plans (e.g. Max/Pro).

Additional Context

Why this is scoped to API users:
The docs note /cost isn't intended for Max/Pro subscribers, since they don't pay per token which makes per-token API users precisely the audience an on-exit cost summary serves, and the ones who lost visibility when it's removed. Adding this as an opt-in setting leaves the default untouched, so subscription users are unaffected.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗