docs: prompt caching antropic - #19253
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
||
| ### 5. Verify Cache Hits | ||
|
|
||
| Check the LiteLLM logs to confirm routing: |
There was a problem hiding this comment.
@Harshit28j I meant the ui logs. The flow would be run query -> check ui to confirm it's sent to the correct model id
And have a screenshot showing the ui log
| litellm.router: Routing to deployment: deployment-abc-123 | ||
| ``` | ||
|
|
||
| Or check the LiteLLM UI: |
|
|
||
| # Second request: | ||
| litellm.router_utils.pre_call_checks.prompt_caching_deployment_check: Found cached model_id: deployment-abc-123 | ||
| litellm.router: Routing to deployment: deployment-abc-123 |
| For a prompt to be cached: | ||
| 1. **Minimum token count**: >1024 tokens (Anthropic requirement) | ||
| 2. **Cache control directive**: Must include `cache_control` in the message | ||
| 3. **Supported models**: Anthropic Claude models (3.5 Sonnet, 3 Opus, etc.) |
There was a problem hiding this comment.
We support more than just anthropic.
Is this ai generated? Seems odd to include this.
| - Routes to deployment A (`model_id: deployment-abc-123`) | ||
| - Cache hit! 90% cost reduction on input tokens | ||
|
|
||
| ## Performance Benefits |
There was a problem hiding this comment.
Please delete this. This is just ai slop.
|
|
||
| ### Q: Does this work with other providers besides Anthropic? | ||
|
|
||
| **A**: Currently, prompt caching routing is optimized for Anthropic Claude models. Other providers may be supported in the future. |
|
Automated remediation patch bundle (generated due no direct push access to this PR branch).\nPlease cherry-pick/apply the patch proposal below and resolve corresponding threads.\n\n## PR #19253 — Unresolved threads
Proposed patchH1 — Replace ambiguous log checks with UI-log verification + screenshots diff --git a/docs/my-website/docs/tutorials/prompt_caching_routing.md b/docs/my-website/docs/tutorials/prompt_caching_routing.md
@@
-Check the LiteLLM logs to confirm routing:
+Validate routing from the LiteLLM UI Logs page:
+1. Run the same prompt twice.
+2. Open `/ui` → Logs.
+3. Confirm both requests resolved to the same `model_id`.
+4. Capture screenshots for first-call miss and second-call hit.
+
+
+H2 — Correct provider claim and FAQ wording @@
-3. **Supported models**: Anthropic Claude models (3.5 Sonnet, 3 Opus, etc.)
+3. **Supported models**: Any model/provider where prompt-caching metadata is supported in the request path.
@@
-**A**: Currently, prompt caching routing is optimized for Anthropic Claude models. Other providers may be supported in the future.
+**A**: Prompt caching routing is provider-agnostic; effective cache behavior depends on provider/model cache semantics.H3 — Remove low-signal performance marketing section @@
-## Performance Benefits
-### Cost Reduction
-... (remove speculative savings block) ... |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This is a follow-up PR: #19233