Skip to content

fix(ui): save a price edited in the Model Info JSON as the deployment's override - #53136

Closed
kerry-berri wants to merge 9 commits into
mainfrom
litellm_model_info_typed_pricing_saved
Closed

kerry-berri wants to merge 9 commits into
mainfrom
litellm_model_info_typed_pricing_saved

Conversation

@kerry-berri

@kerry-berri kerry-berri commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

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_tokens in 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:

  • Model Info JSON price edits return 200 but store nothing
  • Operators think a custom rate is active when it is not

How it solves it:

  • The form sends rates changed in Model Info as litellm_params overrides
  • Rates the form only displays are still never sent as overrides
  • A rate changed in the LiteLLM Params box in the same save wins

The proxy is unchanged, so API clients see no difference. Pricing sent in model_info straight to PATCH /model/{id}/update is still dropped, as it has been since v1.102.0 (#36222).

Design decisions:

  • Store instead of reject. The alternative was an error pointing at the LiteLLM Params box. Storing does what the operator asked, and the override lands on litellm_params, where deployment pricing already lives.
  • Fix in the dashboard, not the proxy. An earlier revision of this PR had the proxy compare the saved JSON with the cost map. A cost map refresh while the form was open would then have frozen untouched prices as overrides, and a pricing-shaped string could reach litellm_params. The form knows what it loaded, so it compares against that and sends numbers only.
  • Only numeric values under pricing keys are promoted, meaning keys matching _cost, _above_<N>_tokens or _uplift_multiplier, and cost_per_second. cost_per_ptu_per_hour stays on model_info, and the tiered_pricing list is not promoted.
  • An edit is judged against what the Model Info box showed when Edit Settings was clicked, so a cost map refresh while the form is open cannot turn an untouched rate into an override.
  • When the same save changes the rate in the LiteLLM Params box and in Model Info, the LiteLLM Params value wins. For the rates that have their own input on the form (input_cost_per_token and the like), an input the operator changed in that save wins, otherwise the Model Info edit is saved.
  • The form is now reset from the stored values after each save or cancel, and the Model Info that was just saved is kept until the model is fetched again, so a second save without a page reload neither removes the override nor resends older Model Info.

User Flow

Before: a proxy admin edits a long context rate in Model Info, sees success, and the rate does not change

  1. They open https://litellm-domain/ui/?page=models, pick an azure/gpt-5.4 deployment and click Edit Settings
  2. In the Model Info JSON they change input_cost_per_token_above_272k_tokens to their Azure Government rate and save
  3. PATCH https://litellm-domain/model/{id}/update returns 200 and the UI shows a success toast
  4. After a reload, Model Info shows the commercial rate again and requests are still costed at it

After: the same edit sticks

  1. They open https://litellm-domain/ui/?page=models, pick an azure/gpt-5.4 deployment and click Edit Settings
  2. In the Model Info JSON they change input_cost_per_token_above_272k_tokens to their Azure Government rate and save
  3. PATCH https://litellm-domain/model/{id}/update carries the rate in litellm_params, returns 200 and the UI shows a success toast
  4. After a reload, Model Info and the LiteLLM Params box both show their rate, and it is the deployment's price

Relevant 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

  • 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
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Screenshots / 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, env DATABASE_URL, STORE_MODEL_IN_DB=True, LITELLM_LOCAL_MODEL_COST_MAP=True). The dashboard runs from source with NEXT_PUBLIC_USE_REWRITES=true LENS_DEV_PROXY_URL=http://127.0.0.1:4141 npm run dev -- --hostname 127.0.0.1 --port 4310 in litellm/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 is azure/gpt-5.4 created with POST /model/new.

Before, at merge base 90ee763: in Models + Endpoints, open the deployment, click Edit Settings, change input_cost_per_token_above_272k_tokens from 0.000005 to 0.000006 in Model Info and click Save Changes. The toast says "Model settings updated successfully", the PATCH returns 200, and after a reload the rate is 0.000005 again with no key in LiteLLM Params. On v1.108.3 from PyPI the same save sent with curl (the /model/info response with the two 272k rates edited, as model_info on PATCH /model/{id}/update) also returns 200 and stores nothing.

After: the same clicks send 0.000006 inside litellm_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, editing input_cost_per_token in 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.tsx passes. The integration test fails without the model_info_view.tsx change because the PATCH carries no rate in litellm_params.

Type

🐛 Bug Fix

Caveats (if any)

Medium

  • API clients that send pricing in model_info still get a 200 with nothing stored

Low

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

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_params overrides 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 useModelInfoEdits hook keeps the just-saved model_info visible until the model refetches, records the baseline at edit start, and wires editedModelInfoPricing into save. ModelInfoEditForm resets 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.

…ent's override

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

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@veria-ai

veria-ai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

Reviews

@devin-ai-integration

devin-ai-integration Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor
Admin UI QA at 8bcbf08, dashboard run from source against a proxy on main's backend

On an azure/gpt-5.4 deployment I changed input_cost_per_token_above_272k_tokens from 0.000005 to 0.000006 in Model Info and saved. The PATCH carried the rate in litellm_params, and both Model Info and LiteLLM Params showed 0.000006 after a reload. At merge base 90ee76388d the same edit shows the success toast and reverts to 0.000005 after a reload.

Reopening Edit Settings without a reload showed 0.000006 in LiteLLM Params, and a save with no edits kept it with no litellm_params_to_remove.

Params on immediate reopen and Model Info after no-edit save and reload

Other flows

A second Model Info edit to 0.000007 without a reload persisted in both boxes. Deleting the key from the LiteLLM Params box removed the override and Model Info went back to the cost map rate. Editing only the Params box to 0.000008 won over the Model Info value sent in the same save. Renaming a fresh deployment added no pricing keys. Editing input_cost_per_token in the JSON stored it on litellm_params. Cancelling an unrelated Params edit left the stored value in the box.

The screenshot from the earlier proxy-side revision at 5dc20b57d1, with the merge base on the left, is below.

Model Info after reload at the merge base and the first revision

Devin session

…arams

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

Copy link
Copy Markdown
Contributor Author

@greptileai

@kerry-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@greptile-apps

greptile-apps Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge with no new actionable issues found.

Summary

The dashboard saves numeric prices edited in Model Info as deployment overrides while leaving untouched catalog prices alone.

  • Model Info price edits now save as deployment overrides.
  • Screen readers can identify the Model Info JSON box.

All five previous threads are unnumbered. Their reported issues are addressed by the current code.

Reviews (5) · Last reviewed commit: "fix(ui): stamp a saved Model Info with t..." · Reviewed by Greptile

@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.

kerry-berri and others added 3 commits November 20, 2026 18:20
…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>
@kerry-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@kerry-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@devin-ai-integration devin-ai-integration Bot changed the title fix(proxy): save a price edited in the Model Info JSON as the deployment's override fix(ui): save a price edited in the Model Info JSON as the deployment's override Nov 20, 2026
…lift rates edited in Model Info

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

Copy link
Copy Markdown
Contributor Author

@greptileai

@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.

…ing started

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

Copy link
Copy Markdown
Contributor Author

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.

… again

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

Copy link
Copy Markdown
Contributor Author

@greptileai

@kerry-berri

Copy link
Copy Markdown
Contributor Author

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.

… one from when the save started

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

Copy link
Copy Markdown
Contributor Author

@greptileai

@kerry-berri

Copy link
Copy Markdown
Contributor Author

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

@devin-ai-integration

Copy link
Copy Markdown
Contributor
Admin UI retest passed at a7688a0

Model Info retained owner: "billing" across a TPM-only save. After deleting the 272k override, the refetch and reopened form both showed 0.000005, and saving without edits did not recreate the override. The pricing regressions also passed. The one commit after this run, d0703f3, only changes which fetch time a saved Model Info is stamped with and is covered by the integration tests.

Owner after TPM save and cost-map rate after deletion

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