[Fix] /user/update Allow for max_budget Resets - #20375
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Greptile OverviewGreptile SummaryFixed a bug where Key Changes:
Technical Details:
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| litellm/proxy/management_endpoints/internal_user_endpoints.py | Fixed max_budget reset logic by checking fields_set() to determine if explicitly provided |
| tests/test_litellm/proxy/management_endpoints/test_internal_user_endpoints.py | Added comprehensive test for max_budget preservation when not provided in request |
Sequence Diagram
sequenceDiagram
participant Client
participant UpdateEndpoint
participant UpdateHelper
participant UpdateParser
participant Database
Client->>UpdateEndpoint: POST /user/update with partial fields
UpdateEndpoint->>UpdateHelper: Process UpdateUserRequest
UpdateHelper->>UpdateHelper: Create data_json via model_dump
Note over UpdateHelper: Only includes explicitly provided fields
UpdateHelper->>UpdateParser: Call _update_internal_user_params
UpdateParser->>UpdateParser: Get fields_set from request model
alt max_budget in request
UpdateParser->>UpdateParser: Include max_budget in updates
else max_budget NOT in request
UpdateParser->>UpdateParser: Skip max_budget (preserve existing)
end
UpdateParser-->>UpdateHelper: Return filtered update values
UpdateHelper->>Database: Update user with filtered values
Database-->>UpdateHelper: Return updated user
UpdateHelper-->>UpdateEndpoint: Success response
UpdateEndpoint-->>Client: 200 OK
fzowl
pushed a commit
to fzowl/litellm
that referenced
this pull request
Jun 24, 2026
[Fix] /user/update Allow for max_budget Resets
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.
Relevant issues
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unitCI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Type
🐛 Bug Fix
✅ Test
Changes
Fixes an issue where
max_budgetcould not be reset because_update_internal_user_paramsalways included it innon_default_valueseven when not provided in the request. The function now checks ifmax_budgetis explicitly set usingfields_set()before including it, allowing it to be reset when provided while preserving the original value when omitted.Screenshots
BEFORE:

AFTER:

TESTS:
