PLTF-309: set max_budget to null when creating team to disable budget enforcement#451
Closed
aivong-openhands wants to merge 2 commits into
Closed
PLTF-309: set max_budget to null when creating team to disable budget enforcement#451aivong-openhands wants to merge 2 commits into
aivong-openhands wants to merge 2 commits into
Conversation
…dget enforcement When billing is disabled in enterprise deployments, new LiteLLM teams should not have budget enforcement. Previously, when max_budget was not specified in the team creation request, LiteLLM would default to 0, which effectively blocks all LLM calls once any spend is recorded. This fix explicitly sets max_budget to null when creating the team, which disables budget checking entirely for enterprise deployments. Root cause: When a user creates a conversation, the LiteLLM team budget check at auth_checks.py:1758 throws BudgetExceededError because max_budget=0 means no budget remaining. Co-authored-by: openhands <openhands@all-hands.dev>
Contributor
Author
|
Closed as this PR does not address the out of funds error but the openhands PR #13440 does |
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.
Problem
When billing is disabled in enterprise deployments (via
ENABLE_BILLING=false,REQUIRE_PAYMENT=0, etc.), users still see "You're out of OpenHands Credits. Add funds" error when trying to use conversations.Root Cause
When a LiteLLM team is created via
/team/newwithout specifyingmax_budget, LiteLLM defaults it to0(notnull). This means:max_budget = 0(no budget remaining)spend > 0triggers:BudgetExceededError: Budget has been exceeded! Team=xxx Current cost: 0.07, Max budget: 0.0The budget check happens in LiteLLM's
auth_checks.py:1758(_team_max_budget_check), which raiseslitellm.BudgetExceededErrorwhenspend > max_budget.Solution
Explicitly set
max_budget: nullwhen creating the team inlitellm-config-script.yaml. Whenmax_budgetisnull, LiteLLM skips the budget check entirely.This is the correct behavior for enterprise deployments where billing is disabled.
Note for Existing Deployments
Existing deployments with teams that already have
max_budget=0will need to manually update the LiteLLM database:Or via kubectl:
Testing