fix(llm): only attach prompt-cache points on routes LiteLLM serves - #1186
Merged
Conversation
cache_control_injection_points is LiteLLM's own request field, but it was added
for any model name containing "claude". A bare claude-* name with LLM_API_BASE
set (an OpenAI-compatible gateway in front of Claude) is served by the SDK's
own OpenAI client, which rejects request kwargs it does not know, so every turn
died with:
TypeError: AsyncCompletions.create() got an unexpected keyword argument
'cache_control_injection_points'
routes_through_litellm() mirrors StrixProvider's routing, so the field only
goes where it is understood; explicit anthropic//litellm//bedrock routes keep
prompt caching.
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Contributor
Greptile SummaryThe PR prevents LiteLLM-specific prompt-cache arguments from being attached to model requests served by native SDK clients.
Confidence Score: 5/5The PR appears safe to merge, with no actionable correctness or security issues identified. The new gate follows the provider-routing boundary and preserves prompt-cache arguments on LiteLLM-backed Claude routes while removing an unsupported argument from native SDK requests. Important Files Changed
Reviews (1): Last reviewed commit: "fix(llm): only attach prompt-cache point..." | Re-trigger Greptile |
0xallam
approved these changes
Aug 28, 2026
alexzerabr
pushed a commit
to alexzerabr/strix
that referenced
this pull request
Aug 31, 2026
…sestrix#1186) Co-authored-by: Ahmed Allam <ahmed39652003@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cache_control_injection_pointsis LiteLLM's own request field, consumed by its Anthropic transform — but_prompt_cache_extra_args()attached it to any model name containing "claude", conflating model identity with provider routing. A bareclaude-sonnet-4-5withLLM_API_BASEset (i.e. Claude behind an OpenAI-compatible gateway) is served by the SDK's own OpenAI client, which forwards unknown request kwargs straight intoAsyncCompletions.create(), so every turn dies before the first token:The gate now asks who actually serves the request, mirroring
StrixProvider._resolve_prefixed_model()(bare names andopenai//any-llm/→ SDK clients; anything else prefixed → LiteLLM fallback):So
anthropic/…,litellm/…,vertex_ai/…and the mapped Bedrock routes keep prompt caching unchanged; only the routes that would have crashed lose the field (they never cached anyway — the gateway decides caching there).tests/test_models.pypins the helper against the provider itself: for each name it buildsStrixProvider().get_model(...), unwraps the_NonStreamingModel/_TurnGuardModelwrappers, and assertsisinstance(inner, LitellmModel) is routes_through_litellm(name)— otherwise drift between the two makes every request on a route fail mid-turn, which is exactly the bug above.Testing
uv run pytest tests/test_models.py tests/test_inputs.py→ 123 passed. Full suite passes except a pre-existing, unrelatedtests/test_pricing.py::test_resolves_common_bare_model_namesfailure (resolve_litellm_model("MiniMax-M3")isNoneonmaintoo); 1186 passed with it deselected.ruff check,ruff format --check,mypy,banditon the changed files: clean.claude-sonnet-4-5andopenai/claude-sonnet-4-5now reach the transport (APIConnectionError) instead of raising theTypeError, whileanthropic/…,litellm/anthropic/…andbedrock/…still send the cache points.Link to Devin session: https://app.devin.ai/sessions/54414ea3ecb34ade9189534e5c690969
Open in Devin Desktop: https://app.devin.ai/desktop/session/54414ea3ecb34ade9189534e5c690969?variant=devin