cache_control:
How markers are handled
For Claude,
prompt_tokens includes cache reads and writes, so cost accounting stays correct. Usage also carries cache_read_input_tokens and cache_creation_input_tokens.
Check support
supports_prompt_caching answers True only where markers are honoured, which is Claude, directly or through OpenRouter.
OpenAI caches long prompts on its own, with no markers, and reports the hits in
usage.prompt_tokens_details.cached_tokens. Gemini has a separate caching API. Both answer False from supports_prompt_caching even though their catalog entries carry a cache-read price.Compress long Claude requests
Long cached histories still have to be uploaded on every call. Passgzip=True, or set ROUTEHUB_GZIP_ON=1, to gzip the request body sent to Claude’s Messages API. OpenAI-compatible providers always get an uncompressed body.