Skip to content

fix(cli): pin pi compat flags so lite pi stops sending store to Anthropic models - #40739

Merged
mateo-berri merged 5 commits into
mainfrom
litellm_lite_pi_compat_store
Oct 9, 2026
Merged

mateo-berri merged 5 commits into
mainfrom
litellm_lite_pi_compat_store

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • lite pi fails on every Anthropic model with anthropic does not support parameters: ['store']
  • pi guesses compat from the base URL and sends store: false to the gateway
  • With long cache retention it also sends prompt_cache_key / prompt_cache_retention

How it solves it:

  • The provider entry lite pi writes now pins compat: {supportsStore: false, supportsLongCacheRetention: false}
  • One gateway URL fronts models with different capabilities, so URL sniffing cannot be right

User Flow

Before: a developer who launches lite pi against their LiteLLM gateway gets a 400 on every prompt to an Anthropic model

  1. They run lite pi --base-url https://litellm-domain --api-key sk-... and pi opens pinned to the gateway's first model, anthropic-haiku-5-5
  2. They type Reply with the single word pong and press Enter
  3. pi sends POST https://litellm-domain/v1/chat/completions with "store": false in the body, plus prompt_cache_key when they run with PI_CACHE_RETENTION=long
  4. The pane shows Error: 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 answer

After: the same session answers

  1. They run lite pi --base-url https://litellm-domain --api-key sk-... and pi opens pinned to the gateway's first model, anthropic-haiku-5-5
  2. They type Reply with the single word pong and press Enter
  3. pi sends POST https://litellm-domain/v1/chat/completions without store or the prompt cache fields, with or without PI_CACHE_RETENTION=long
  4. The pane shows pong, and OpenAI groups through the same gateway still answer

Relevant 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

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. 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
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to 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 tip

Shared setup. Real pi 1.1.0 (@earendil-works/pi-coding-agent) driven interactively in tmux through lite pi, real Anthropic and OpenAI calls. One proxy on a random free port, booted from this PR's tip with two uvicorn workers and no drop_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 which lite CLI writes pi's models.json: before is lite from the merge base 6b8dcec64e8 (main), after is lite from this PR's tip f9030b2934. Every leg gets a fresh HOME and PI_CODING_AGENT_DIR

model_list:
  - model_name: anthropic-haiku-5-5
    litellm_params:
      model: anthropic/claude-haiku-5-5
      api_key: os.environ/ANTHROPIC_API_KEY
  - model_name: anthropic-sonnet-5-5
    litellm_params:
      model: anthropic/claude-sonnet-5-5
      api_key: os.environ/ANTHROPIC_API_KEY
  - model_name: openai-gpt-5-4-mini
    litellm_params:
      model: openai/gpt-5.4-mini
      api_key: os.environ/OPENAI_API_KEY

general_settings:
  master_key: os.environ/LITELLM_MASTER_KEY
python litellm/proxy/proxy_cli.py --config qa_config.yaml --port 52487 --detailed_debug --num_workers 2

HOME=<fresh dir> PI_CODING_AGENT_DIR=<fresh dir> lite --base-url http://127.0.0.1:52487 --api-key $LITELLM_MASTER_KEY pi --model litellm/anthropic-haiku-5-5

Then type Reply with the single word pong and press Enter. The long-retention legs add PI_CACHE_RETENTION=long to the environment, and the regression-control legs pass --model litellm/openai-gpt-5-4-mini

Control pair against the same proxy, proving the 400 is exactly store reaching an Anthropic model:

curl -sS -X POST http://127.0.0.1:52487/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d '{"model":"anthropic-haiku-5-5","messages":[{"role":"user","content":"Reply with the single word pong"}],"store":false}'
# status=400  litellm.UnsupportedParamsError: anthropic does not support parameters: ['store'], for model=claude-haiku-5-5 ...
curl -sS -X POST http://127.0.0.1:52487/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H 'Content-Type: application/json' \
  -d '{"model":"anthropic-haiku-5-5","messages":[{"role":"user","content":"Reply with the single word pong"}]}'
# status=200  "Pong"

diff of the models.json the two legs wrote is exactly the compat block:

5a6,9
>             "compat": {
>                 "supportsStore": false,
>                 "supportsLongCacheRetention": false
>             },

Before (6b8dcec, lite from main)

Anthropic model, default settings: the first prompt fails with a 400 naming store

lite ... pi --model litellm/anthropic-haiku-5-5

 Reply with the single word pong
 Error: 400: {"message":"litellm.UnsupportedParamsError: anthropic does not support parameters: ['store'], for model=claude-haiku-5-5. To
 drop these, set `litellm.drop_params=True` or for proxy:\n\n`litellm_settings:\n drop_params: true`\n. \n If you want to use these params
 dynamically send allowed_openai_params=['store'] in your request.\n\nLiteLLM: model group 'anthropic-haiku-5-5' failed with the error
 above. No fallback was attempted.","type":"invalid_request_error","param":null,"code":"400"}
 If this looks like a pi bug, /bug sends a report to the developers.
0.6%/1.0M (auto)   (litellm) anthropic-haiku-5-5

pr40739-f9030b2934-shot2-before.png

Anthropic model with PI_CACHE_RETENTION=long: the 400 also names prompt_cache_key

PI_CACHE_RETENTION=long lite ... pi --model litellm/anthropic-haiku-5-5

 Reply with the single word pong
 Error: 400: {"message":"litellm.UnsupportedParamsError: anthropic does not support parameters: ['store', 'prompt_cache_key'], for
 model=claude-haiku-5-5. To drop these, set `litellm.drop_params=True` or for proxy:\n\n`litellm_settings:\n drop_params: true`\n. \n If
 you want to use these params dynamically send allowed_openai_params=['store', 'prompt_cache_key'] in your request.\n\nLiteLLM: model group
 'anthropic-haiku-5-5' failed with the error above. No fallback was attempted.","type":"invalid_request_error","param":null,"code":"400"}
 If this looks like a pi bug, /bug sends a report to the developers.
0.6%/1.0M (auto)   (litellm) anthropic-haiku-5-5

pr40739-f9030b2934-shot2-before-long.png

OpenAI model (regression control): answers

lite ... pi --model litellm/openai-gpt-5-4-mini

 Reply with the single word pong
 pong
↑5.5k ↓5 2.0%/272k (auto)   (litellm) openai-gpt-5-4-mini

pr40739-f9030b2934-shot2-before-openai.png

After (f9030b2, lite from this PR)

Anthropic model, default settings: answers

lite ... pi --model litellm/anthropic-haiku-5-5

 Reply with the single word pong
 pong
↑8.8k ↓4 0.9%/1.0M (auto)   (litellm) anthropic-haiku-5-5

pr40739-f9030b2934-shot2-after.png

Anthropic model with PI_CACHE_RETENTION=long: answers

PI_CACHE_RETENTION=long lite ... pi --model litellm/anthropic-haiku-5-5

 Reply with the single word pong
 pong
↑8.8k ↓4 0.9%/1.0M (auto)   (litellm) anthropic-haiku-5-5

pr40739-f9030b2934-shot2-after-long.png

OpenAI model (regression control): still answers

lite ... pi --model litellm/openai-gpt-5-4-mini

 Reply with the single word pong
 pong
↑5.5k ↓5 2.0%/272k (auto)   (litellm) openai-gpt-5-4-mini

pr40739-f9030b2934-shot2-after-openai.png

Observations from the run:

  • Long-retention error also names prompt_cache_key; this PR fixes it
  • OpenAI groups answer on both sides; this PR leaves them alone
  • Every leg ran against the same two-worker proxy

/live-pr-risk

No breaking change and no regression on a dependent path. The diff adds one key to the provider entry lite pi writes, and everything that reads that entry ran live above

  • Breaking: none. The six legs are the base-vs-head A/B; the changed code runs only in the lite CLI, so the two sides are the two CLIs against one proxy booted from the tip

  • Backward incompatible: with PI_CACHE_RETENTION=long, pi behind lite pi no longer sends prompt_cache_key and prompt_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-off

  • Regression risk: lite pi runs whatever pi is on PATH, unpinned. Provider-level compat.supportsLongCacheRetention is accepted since pi 0.70.0 (pi changelog, 2026-04-23) and the oldest version published under @earendil-works/pi-coding-agent is 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 at baa64463482), not run on 0.74.0 through 0.84.x

  • Dependency graph: provider_block in litellm/proxy/client/cli/commands/pi.py (return gains compat) -> sync_models_json in the same file (rewrites only the litellm provider entry) -> prepare_pi in commands/agents.py (lite pi): tested (tests/unit/proxy/client/cli/test_pi.py, and the whole tests/unit/proxy/client/cli directory, 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 main 6b8dcec64e8 merged in, the 8 commits main gained since touch neither litellm/proxy/client nor its tests, and a merge with current main is clean

  • Not verified: pi 0.74.0 through 0.84.x (the flag is accepted per pi's changelog, not run here), and anthropic-sonnet-5-5 sat in the proxy config but was not driven, since the 400 comes from the provider-wide Anthropic parameter list rather than a per-model one

  • f9030b2934570b206f23f1cef63be86b3794d68c passes /audit (skipped: no product code on a request path, client CLI change)

Type

🐛 Bug Fix

Caveats (if any)

Low

  • supportsLongCacheRetention: false also drops the prompt_cache_key and 24h prompt_cache_retention fields pi sends under its opt-in PI_CACHE_RETENTION=long for OpenAI models behind the proxy (pi sends neither at the default retention, and store is already OpenAI's default, so omitting it changes nothing there). Net negative to fix: pi reads compat per 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 sides
  • A lite release before this fix keeps writing the entry without compat. Until they upgrade, users can hand-add a second provider entry carrying the two flags, which lite pi leaves in place since it rewrites only its own litellm entry. Net negative to fix: no code change reaches an already installed CLI

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

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 pi now writes explicit compat flags into the pi models.json provider entry so pi does not infer OpenAI-style capabilities from the gateway URL.

provider_block adds compat: { supportsStore: false, supportsLongCacheRetention: false }, which stops pi from sending store (and long-cache prompt_cache_* fields) on chat completion requests. That fixes 400 errors on Anthropic model groups behind a single LiteLLM proxy URL when drop_params is off. The unit test for the generated provider block is updated to expect the new compat object.

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

  • f9030b2934570b206f23f1cef63be86b3794d68c passes /live-pr-risk

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

devin-ai-integration Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration
devin-ai-integration Bot requested a review from a team September 11, 2026 15:33
@greptile-apps

greptile-apps Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge with no outstanding blocking findings

Summary

lite pi now writes supportsStore: false and supportsLongCacheRetention: false into its generated provider entry. The existing test checks both flags

  • lite pi keeps unsupported fields out of gateway requests.

Reviews (5) · Last reviewed commit: "fix(cli): drop the stale mutable-ok supp..." · Reviewed by Greptile

@codspeed

codspeed Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_lite_pi_compat_store (f9030b2) with main (6a2d3ed)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (f45407b) during the generation of this report, so 6a2d3ed was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@greptileai

Comment thread litellm/proxy/client/cli/commands/pi.py Resolved
@codecov

codecov Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

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>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@yuneng-berri
yuneng-berri deleted the branch main September 13, 2026 04:52
@yuneng-berri yuneng-berri reopened this Sep 13, 2026
@devin-ai-integration
devin-ai-integration Bot changed the base branch from litellm_internal_staging to main September 23, 2026 14:36
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

Comment thread litellm/proxy/client/cli/commands/pi.py Resolved
Comment thread litellm/proxy/client/cli/commands/pi.py Resolved
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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 f9030b2. Configure here.

@mateo-berri mateo-berri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@mateo-berri
mateo-berri merged commit c5c5154 into main Oct 9, 2026
146 of 147 checks passed
@mateo-berri
mateo-berri deleted the litellm_lite_pi_compat_store branch October 9, 2026 01:30
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.

3 participants