Display Token Usage for Each Tool Call in Agent Panel #47171
Replies: 3 comments
|
This would be an excellent addition, along with custom system prompts |
|
Great feature request. The billing reconciliation point is underrated — we've seen teams where the OpenAI dashboard shows $X/day but nobody knows which tool calls or features are driving that. For anyone wanting this kind of per-request cost visibility outside of Zed (e.g. in your backend or API server), we built burn0 — it patches Re: the implementation — Option 2 (collapsible details) feels cleanest. The streaming concern is real though. Most providers only include |
Uh oh!
There was an error while loading. Please reload this page.
Summary
Display token usage (input + output = total) for each tool call in Zed's agent panel. This would help users understand the cost and context consumption of individual tool operations, enabling better optimization and cost management when using AI features.
Motivation
The Problem:
Users have no visibility into how many tokens each tool call consumes. This makes it difficult to:
Why This Matters:
Current vs. Desired Behavior
Current Behavior:
Desired Behavior:
Proposed UI Patterns
Option 1: Inline Token Count (Preferred)
Show a compact token summary after the result:
Option 2: Collapsible Details
Subtle indicator that expands on click:
Option 3: Badge on Tool Call Header
Show tokens inline with the tool name:
Option 4: Session Summary
In addition to per-call display, show cumulative usage:
Use Cases
read_fileon large files consumesgrepor semantic search resultsTechnical Considerations
Implementation Notes
Most LLM APIs (OpenAI, Anthropic, etc.) return
usageobjects with token counts:{ "usage": { "input_tokens": 120, "output_tokens": 340 } }This data is already available in responses; the feature is primarily a UI presentation concern.
Related Features
This pairs well with existing and requested Zed features:
Together, these provide complete transparency for agent operations.
Additional Context
Discussion #45738 raised concerns about high token usage (7,000 tokens for a simple "hello"). While that discussion focused on reducing usage via prompt customization, this request focuses on visibility — showing users what's being consumed so they can make informed decisions.
Transparency about resource usage aligns with Zed's design philosophy of giving users control and understanding of their tools.
All reactions