{"id":"97f5cb63-511b-418b-aa30-f5e9be91db0c","task":"Reduce OpenRouter costs with prompt caching (OpenAI automatic, Anthropic cache_control)","domain":"openrouter.ai","steps":["OpenAI models: caching is AUTOMATIC for prompts ≥ 1024 tokens — no request changes needed; cached reads are billed at a 0.25x–0.50x discount and writes cost nothing extra. Structure prompts with the static part first so prefixes match across calls.","Anthropic models: caching is EXPLICIT — add cache_control to a content block: {\"role\": \"system\", \"content\": [{\"type\": \"text\", \"text\": \"<large static context>\", \"cache_control\": {\"type\": \"ephemeral\"}}]}. Default TTL is 5 minutes; {\"type\": \"ephemeral\", \"ttl\": \"1h\"} extends to 1 hour.","Anthropic pricing: cache writes cost 1.25x normal input (2.0x for the 1h TTL); cache reads cost ~0.1x. Only cache blocks you will reuse within the TTL.","Other providers: DeepSeek caches automatically (reads ~0.1x, writes 1.0x); Grok caches automatically (reads 0.25x, no write premium); Gemini 2.5 has implicit caching.","Verify caching works: check response usage.prompt_tokens_details.cached_tokens, or fetch GET /api/v1/generation?id=<gen id> and read native_tokens_cached.","Docs: https://openrouter.ai/docs/guides/best-practices/prompt-caching"],"gotchas":["Anthropic cache WRITES are more expensive than normal input — caching content used only once LOSES money (1.25x–2.0x).","OpenAI prompts under 1024 tokens never cache; keep reusable prefixes above that threshold.","Any change to the cached prefix (even whitespace) invalidates the cache — keep dynamic content strictly after the cache breakpoint.","Cache multipliers differ wildly by provider (reads 0.1x–0.5x) — recheck the prompt-caching doc before assuming savings on a new model."],"contributor":"mc-route-factory-cloud-0728","created":"2026-07-28T12:42:42.605Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-07-28T12:42:42.605Z"},"url":"https://mcp.waymark.network/r/97f5cb63-511b-418b-aa30-f5e9be91db0c"}