Skip to content

docs: prompt caching antropic - #19253

Closed
Harshit28j wants to merge 1 commit into
BerriAI:mainfrom
Harshit28j:docs/prompt-caching-routing-guide
Closed

docs: prompt caching antropic#19253
Harshit28j wants to merge 1 commit into
BerriAI:mainfrom
Harshit28j:docs/prompt-caching-routing-guide

Conversation

@Harshit28j

@Harshit28j Harshit28j commented Jan 16, 2026

Copy link
Copy Markdown
Contributor

This is a follow-up PR: #19233

@vercel

vercel Bot commented Jan 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
litellm Error Error Jan 16, 2026 10:49pm

Request Review


### 5. Verify Cache Hits

Check the LiteLLM logs to confirm routing:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include screenshots please


# 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these .info logs?

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.)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong

@giulio-leone

Copy link
Copy Markdown
Contributor

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 #19253docs/prompt-caching-routing-guide
Head: Harshit28j/litellm@docs/prompt-caching-routing-guide

Unresolved threads

  • T01 (H1) krrishdholakiadocs/my-website/docs/tutorials/prompt_caching_routing.md:107@Harshit28j I meant the ui logs. The flow would be run query -> check ui to confirm it's sent to the correct model id
  • T02 (H1) krrishdholakiadocs/my-website/docs/tutorials/prompt_caching_routing.md:119 — Include screenshots please
  • T03 (H1) krrishdholakiadocs/my-website/docs/tutorials/prompt_caching_routing.md:116 — Are these .info logs?
  • T04 (H2) krrishdholakiadocs/my-website/docs/tutorials/prompt_caching_routing.md:141 — We support more than just anthropic.
  • T05 (H3) krrishdholakiadocs/my-website/docs/tutorials/prompt_caching_routing.md:245 — Please delete this. This is just ai slop.
  • T06 (H2) krrishdholakiadocs/my-website/docs/tutorials/prompt_caching_routing.md:303 — This is wrong

Proposed patch

H1 — 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.
+
+![UI logs - first request](../../static/img/tutorials/prompt-caching-routing-first-request.png)
+![UI logs - cache hit](../../static/img/tutorials/prompt-caching-routing-cache-hit.png)

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) ...

@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added the stale label Jun 1, 2026
@github-actions github-actions Bot closed this Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants