Compare commits

...
1 Commits
Author SHA1 Message Date
opencode-agent 5571e048a2 docs(cache): audit prompt-cache strategy batch 12 positive-only
Positive-only cache headers for 6 providers with documented cache behavior.
Skipped nebius, neosmith, nova, nvidia, ollama-cloud (no positive cache evidence).

- nano-gpt: implicit auto-cache plus explicit Claude controls (promptCaching helper, inline cache_control, anthropic-beta/x-prompt-caching-cut-after headers, caching:true routing)
- nearai: automatic TEE prefix cache with input_cache_read billing
- neon: native Anthropic Messages cache_control with forwarded anthropic headers
- neuralwatt: automatic vLLM prefix cache with cached_tokens and reduced energy cost
- novita-ai: automatic engine prompt cache on support_prompt_cache models
- ofox: automatic implicit chat plus native Anthropic cache_control and Gemini cachedContents
2026-09-11 17:13:57 -05:00
6 changed files with 30 additions and 0 deletions

No files matched your search

+5
View File
@@ -1,3 +1,8 @@
# Cache key (chat): implicit auto-cache on supporting routes plus `caching: true` routing to a cache-capable provider (sticky by default; `stickyprovider: false` opts out; `:caching`/`:cache`/`:cached` model suffix)
# Use headers: `anthropic-beta: prompt-caching-2024-07-31` (add `extended-cache-ttl-2025-04-11` for 1h TTL); `x-prompt-caching-cut-after: N` sets the last cached message index
# Use body: `promptCaching`/`prompt_caching`/`cache_control` helper (`enabled`, `ttl` 5m/1h, `cutAfterMessageIndex`, `stickyProvider`, `explicitCacheControl`); inline `cache_control: {"type": "ephemeral"}` blocks (max 4 per request, Claude models)
# Cache policy: stable prefix + same model; keep static content first byte-identical; Claude minimums 1024-4096 tokens; verify via `usage.cache_read_input_tokens` and `prompt_tokens_details.cached_tokens`
# Docs: https://docs.nano-gpt.com/api-reference/miscellaneous/prompt-caching
name = "NanoGPT"
env = ["NANO_GPT_API_KEY"]
npm = "@ai-sdk/openai-compatible"
+5
View File
@@ -1,3 +1,8 @@
# Cache key (chat): automatic prefix cache on TEE-hosted models with per-model input_cache_read billing
# Use headers: repeat the stable prefix with identical model and params
# Use body: repeat the stable prefix with identical model and params
# Cache policy: stable prefix + same model; put system prompt and reference docs first byte-identical; verify via `usage.prompt_tokens_details.cached_tokens`
# Docs: https://docs.near.ai/cloud/guides/prompt-caching
name = "NEAR AI Cloud"
npm = "@ai-sdk/openai-compatible"
# Gateway and direct TEE hosts use the same POST `/v1/chat/completions` API.
+5
View File
@@ -1,3 +1,8 @@
# Cache key (chat): explicit `cache_control` breakpoints via the native Anthropic Messages route
# Use headers: `anthropic-version` plus `anthropic-beta` forwarded to Anthropic on the native route
# Use body: `cache_control: {"type": "ephemeral"}` on native system/message content blocks
# Cache policy: stable prefix + same Claude model; verify via native `usage.cache_creation_input_tokens` and `cache_read_input_tokens`
# Docs: https://neon.com/docs/ai-gateway/anthropic-messages
name = "Neon"
npm = "@ai-sdk/openai-compatible"
# Unified Chat is POST `/v1/chat/completions`. Native routes are POST
+5
View File
@@ -1,3 +1,8 @@
# Cache key (chat): automatic vLLM prefix cache with `prompt_tokens_details.cached_tokens` reporting and reduced energy cost on cached tokens
# Use headers: repeat the stable prefix with identical model and params
# Use body: repeat the stable prefix with identical model and params
# Cache policy: stable prefix + same model; hits grow across follow-up turns sharing system prompt and history
# Docs: https://portal.neuralwatt.com/docs/api/chat-completions
name = "Neuralwatt"
env = ["NEURALWATT_API_KEY"]
npm = "@ai-sdk/openai-compatible"
+5
View File
@@ -1,3 +1,8 @@
# Cache key (chat): automatic engine prompt cache on supported models (`support_prompt_cache`) with cache-token billing
# Use headers: repeat the stable prefix with identical model and params
# Use body: repeat the identical prompt with identical model and params; no request changes required
# Cache policy: stable prefix + same model; repeated template and system prompts hit; verify via `usage.prompt_tokens_details.cached_tokens`
# Docs: https://novita.ai/docs/guides/llm-prompt-cache.md
name = "NovitaAI"
env = ["NOVITA_API_KEY"]
npm = "@ai-sdk/openai-compatible"
+5
View File
@@ -1,3 +1,8 @@
# Cache key (chat): automatic implicit prefix reuse on chat plus explicit `cache_control` on the Anthropic native route and `cachedContents` on the Gemini native route
# Use headers: repeat the stable prefix with identical model and params
# Use body: `cache_control: {"type": "ephemeral"}` on Anthropic Messages content blocks; `cachedContent` handle reference (created via `cachedContents`) on Gemini generateContent
# Cache policy: stable prefix + same model; put long static content first byte-identical; verify via `usage` cache fields and console usage stats
# Docs: https://ofox.ai/docs/develop/advanced/prompt-caching
name = "Ofox"
env = ["OFOX_API_KEY"]
npm = "@ai-sdk/openai-compatible"