The research, question and page-index loops, and the context pre-pass, call chat.completions.create themselves and never add cache_control.
The chat loop got its breakpoints in #2081; these paths did not. A Claude model reached through OpenRouter caches nothing on them, so every round of a tool loop pays full price for the system prompt, tool schemas and all earlier rounds.
- What to change
- In run_labeled_step (and the explorer's _call_llm) call the same helper agent_loop._apply_prompt_caching uses: OpenAICompatProvider.supports_prompt_caching_for(model), the binding check, then OpenAICompatProvider._apply_cache_control(messages, tools, stable_history_end=False).
- Why it matters
- Anthropic caches a prefix only at a cache_control breakpoint. A loop of N rounds re-sends a growing prefix N times; with marks, rounds 2..N read it at the cached rate instead of the full input rate.
- How often it happens
- The code shows the problem; how often it happens is assumed. To measure it: how many calls per 1,000 run through run_agentic_loop, run_labeled_step or the explorer loop on an OpenRouter profile whose model id starts with anthropic/ or claude (usage.sqlite3 rows with cache_read_input_tokens = 0 for those sources)
- Who reaches this
- only OpenRouter profiles that route anthropic/ or claude models; native Anthropic bindings get marks in their provider
- Overlaps
- Finding 2 loses some of the same tokens; the totals count the larger once.
- Estimate
- about 1.8M prompt tokens per 1,000 calls not served from cache on affected profiles (estimate)
What the estimate assumes
average_call 12,000 prompt tokens; 30% of calls run through these loops; about 8,000 reusable tokens per such call (system, tools, earlier rounds); one write per loop priced at 1.25x. Only OpenRouter-Claude profiles are affected.