Repository navigation
fix(cli): pin pi compat flags so lite pi stops sending store to Anthropic models - #40739
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 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:
|
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
|
bugbot run |
There was a problem hiding this comment.
✅ 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 f9030b2. Configure here.
TLDR
Problem this solves:
lite pifails on every Anthropic model withanthropic does not support parameters: ['store']store: falseto the gatewayprompt_cache_key/prompt_cache_retentionHow it solves it:
lite piwrites now pinscompat: {supportsStore: false, supportsLongCacheRetention: false}User Flow
Before: a developer who launches
lite piagainst their LiteLLM gateway gets a 400 on every prompt to an Anthropic modellite pi --base-url https://litellm-domain --api-key sk-...and pi opens pinned to the gateway's first model,anthropic-haiku-5-5Reply with the single word pongand press Enter"store": falsein the body, plusprompt_cache_keywhen they run withPI_CACHE_RETENTION=longError: 400: {"message":"litellm.UnsupportedParamsError: anthropic does not support parameters: ['store'], for model=claude-haiku-5-5 ...and no answer, on every Anthropic model group, while OpenAI groups answerAfter: the same session answers
lite pi --base-url https://litellm-domain --api-key sk-...and pi opens pinned to the gateway's first model,anthropic-haiku-5-5Reply with the single word pongand press Enterstoreor the prompt cache fields, with or withoutPI_CACHE_RETENTION=longpong, and OpenAI groups through the same gateway still answerRelevant issues
Reported by a customer in Pylon #8198
Linear ticket
Resolves LIT-7576
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
QA and /live-pr-risk ran on
f9030b2934570b206f23f1cef63be86b3794d68c, this PR's tipShared setup. Real pi 1.1.0 (
@earendil-works/pi-coding-agent) driven interactively in tmux throughlite pi, real Anthropic and OpenAI calls. One proxy on a random free port, booted from this PR's tip with two uvicorn workers and nodrop_params(the customer's default). The proxy tree carries no diff from this PR, so both legs talk to the same proxy and differ only in whichliteCLI writes pi'smodels.json: before islitefrom the merge base6b8dcec64e8(main), after islitefrom this PR's tipf9030b2934. Every leg gets a freshHOMEandPI_CODING_AGENT_DIRThen type
Reply with the single word pongand press Enter. The long-retention legs addPI_CACHE_RETENTION=longto the environment, and the regression-control legs pass--model litellm/openai-gpt-5-4-miniControl pair against the same proxy, proving the 400 is exactly
storereaching an Anthropic model:diffof themodels.jsonthe two legs wrote is exactly the compat block:Before (6b8dcec,
litefrom main)Anthropic model, default settings: the first prompt fails with a 400 naming
storelite ... pi --model litellm/anthropic-haiku-5-5Anthropic model with
PI_CACHE_RETENTION=long: the 400 also namesprompt_cache_keyPI_CACHE_RETENTION=long lite ... pi --model litellm/anthropic-haiku-5-5OpenAI model (regression control): answers
lite ... pi --model litellm/openai-gpt-5-4-miniAfter (f9030b2,
litefrom this PR)Anthropic model, default settings: answers
lite ... pi --model litellm/anthropic-haiku-5-5Anthropic model with
PI_CACHE_RETENTION=long: answersPI_CACHE_RETENTION=long lite ... pi --model litellm/anthropic-haiku-5-5OpenAI model (regression control): still answers
lite ... pi --model litellm/openai-gpt-5-4-miniObservations from the run:
prompt_cache_key; this PR fixes it/live-pr-risk
No breaking change and no regression on a dependent path. The diff adds one key to the provider entry
lite piwrites, and everything that reads that entry ran live aboveBreaking: none. The six legs are the base-vs-head A/B; the changed code runs only in the
liteCLI, so the two sides are the two CLIs against one proxy booted from the tipBackward incompatible: with
PI_CACHE_RETENTION=long, pi behindlite pino longer sendsprompt_cache_keyandprompt_cache_retention: "24h"to any model, OpenAI included (the Low caveat below). Shipped as is: the OpenAI legs answer the same on both sides, and the approval on this PR is the sign-offRegression risk:
lite piruns whateverpiis on PATH, unpinned. Provider-levelcompat.supportsLongCacheRetentionis accepted since pi 0.70.0 (pi changelog, 2026-04-23) and the oldest version published under@earendil-works/pi-coding-agentis 0.74.0, so every installable pi takes both flags. Verified live on 1.1.0 (this run) and on 0.85.1 (the earlier proof on this PR atbaa64463482), not run on 0.74.0 through 0.84.xDependency graph:
provider_blockinlitellm/proxy/client/cli/commands/pi.py(return gainscompat) ->sync_models_jsonin the same file (rewrites only thelitellmprovider entry) ->prepare_piincommands/agents.py(lite pi): tested (tests/unit/proxy/client/cli/test_pi.py, and the wholetests/unit/proxy/client/clidirectory, 965 tests, pass at the tip under an isolated HOME) and verified live. pi 1.1.0 as the JSON consumer: verified live. Nothing in the proxy server,enterprise/, the dashboard,tests/llm_translation,tests/local_testing,tests/integration, or the docs repo references the changed symbols or the compat keys. Merge-ref: the branch carries main6b8dcec64e8merged in, the 8 commits main gained since touch neitherlitellm/proxy/clientnor its tests, and a merge with current main is cleanNot verified: pi 0.74.0 through 0.84.x (the flag is accepted per pi's changelog, not run here), and
anthropic-sonnet-5-5sat in the proxy config but was not driven, since the 400 comes from the provider-wide Anthropic parameter list rather than a per-model onef9030b2934570b206f23f1cef63be86b3794d68cpasses /audit (skipped: no product code on a request path, client CLI change)Type
🐛 Bug Fix
Caveats (if any)
Low
supportsLongCacheRetention: falsealso drops theprompt_cache_keyand 24hprompt_cache_retentionfields pi sends under its opt-inPI_CACHE_RETENTION=longfor OpenAI models behind the proxy (pi sends neither at the default retention, andstoreis already OpenAI's default, so omitting it changes nothing there). Net negative to fix: pi readscompatper provider entry and one gateway URL fronts every model, so a per-model map has nowhere to live, and an opt-in flag that turns it back on would 400 every Anthropic group behind the same URL again. The OpenAI legs above answer on both sidesliterelease before this fix keeps writing the entry withoutcompat. Until they upgrade, users can hand-add a second provider entry carrying the two flags, whichlite pileaves in place since it rewrites only its ownlitellmentry. Net negative to fix: no code change reaches an already installed CLIFinal Attestation
Link to Devin session: https://app.devin.ai/sessions/17a4cab15fca4978ab3ae1bb5d05e582
Open in Devin Desktop: https://app.devin.ai/desktop/session/17a4cab15fca4978ab3ae1bb5d05e582?variant=devin
Note
Low Risk
CLI-only change to generated pi config JSON; main tradeoff is pi no longer sends long-cache retention params for OpenAI models through the same provider block.
Overview
lite pinow writes explicitcompatflags into the pimodels.jsonprovider entry so pi does not infer OpenAI-style capabilities from the gateway URL.provider_blockaddscompat: { supportsStore: false, supportsLongCacheRetention: false }, which stops pi from sendingstore(and long-cacheprompt_cache_*fields) on chat completion requests. That fixes 400 errors on Anthropic model groups behind a single LiteLLM proxy URL whendrop_paramsis off. The unit test for the generated provider block is updated to expect the newcompatobject.Reviewed by Cursor Bugbot for commit f9030b2. Bugbot is set up for automated code reviews on this repo. Configure here.
f9030b2934570b206f23f1cef63be86b3794d68cpasses /live-pr-risk