-
-
Notifications
You must be signed in to change notification settings - Fork 69.3k
[Feature]: Add API call count to status/usage output #48779
Description
Summary
Add API call count display to session_status (/status) and response usage footer, showing the number of API requests made alongside token usage.
Problem to solve
Users currently see token usage but cannot easily track how many API calls were made. This makes it difficult to:
- Understand API usage patterns
- Calculate cost per request
- Debug unexpected token consumption (was it 1 large call or many small ones?)
- Track costs for providers that charge per API call (not per token)
Proposed solution
Add 📞 Calls: N to two places:
-
session_status (
/statuscommand):
🧮 Tokens: 345k in / 2.6k out · 💵 Cost: $1.43 · 📞 Calls: 42 -
usage footer (end of reply):
Usage: 74k in / 309 out · est $0.30 · 📞 Calls: 3
Implementation:
- session_status: Count from session transcript (each message with usage object = 1 call)
- usage footer:
fallbackAttempts.length + 1(failed attempts + successful call)
Alternatives considered
- Manual calculation from logs - tedious and requires log access
- External monitoring tools - adds complexity and cost
- Estimating from token counts - inaccurate due to varying context sizes
Impact
Affected users: Users who manually check /status or have responseUsage: full enabled
Severity: Low (nice to have, not blocking)
Frequency: On-demand - only when users check status or view usage footer
Consequence:
- Without this: Users must estimate or ignore request counts
- With this: Clear visibility into API call patterns, easier cost optimization
Scope: Only affects status output and usage footer display; no breaking changes to existing behavior
Evidence/examples
No response
Additional information
No response