[brianh014]: ## Cause found, and a fix **Our prompt layout broke the cache, not DeepInfra's machines.** Kimi's and GLM's chat templates move system messages that come after the story to the front. The Plot Threads message changes every Turn and sits after the story, so the front of the prompt changed every Turn and the cache missed. DeepSeek's template leaves it in place, which is why it cached. How it was found, from test calls pinned to DeepInfra: - The same prompt sent twice caches fine on both models (Kimi 12.5k of 14k, GLM 14.2k of 14.3k). `cache_control` changes nothing. - Two consecutive Turns that had never been sent before missed: Kimi cached 0, GLM only the 6k system front. Adding a `prompt_cache_key` alone didn't help. - With the key, and every system message after the story sent as a user message, the next Turn cached Kimi 26.9k of 28.4k and GLM 62%. ## Fix Every system message after the story is now sent as a user message, and calls to OpenRouter carry a `prompt_cache_key`, one per run and kind of call. 45-round runs pinned to DeepInfra, share of `narrator.turn` input cached: | Narrator | Before | After | |---|---|---| | GLM-5.3 | 24% | **56%** | | Kimi K3.1 Pro | 1% | **23%** | | DeepSeek V4.1 Flash | 56% | 57% | A blind judge of the DeepSeek run found no major mistakes, and no hidden Plot Thread truth reached the page. **Kimi is still capped.** Every Kimi Turn caches

Context: GitHub issue brianh014/inkandthread#149 (closed, 1 comments, reported 2026-12-02): **Type:** research (cost, providers) **Found:** 2026-12-01, in the four-Narrator 120-round adventure round, pinned to DeepInfra through OpenRouter (`--host DeepInfra`). The Kimi play cost **$15.06 against a $3.59 estimate**, and GLM-5.3 cost $3.72 against $0.79. OpenRouter lists a cache-read price for both on DeepInfra (Kimi $0.19 against $1.90 a million, GLM $0.125 against $0.563), so the cache should be cutting the bill. The player keeps DeepInfra, so the fix has to work there. ## The numbers Here is the share of input tokens that came back as cached reads, from each play's "Tokens by ca

---

## Vectle citations

- Exact version: <https://vectle.com/skills/skl_hbO7FyAAAF2OZvNGpik_Mg/versions/skv_R2y_nNEvv-Zddml_7byLgg>
- Canonical HTML skill page: <https://vectle.com/skills/skl_hbO7FyAAAF2OZvNGpik_Mg>
- Current Markdown URL: <https://vectle.com/skills/skl_hbO7FyAAAF2OZvNGpik_Mg/markdown>

## Selected public attribution and original notices/references

```json
{
  "author": "Fin",
  "client": null,
  "notices_and_references": []
}
```
