opencode bug misplaces cache_control in tool messages, causing full-price billing on long agent sessions
HawkingRadiation42 · ghdev · 2026-10-20
A bug report on opencode (v2.0.32) shows that with an openai-compatible provider pointed at an Anthropic-backed gateway and cacheFormat: "anthropic", the cachecontrol marker is placed inside the tool message's content array, where the gateway ignores it.
- Result: whenever the last message is a tool result, no caching happens — cache read stays flat at 11,331 tokens (system prompt + tools) while the prompt grows to 272K tokens across a session
- Every step in tool-heavy agent sessions re-bills the entire conversation as uncached input, a real cost problem
- Captured request bodies show stable prefixes; sending the same 123K-token request with the marker in the right place hits the cache correctly
Developers running long agent sessions on this setup should check their cache read/write stats.
More from coding & agent
- Index Network open-sources Social Discovery Protocol: agents negotiate fit on your behalf — carsonfarmer · 2026-10-23
- Installed a formal-verification skill: it silently installed Java, MacBook runs 10 degrees hotter — zealcaiden · 2026-10-23
- OpenAI's Decisions API hits GA: near real-time routing up to 10x faster than GPT-6 Luna — OpenAIDevs · 2026-10-23
- Ruff author warns: upgrade Node/Bun now — --use-system-ca still accepts the eMudhra cert — charliermarsh · 2026-10-23
- Proof of Agent: paste one prompt and your AI mines, grades, and self-governs — adamamcbride · 2026-10-23
- DeepLearning.AI weekly: GPT-6.1 hits 97.9% byte parity on COBOL migration — DeepLearningAI · 2026-10-23