-
Notifications
You must be signed in to change notification settings - Fork 334
Description
Bug Description
All input and output token counts show as 0 in the Usage & Analytics dashboard and as "-" in the Request Logger. This affects all requests, including successful ones (200 OK) routed through the Antigravity provider. Token tracking appears completely broken.
This is a regression — token counting was working in a version from about 2 weeks ago, and broke after updating to a recent version.
Observed Behavior
Usage Overview:
- Total Requests: 44
- Total Input Tokens: 0
- Total Output Tokens: 0
- Total Cost: $0.00
Usage by Model table:
claude-opus-4-5-thinkingvia antigravity: 44 requests, Input Tokens: 0, Output Tokens: 0, Total: 0
Request Logger:
- All requests show "-" in both the
InandOutcolumns, even for successful200 OKresponses
Possible Root Cause
After researching related issues, this is likely a 9Router-side issue (not Claude Code or Antigravity):
-
The upstream CLIProxyAPI (which 9Router is based on) had the same bug: CLIProxyAPI #747 — streaming
message_startSSE events returnedinput_tokens: 0andoutput_tokens: 0even though the upstream Antigravity response contained validusageMetadata. This was fixed in CLIProxyAPI. -
It is known that Antigravity strips some token data from local API responses (see tokscale investigation), but the proxy layer (CLIProxyAPI) has workarounds to extract
promptTokenCountandcandidatesTokenCountfrom the Gemini/Antigravity response format and convert them to Anthropicusageformat. -
The regression likely started with a recent update that changed "request logging and streaming" or "Usage type safety across all translators". Either of these changes may have broken the token extraction from streaming SSE responses.
Steps to Reproduce
- Update to a recent version of 9Router
- Configure Antigravity provider
- Send requests via Claude Code using
claude-opus-4-5-thinking - Check the Usage Overview — all token counts are 0
- Check the Logger — all requests show "-" for In/Out columns
Expected Behavior
Token counts should be extracted from the Antigravity/provider responses and displayed correctly in:
- The Usage Overview dashboard (Total Input/Output Tokens)
- The Usage by Model table
- The Request Logger (In/Out columns)
This was working correctly about 2 weeks ago.
Environment
- Provider: Antigravity
- Model: claude-opus-4-5-thinking
- Client: Claude Code
- Last working: approximately 2 weeks ago, before a recent update
Related Issues
- CLIProxyAPI #747: Streaming response 'message_start' event missing token counts (fixed in upstream)
- CLIProxyAPI #840: Antigravity countTokens ignores tools field
- CLIProxyAPI #1365: OpenAI-compatible provider: message_start.usage always returns 0 tokens
