Skip to content

feat: add token usage for per request view#48

Draft
chouzz wants to merge 1 commit intomainfrom
cursor/token-6df1
Draft

feat: add token usage for per request view#48
chouzz wants to merge 1 commit intomainfrom
cursor/token-6df1

Conversation

@chouzz
Copy link
Owner

@chouzz chouzz commented Feb 6, 2026

Display token consumption for each request, showing total tokens with a detailed breakdown on hover, supporting OpenAI and Anthropic formats.


Open in Cursor Open in Web

- Add total_tokens to the usage interface in NormalizedExchange type
- Update normalizeUsageMetrics to compute and return total_tokens
  (uses value from response if available, otherwise sums input + output)
- Add TokenUsageInline component in RequestsPane that displays
  total_tokens with a Coins icon for each request
- Hover tooltip shows detailed breakdown: Prompt Tokens, Completion
  Tokens, and Total Tokens with color-coded labels
- Supports both OpenAI format (prompt_tokens/completion_tokens/total_tokens)
  and Anthropic format (input_tokens/output_tokens) response bodies
- Update TokenBadge component to use total_tokens from data

Co-authored-by: Chouzz <zhouhua258@outlook.com>
@cursor
Copy link

cursor bot commented Feb 6, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@chouzz chouzz changed the title 请求 token 消耗 feat: add token usage for per request view Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants