Repository navigation
fix(ui): save a price edited in the Model Info JSON as the deployment's override - #53136
kerry-berri wants to merge 9 commits into
Conversation
…ent's override Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Admin UI QA at 8bcbf08, dashboard run from source against a proxy on main's backendOn an Reopening Edit Settings without a reload showed Other flowsA second Model Info edit to The screenshot from the earlier proxy-side revision at |
…arams Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
[Medium impact] The PR appears safe to merge with no new actionable issues found.
|
…s override, leave the proxy unchanged Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…e page Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…s the new override Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
…lift rates edited in Model Info Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ing started Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
… again Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
bugbot run |
… one from when the save started Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
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 d0703f3. Configure here.
Admin UI retest passed at a7688a0Model Info retained |
Handwritten 1-3 sentence description
Editing a price in the Model Info JSON box on a model's Edit Settings form now saves it as that deployment's own price, instead of reporting success and storing nothing. The dashboard sends only the rates the operator changed, so prices it merely displays from the cost map are still not frozen onto the deployment, and the proxy is untouched.
Details
Link to Devin session: https://app.devin.ai/sessions/5652c6c0d56c494a97aa7481e2aff24a
Open in Devin Desktop: https://app.devin.ai/desktop/session/5652c6c0d56c494a97aa7481e2aff24a?variant=devin
Requested by: @kerry-berri
Why this PR exists: a customer on v1.108.3 running Azure Government deployments edited
input_cost_per_token_above_272k_tokensin the Model Info JSON, got a success toast and the commercial rate stayed. Reproduced on v1.108.3 and on main (below).TLDR
Problem this solves:
How it solves it:
litellm_paramsoverridesThe proxy is unchanged, so API clients see no difference. Pricing sent in
model_infostraight toPATCH /model/{id}/updateis still dropped, as it has been since v1.102.0 (#36222).Design decisions:
litellm_params, where deployment pricing already lives.litellm_params. The form knows what it loaded, so it compares against that and sends numbers only._cost,_above_<N>_tokensor_uplift_multiplier, andcost_per_second.cost_per_ptu_per_hourstays onmodel_info, and thetiered_pricinglist is not promoted.input_cost_per_tokenand the like), an input the operator changed in that save wins, otherwise the Model Info edit is saved.User Flow
Before: a proxy admin edits a long context rate in Model Info, sees success, and the rate does not change
azure/gpt-5.4deployment and click Edit Settingsinput_cost_per_token_above_272k_tokensto their Azure Government rate and savePATCH https://litellm-domain/model/{id}/updatereturns 200 and the UI shows a success toastAfter: the same edit sticks
azure/gpt-5.4deployment and click Edit Settingsinput_cost_per_token_above_272k_tokensto their Azure Government rate and savePATCH https://litellm-domain/model/{id}/updatecarries the rate inlitellm_params, returns 200 and the UI shows a success toastRelevant issues
Related to #36222 (the proxy filter this leaves in place) and #50866 (
/model/new).Affected release
Behavior since v1.102.0, reproduced on v1.108.3.
Pre-Submission checklist
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 moreScreenshots / Proof of Fix
Setup: Postgres on localhost and one proxy on main's backend code, started with
litellm --config config.yaml --port 4141(model_list: [],store_model_in_db: true, envDATABASE_URL,STORE_MODEL_IN_DB=True,LITELLM_LOCAL_MODEL_COST_MAP=True). The dashboard runs from source withNEXT_PUBLIC_USE_REWRITES=true LENS_DEV_PROXY_URL=http://127.0.0.1:4141 npm run dev -- --hostname 127.0.0.1 --port 4310inlitellm/ui/litellm-dashboard, opened at http://localhost:4310/ui/. One worker and no Redis, since a model save touches no shared counters, and no provider call is made. The deployment isazure/gpt-5.4created withPOST /model/new.Before, at merge base 90ee763: in Models + Endpoints, open the deployment, click Edit Settings, change
input_cost_per_token_above_272k_tokensfrom0.000005to0.000006in Model Info and click Save Changes. The toast says "Model settings updated successfully", the PATCH returns 200, and after a reload the rate is0.000005again with no key in LiteLLM Params. On v1.108.3 from PyPI the same save sent with curl (the/model/inforesponse with the two 272k rates edited, asmodel_infoonPATCH /model/{id}/update) also returns 200 and stores nothing.After: the same clicks send
0.000006insidelitellm_params, and both boxes show it after a reload. The screenshots and the other flows (no-edit save, unrelated edit on a fresh deployment, Params-only edit, a second edit without reload, deleting the override from the Params box, editinginput_cost_per_tokenin the JSON,cost_per_second, a metadata edit followed by an unrelated save) are in the QA comments on this PR.Tests:
npx vitest run src/utils/modelEditParams.test.ts src/components/model_info_view.integration.test.tsxpasses. The integration test fails without themodel_info_view.tsxchange because the PATCH carries no rate inlitellm_params.Type
🐛 Bug Fix
Caveats (if any)
Medium
model_infostill get a 200 with nothing storedLow
/model/newis unchanged, fix(proxy): keep pricing typed into model_info on /model/new by mirroring it onto litellm_params #50866 covers itFinal Attestation
Note
Medium Risk
Changes how model PATCH payloads are built for pricing fields; mistakes could send wrong overrides or drop params, though scope is limited to the dashboard edit flow and the proxy is unchanged.
Overview
Model Info JSON price edits now save as deployment
litellm_paramsoverrides instead of succeeding with no persisted change. The dashboard compares edited JSON against what the form showed when editing started, promotes only matching numeric rate keys, and merges those into the PATCH payload; LiteLLM Params edits on the same save still win when both boxes change the same key.A new
useModelInfoEditshook keeps the just-savedmodel_infovisible until the model refetches, records the baseline at edit start, and wireseditedModelInfoPricinginto save.ModelInfoEditFormresets when leaving edit mode and adds an aria-label on the Model Info textarea for tests and accessibility. Unit and integration tests cover override vs display-only rates, resave without refetch, cost-map refresh while open, and Params-vs-JSON precedence.Reviewed by Cursor Bugbot for commit d0703f3. Bugbot is set up for automated code reviews on this repo. Configure here.