Skip to content

[Feature] UI - User Budget Page: Unlimited Budget Checkbox - #20380

Merged
yuneng-jiang merged 1 commit into
mainfrom
litellm_ui_key_budget_change
Feb 4, 2026
Merged

[Feature] UI - User Budget Page: Unlimited Budget Checkbox#20380
yuneng-jiang merged 1 commit into
mainfrom
litellm_ui_key_budget_change

Conversation

@yuneng-jiang

Copy link
Copy Markdown
Contributor

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🆕 New Feature
✅ Test

Changes

Adds an "Unlimited Budget" checkbox to the user edit form that allows setting max_budget to null. When checked, the budget input is disabled and the form submits max_budget as null. When unchecked, the budget input is enabled and validation requires a budget value. Adds test coverage for the user edit view component including unlimited budget functionality, form validation, and field visibility based on bulk edit mode.

Screenshots

image image image

@vercel

vercel Bot commented Feb 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
litellm Ready Ready Preview, Comment Feb 4, 2026 2:22am

Request Review

@greptile-apps

greptile-apps Bot commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR adds an "Unlimited Budget" checkbox to the user edit form, allowing administrators to set a user's max_budget to null (unlimited) instead of requiring a numeric value.

Key Changes:

  • Added checkbox control next to the "Max Budget (USD)" field label
  • Implemented state management with unlimitedBudget state variable
  • Budget input field is disabled when unlimited budget is checked
  • Form validation requires either a numeric budget OR the unlimited checkbox to be checked
  • On form submission, max_budget is set to null when unlimited is selected
  • Import reorganization (alphabetized and grouped by source)

Test Coverage:

  • Added comprehensive test suite with 18 test cases
  • Tests cover: checkbox behavior, form validation, submission handling, bulk edit mode visibility, and edge cases (null/undefined values)
  • Properly mocks external dependencies (antd, tremor, roles)

Code Quality:

  • Clean implementation with clear state management
  • Proper React hooks usage (useState, useEffect)
  • User-friendly validation messages
  • Consistent with existing codebase patterns (similar to how "Unlimited" is displayed in key_info_view.tsx)

Confidence Score: 5/5

  • This PR is safe to merge with no issues identified
  • The implementation is clean, well-tested, and follows React best practices. The feature is isolated to the user edit form with comprehensive test coverage including edge cases. No security concerns, performance issues, or logic errors found.
  • No files require special attention

Important Files Changed

Filename Overview
ui/litellm-dashboard/src/components/user_edit_view.tsx Added unlimited budget checkbox feature that allows setting max_budget to null with proper state management and form validation
ui/litellm-dashboard/src/components/user_edit_view.test.tsx Comprehensive test coverage for the unlimited budget feature including edge cases, form validation, and state changes

Sequence Diagram

sequenceDiagram
    participant User
    participant UserEditView
    participant Form
    participant State
    participant SubmitHandler

    Note over UserEditView: Component Initialization
    UserEditView->>State: useState(false) for unlimitedBudget
    UserEditView->>Form: Form.useForm()
    
    Note over UserEditView: useEffect on userData change
    UserEditView->>State: Check if max_budget is null/undefined
    State-->>UserEditView: isUnlimited status
    UserEditView->>State: setUnlimitedBudget(isUnlimited)
    UserEditView->>Form: setFieldsValue({ max_budget: isUnlimited ? "" : maxBudget })

    alt User checks "Unlimited Budget" checkbox
        User->>UserEditView: Click checkbox
        UserEditView->>State: handleUnlimitedBudgetChange(checked=true)
        State->>State: setUnlimitedBudget(true)
        State->>Form: setFieldsValue({ max_budget: "" })
        State->>UserEditView: Update UI
        UserEditView-->>User: Disable budget input
    else User unchecks "Unlimited Budget" checkbox
        User->>UserEditView: Click checkbox
        UserEditView->>State: handleUnlimitedBudgetChange(checked=false)
        State->>State: setUnlimitedBudget(false)
        State->>UserEditView: Update UI
        UserEditView-->>User: Enable budget input
    end

    Note over User,SubmitHandler: Form Submission
    User->>Form: Click "Save Changes"
    Form->>Form: Validate fields
    
    alt unlimitedBudget is checked
        Form->>Form: Skip budget validation
        Form->>SubmitHandler: handleSubmit(values)
        SubmitHandler->>SubmitHandler: Set values.max_budget = null
    else Budget value is empty/null/undefined
        Form->>Form: Validation fails
        Form-->>User: Show error: "Please enter a budget or select Unlimited Budget"
    else Budget has numeric value
        Form->>Form: Validation passes
        Form->>SubmitHandler: handleSubmit(values)
        SubmitHandler->>SubmitHandler: Keep numeric max_budget value
    end
    
    SubmitHandler->>SubmitHandler: Parse metadata JSON if needed
    SubmitHandler->>UserEditView: onSubmit(values)
    UserEditView-->>User: Form submitted
Loading

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

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@yuneng-jiang
yuneng-jiang merged commit 12b8cd5 into main Feb 4, 2026
43 of 65 checks passed
@ishaan-berri
ishaan-berri deleted the litellm_ui_key_budget_change branch March 26, 2026 22:30
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…hange

[Feature] UI - User Budget Page: Unlimited Budget Checkbox
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