Date: 2026-03-27
Model: anthropic.claude-haiku-4-5-20251001-v1:0
Proxy: LiteLLM via mitmproxy reverse proxy on localhost:8888
Agent: kai-orchestrator-agent on localhost:8005
Runtime: copilotkit-runtime-server on localhost:3000
- Fresh agent restart with
LITELLM_PROXY_API_BASE=http://localhost:8888 stream_options: {"include_usage": true}enabled to capture token usage in SSE streamcache_controlbreakpoints added to system and last user messages- 4-turn conversation on a single thread, capturing all LLM calls via mitmproxy
| Turn | Message | prompt | completion | cached | cache_created |
|---|---|---|---|---|---|
| 1 | "hello" | 37,194 | 58 | 0 | 0 |
| 2 | "What can you do for me?" | 37,263 | 323 | 0 | 0 |
No caching — cached_tokens and cache_creation_tokens both zero on every call.
| prompt | completion | cached | cache_created | |
|---|---|---|---|---|
| Call 1 | 37,194 | 59 | 0 | 37,191 |
Fresh session, cache seeded — 37,191 tokens written to cache.
| prompt | completion | cached | cache_created | |
|---|---|---|---|---|
| Call 1 | 37,263 | 371 | 37,191 | 69 |
99.8% cache hit — 37,191 tokens read from cache, only 69 new tokens written.
| prompt | completion | cached | cache_created | |
|---|---|---|---|---|
| Call 1 (tool decision) | 37,643 | 118 | 37,260 | 380 |
| Call 2 (tool result) | 40,397 | 79 | 37,640 | 0 |
| Call 3 (final answer) | 40,903 | 408 | 37,640 | 0 |
Cache held across turns 2→3 — call 1 hit cache (37,260 tokens). All 3 calls within the turn benefited from caching.
| prompt | completion | cached | cache_created | |
|---|---|---|---|---|
| Call 1 | 41,343 | 316 | 37,640 | 3,700 |
Cache held across turns 3→4. Only 1 LLM call needed (agent answered directly without tool use). 37,640 tokens from cache, 3,700 new tokens written (accumulated conversation history).
- System prompt (~37k tokens) is successfully cached on the first LLM call of each session
- Subsequent calls within the same turn and across turns read from cache
- Cache hit rate is ~99% of prompt tokens on follow-up calls
- Only new conversation history tokens (few hundred) are written to cache on each turn
- Multi-call turns (tool use) benefit from caching — calls 2+ within a turn always hit cache
- Cache TTL held across all 4 turns — every call after turn 1 hit cache consistently