claude-code - 💡(How to fix) Fix [FEATURE] CLI access to billing and token spend data [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#47196Fetched 2026-04-14 05:55:35
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×1renamed ×1

Root Cause

(Note: I'm filing this on the claude-code repo because there isn't an obvious public repo for the broader anthropic CLI / SDK billing tooling. Happy to move it if there's a better home.)

Fix Action

Fix / Workaround

  • Manually logging into console.anthropic.com and copying numbers (current workaround)
  • Scraping the console (fragile, against ToS)
  • Tracking spend locally via request logging (incomplete — doesn't capture the authoritative billed amount)

Code Example

anthropic billing --summary
anthropic billing --spend --period [month|year|all]
anthropic billing --by-model

---

claude billing --summary
claude billing --spend --period month
claude billing --by-model
RAW_BUFFERClick to expand / collapse

Preflight Checklist

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

Problem Statement

Claude API billing and token spend information is currently only accessible via the web console at console.anthropic.com. For developers managing API costs as part of their professional work — particularly those tracking cumulative spend for resume credentials, portfolio documentation, or client billing reconciliation — this requires leaving the terminal and authenticating in a browser.

This is operational data that developers are already authenticated to access via their API key. Needing to context-switch to a browser to retrieve it is friction that doesn't match the rest of the CLI-native workflow.

(Note: I'm filing this on the claude-code repo because there isn't an obvious public repo for the broader anthropic CLI / SDK billing tooling. Happy to move it if there's a better home.)

Proposed Solution

Add CLI commands to retrieve billing and token spend data. Example shape:

anthropic billing --summary
anthropic billing --spend --period [month|year|all]
anthropic billing --by-model

Or, if scoped to Claude Code itself:

claude billing --summary
claude billing --spend --period month
claude billing --by-model

Output should be both human-readable (default) and machine-parseable (--json) for piping into scripts or documentation workflows.

Alternative Solutions

  • Manually logging into console.anthropic.com and copying numbers (current workaround)
  • Scraping the console (fragile, against ToS)
  • Tracking spend locally via request logging (incomplete — doesn't capture the authoritative billed amount)

Priority

Low - Nice to have

Feature Category

CLI commands and flags

Use Case Example

  1. I'm updating my resume / developer portfolio and want to include cumulative Claude API spend as a credential signal
  2. Instead of opening a browser, logging into the console, and navigating to the billing page, I run anthropic billing --summary
  3. I get back total spend, spend by model, and spend over the current period
  4. I can also pipe --json output into scripts that generate portfolio pages or client invoices

Additional Context

There's an emerging professional trend of listing API token spend on resumes and developer portfolios as a signal of hands-on experience with LLM tooling. Making this data CLI-accessible aligns with how developers already work and removes a small but recurring source of context-switching.

extent analysis

TL;DR

Adding CLI commands to retrieve billing and token spend data, such as anthropic billing --summary or claude billing --spend, would alleviate the need to access the web console for operational data.

Guidance

  • Consider implementing CLI commands with flags for summary, spend, and period to provide flexible access to billing data.
  • Ensure the output is both human-readable and machine-parseable via a --json flag to support various use cases.
  • Review the proposed solution and alternative solutions to determine the best approach for integrating billing data retrieval into the CLI workflow.
  • Evaluate the potential impact of this feature on the emerging trend of listing API token spend on resumes and developer portfolios.

Example

anthropic billing --summary --json

This example illustrates how a developer could retrieve a summary of their billing data in a machine-parseable format.

Notes

The implementation details of the CLI commands and flags are not specified, and the exact output format may vary depending on the requirements of the Anthropic CLI / SDK billing tooling.

Recommendation

Apply workaround: Implement the proposed CLI commands to retrieve billing and token spend data, as it aligns with the existing CLI-native workflow and addresses the friction caused by context-switching to the web console.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING