In the current ecosystem of AI-assisted development, agents like Claude Code or OpenCode have become indispensable tools for technical teams. However, as their usage intensifies, an uncomfortable question arises: how much of what we pay is actually invested in productive tasks? The answer, according to early measurements from a new type of agent profiler, is surprising: only about 60% of API costs correspond to direct developer instructions. The rest evaporates in internal agent operations: subagent explorations, context compaction, recovery summaries after inactivity, and even session title generation. This phenomenon, which we could call 'hidden overhead,' is driving companies and professionals to seek transparency in token consumption.
The tool that has uncovered this reality works as a transparent reverse proxy that sits between the coding agent and the LLM provider. Without adding latency, it records every request and classifies its purpose into up to eleven categories: main, search, compaction, recap, title, subagent, webfetch, quota, tool_result, guide, and unknown. Data from real sessions reveals that the search subagent can consume between 25% and 30% of tokens when the agent is asked to 'explore thoroughly.' These measurements allow teams to understand where their API budget is really going and make informed decisions about their assistant configurations.
One of the most impactful findings relates to the cache behavior of the provider. Claude Code, for example, inserts cache_control markers with type ephemeral, but without an explicit TTL. In practice, the cached prefix —including the system prompt, tools, and message history— expires after about five minutes of inactivity. If a developer steps away to read documentation or grab coffee, upon returning the next request pays a full cache write on potentially more than 200,000 tokens. On models like Opus, the cache write multiplier makes that first request dramatically more expensive. The profiler detects these 'cold regenerations' and marks them with severity badges, showing exactly how much each idle gap costs.
The problem worsens in long sessions. Each turn grows the cached prefix, so cold-refresh costs increase linearly. A three-hour session can rewrite more than 200,000 tokens on each expiry. Additionally, tool definitions alone can account for 10,000-15,000 tokens resent on every call. The temptation to optimize is enormous, but experience shows it is not trivial. An attempt to build an optimization layer —pruning stale tool results, collapsing system prompts, and removing unused tools— yielded spectacular initial results that later proved erroneous. Cross-session cache warming inflated baselines, and the initial cost model ignored cache-write tokens. Once both biases were corrected, virtual savings vanished. Editing the cached prefix turns cheap reads into expensive writes, and the client resends the pristine full history every turn anyway.
This scenario forces a rethink of agent deployment strategies in production environments. For companies developing custom software, understanding these consumption patterns is essential to properly size infrastructure and control operational costs. Integrating an agent profiler into the development flow not only provides visibility but also allows tuning parameters such as search frequency, maximum session duration, or cache expiry policies. Moreover, optimizing token usage has a direct impact on the economic sustainability of AI-based projects, especially when combined with cloud services like AWS or Azure, where API costs can scale rapidly.
Cybersecurity also plays a relevant role: by routing all requests through a proxy, one can audit what sensitive information is sent to LLM providers and ensure that customer or intellectual property data is not exposed. Tools like this profiler, which redact secrets and send no telemetry, offer an additional control point. At Q2BSTudio, where we develop cybersecurity and artificial intelligence solutions, we see a clear opportunity to combine token consumption transparency with architectures that minimize waste. For example, by adjusting tool granularity or implementing cross-session cache strategies that respect provider TTL policies.
In the business intelligence domain, cost analyses generated by the profiler can be integrated into Power BI dashboards so managers make decisions based on real data. At Q2BSTudio we offer BI / Power BI services that allow visualizing these indicators alongside other performance metrics, creating a holistic view of AI spending. Process automation also benefits: by knowing exactly how much each type of request costs, flows can be designed that prioritize the most efficient operations and avoid expensive cold regenerations. Our experience in automation has taught us that the first step to optimize is to measure, and this type of profiler provides that capability.
In summary, the AI agent profiler emerges as a critical tool for any organization using coding assistants in production. It not only reveals that up to 40% of API costs can be overhead not attributable to developer work, but also highlights current limitations in provider cache strategies. The open question is whether provider caching is intrinsically suboptimal for the request pattern of agents, or whether proxy-level adjustments can improve the situation. Meanwhile, the transparency these tools offer allows companies like Q2BSTudio to design more efficient deployments, combining custom software development, cloud, cybersecurity, BI, and artificial intelligence to maximize the return on agent investments. The path to efficiency starts with knowing exactly where our tokens go.





