Skip to content

[Feature]: Add API call count to status/usage output #48779

@Qixingchen

Description

@Qixingchen

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:

  1. session_status (/status command):
    🧮 Tokens: 345k in / 2.6k out · 💵 Cost: $1.43 · 📞 Calls: 42

  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions