[FEATURE] CLI access to billing and token spend data
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
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
- I'm updating my resume / developer portfolio and want to include cumulative Claude API spend as a credential signal
- Instead of opening a browser, logging into the console, and navigating to the billing page, I run
anthropic billing --summary - I get back total spend, spend by model, and spend over the current period
- I can also pipe
--jsonoutput 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.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗