Skip to content

PLTF-309: set max_budget to null when creating team to disable budget enforcement#451

Closed
aivong-openhands wants to merge 2 commits into
mainfrom
fix/disable-litellm-budget-for-enterprise
Closed

PLTF-309: set max_budget to null when creating team to disable budget enforcement#451
aivong-openhands wants to merge 2 commits into
mainfrom
fix/disable-litellm-budget-for-enterprise

Conversation

@aivong-openhands

@aivong-openhands aivong-openhands commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

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/new without specifying max_budget, LiteLLM defaults it to 0 (not null). This means:

  • Team max_budget = 0 (no budget remaining)
  • Any spend > 0 triggers: BudgetExceededError: Budget has been exceeded! Team=xxx Current cost: 0.07, Max budget: 0.0

The budget check happens in LiteLLM's auth_checks.py:1758 (_team_max_budget_check), which raises litellm.BudgetExceededError when spend > max_budget.

Solution

Explicitly set max_budget: null when creating the team in litellm-config-script.yaml. When max_budget is null, 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=0 will need to manually update the LiteLLM database:

-- Connect to litellm database and run:
UPDATE "LiteLLM_TeamTable" SET max_budget = NULL WHERE max_budget = 0;

Or via kubectl:

sudo k0s kubectl -n openhands exec -it openhands-postgresql-0 -- \
  psql -U postgres -d litellm -c \
  "UPDATE \"LiteLLM_TeamTable\" SET max_budget = NULL WHERE max_budget = 0;"

Testing

  • Verified that the helm chart change produces valid JSON in the curl request
  • Tested that existing deployments work after manually updating max_budget to NULL

…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>
@aivong-openhands aivong-openhands changed the title fix(litellm): set max_budget to null when creating team to disable budget enforcement PLTF-309: set max_budget to null when creating team to disable budget enforcement Mar 17, 2026
@aivong-openhands

Copy link
Copy Markdown
Contributor Author

Closed as this PR does not address the out of funds error but the openhands PR #13440 does

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.

2 participants