Skip to content

docs(anthropic_unified): document metadata.user_id to prompt_cache_key mapping - #959

Merged
mateo-berri merged 2 commits into
mainfrom
litellm_lit_5875_prompt_cache_key_docs
Aug 20, 2026
Merged

docs(anthropic_unified): document metadata.user_id to prompt_cache_key mapping#959
mateo-berri merged 2 commits into
mainfrom
litellm_lit_5875_prompt_cache_key_docs

Conversation

@mateo-berri

@mateo-berri mateo-berri commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

metadata.user_id on the /v1/messages bridge now maps to OpenAI's prompt_cache_key as well as user, capped at 64 characters, so the Responses mapping table gets a second row for it. A short note under the table covers the chat-completions path, where the key is only set for providers that support it, and that a prompt_cache_key sent by the client wins over the derived one

Pairs with BerriAI/litellm#37623, which ships the behavior

Related: LIT-5875


Note

Low Risk
Documentation-only change with no runtime or security impact; behavior is described as shipped in a paired implementation PR.

Overview
Documents that metadata.user_id on the /v1/messages → Responses bridge now maps to prompt_cache_key in addition to user, using the same value truncated to 64 characters so per-user traffic can reuse OpenAI prompt cache entries. The table notes when the derived key is omitted (empty/null user_id) and that an explicit request prompt_cache_key overrides the derived value.

Adds a short note for the chat-completions path: the same two fields are derived from metadata.user_id, but user is not truncated and prompt_cache_key is only forwarded when the target provider supports it (OpenAI/Azure-compatible yes; Gemini, Vertex, Bedrock, Anthropic no).

Reviewed by Cursor Bugbot for commit b1c7315. Bugbot is set up for automated code reviews on this repo. Configure here.

…y mapping

The /v1/messages bridge now derives OpenAI's prompt_cache_key from metadata.user_id alongside user, capped at 64 characters. Adds the row to the Responses mapping table and a note on the chat-completions path, where the key is only set for providers that support it, plus the client-sent override
@vercel

vercel Bot commented Aug 20, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview Aug 20, 2026 11:42am

Request Review

@mateo-berri

Copy link
Copy Markdown
Collaborator Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b1c7315. Configure here.

@vercel
vercel Bot requested a deployment to Preview August 20, 2026 11:12 Abandoned
@vercel
vercel Bot requested a deployment to Preview August 20, 2026 11:12 Abandoned
@mateo-berri

Copy link
Copy Markdown
Collaborator Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit dff3633. Configure here.

@mateo-berri
mateo-berri merged commit 134b9ea into main Aug 20, 2026
3 checks passed
@mateo-berri
mateo-berri deleted the litellm_lit_5875_prompt_cache_key_docs branch August 20, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant