Dev.to
7/21/2026

The original title is "AI Agent Profiler — Measure agent cost, cache waste, and context bloat"
Original: AI Agent Profiler — Measure agent cost, cache waste, and context bloat
Short summary
AI Agent Profiler is a local-first reverse proxy that records every request between your coding agent and LLM provider, showing exactly where tokens go. The author found ~40% of API cost was agent overhead—not user prompts—including subagent search, context compaction, and cache regeneration after 5-minute TTL expiries. An attempted optimization layer showed promising early numbers but savings vanished once cache-warming and cache-write token accounting were corrected.
- •Local reverse proxy profiles token cost by request type across Claude Code, OpenAI, DeepSeek, Bedrock, and Ollama
- •~40% of API cost was agent overhead: subagent search, context compaction, and cache regeneration
- •Optimization attempts failed—editing cached prefixes converts cheap reads into expensive writes
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



