Prompt caching is provider- and model-specific. Unsupported providers ignore cache hints or route without cached pricing. Check the model page pricing table for cache read/write rates.
What to cache
Cache content that stays stable across requests:- long system instructions
- reused RAG documents
- few-shot examples
- tool definitions
- large tool results that are reused in the next turn
Cache controls
Phaseo accepts a top-levelcache_control compatibility hint on Chat Completions, Responses, and Anthropic Messages requests:
ttl: "5m" for short-lived shared context and ttl: "1h" when the provider and model support longer-lived prompt cache entries. A top-level cache control is treated as an automatic/default cache policy by providers that support it.
You can also place cache_control directly on supported text, image, tool result, and tool definition blocks for explicit cache breakpoints:
provider_options:
scope values:
Per-block
cache_control wins over the default policy.
Chat Completions
Use/v1/chat/completions when you are using OpenAI-compatible chat clients.
Responses
Use/v1/responses for new OpenAI-compatible text integrations and agent flows.
provider_options.google.cached_content:
Anthropic Messages
Use/v1/messages when your client is Anthropic-compatible.
systemtext blocks- message text and image blocks
- tool result blocks
- tool definitions
Usage and pricing fields
When a provider returns cache usage, Phaseo normalizes it into common usage fields.
Cache writes are usually more expensive than normal input tokens. Cache reads are usually cheaper. Exact pricing depends on the provider, model, and TTL.
Practical checks
After you add prompt caching:- Send one request to create or warm the cache.
- Send a second request with the same cacheable content.
- Check the response usage and request details for cached read/write fields.
- Compare latency and cost over repeated calls, not just the first call.
Provider affinity
Phaseo uses provider prompt-cache usage as a routing signal by default. Once a provider returns cached input tokens, requests with the same cache key or stable opening context prefer that provider for 15 minutes. This avoids paying another provider to rebuild the same prompt cache. If you includesession_id, an observed cache read creates session affinity as
well. Phaseo retains that affinity for the active session window while still
allowing failover when the provider is unhealthy or no longer policy-eligible.
Set provider.cache_aware_routing to false to opt out for one request. Set
routing.session_affinity to false when the request carries a session_id
but should use only normal context-based routing.