Feature Request: Expose per-response token counts to the model

Resolved 💬 3 comments Opened Dec 29, 2025 by bugragunalan Closed Dec 29, 2025

Feature Request

Is your feature request related to a problem?

Yes. When using Claude Code for multi-step workflows or long sessions, there's no visibility into token consumption. This makes it difficult to:

  • Track costs for billing/budgeting purposes
  • Optimize prompts and workflows for efficiency
  • Understand which operations are token-intensive

Describe the solution you'd like

Expose token usage information that can be accessed during or after a session:

  1. Per-response token counts - Input/output tokens for each API call
  2. Cumulative session tokens - Running total during conversation
  3. Accessible via command or API - e.g., /tokens command or environment variable

Example output:

Session Token Usage:
- Input tokens:  45,230
- Output tokens:  8,540
- Total:         53,770

Use cases:

  • Cost tracking - Know how much a session costs before it ends
  • Optimization - Identify which prompts/operations use most tokens
  • Budgeting - Set alerts or limits based on token usage
  • Analytics - Track usage patterns over time

Describe alternatives you've considered

  1. Anthropic Console - Shows usage but not per-session or real-time
  2. Manual estimation - Inaccurate, doesn't account for system prompts/context
  3. External wrappers - Adds complexity, not integrated

Proposed implementation options:

  1. Command: /tokens or /usage to display current session stats
  2. Environment variable: Expose via $CLAUDE_SESSION_TOKENS
  3. Status bar: Optional display in CLI footer
  4. API response: Include in response metadata for programmatic access

Additional context

This would be valuable for:

  • Enterprise users tracking costs per project
  • Developers optimizing their prompts and skills
  • Teams with token budgets or limits
  • Anyone curious about their usage patterns

The /cost command currently shows subscription status but not actual token counts.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗