Skip to content

[Bug]: API blocks free (no cost) models when budget is exceeded #14004

@janmett

Description

@janmett

What happened?

Problem

We offer both self-hosted on-premises and cloud-based models. Each user is allocated a default budget and has access to all models.

If a user exceeds their budget, the 'ExceededBudget' error is raised, even for our on-premises models which have no configured costs and are completely free to us. The API then becomes unavailable for all models, which is not what I would expect for models that cost nothing.

Expectation

The API should recognise models without costs and allow requests to be made. Cloud models with configured costs (cost > 0) should still be blocked.

Solutions?

Are we missing configuration Options?

If we wanted to fix this issue ourselves, is there a chance it will be merged into litellm? Since a similar issue was marked as "not planned".

Note: The budget in the log output is supposed to provoke this error.

Relevant log output

09:03:41 - LiteLLM Proxy:ERROR: auth_exception_handler.py:79 - litellm.proxy.proxy_server.user_api_key_auth(): Exception occured - ExceededBudget: User=foo over budget. Spend=0.03862624999999999, Budget=0.01
Requester IP Address:172.19.0.1
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/litellm/proxy/auth/user_api_key_auth.py", line 1065, in _user_api_key_auth_builder
    _ = await common_checks(
        ^^^^^^^^^^^^^^^^^^^^
    ...<11 lines>...
    )
    ^
  File "/usr/lib/python3.13/site-packages/litellm/proxy/auth/auth_checks.py", line 149, in common_checks
    raise litellm.BudgetExceededError(
    ...<3 lines>...
    )
litellm.exceptions.BudgetExceededError: ExceededBudget: User=foo over budget. Spend=0.03862624999999999, Budget=0.01
09:03:41 - LiteLLM Proxy:INFO: db_spend_update_writer.py:334 - Writing spend log to db - request_id: 0c65a7cd-8bff-49a3-a8ab-700e412dff36, spend: 0.0
INFO:     172.19.0.1:46236 - "POST /chat/completions HTTP/1.0" 400 Bad Request
09:03:41 - LiteLLM Proxy:INFO: db_spend_update_writer.py:1090 - Logged request status: failure

Are you a ML Ops Team?

No

What LiteLLM version are you on ?

1.75.5

Twitter / LinkedIn details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions