litellm - 💡(How to fix) Fix [Bug]: Error when configuring max budget with an environment variable [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#26696Fetched 2026-04-29 06:12:47
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2

Error Message

File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 923, in proxy_startup_event

if prisma_client is not None and litellm.max_budget > 0:

                                 ^^^^^^^^^^^^^^^^^^^^^^

TypeError: '>' not supported between instances of 'str' and 'int'

Code Example

File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 923, in proxy_startup_event

    if prisma_client is not None and litellm.max_budget > 0:

                                     ^^^^^^^^^^^^^^^^^^^^^^

TypeError: '>' not supported between instances of 'str' and 'int'

---

File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 923, in proxy_startup_event

    if prisma_client is not None and litellm.max_budget > 0:

                                     ^^^^^^^^^^^^^^^^^^^^^^

TypeError: '>' not supported between instances of 'str' and 'int'
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

Even after the fix in #23843, during LiteLLM startup, we still get an error from line 923 of litellm/proxy/proxy_server.py:

File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 923, in proxy_startup_event

    if prisma_client is not None and litellm.max_budget > 0:

                                     ^^^^^^^^^^^^^^^^^^^^^^

TypeError: '>' not supported between instances of 'str' and 'int'

A different place, but the same reason.

Steps to Reproduce

  1. Set an environment variable with a max budget value, e.g. export MAX_BUDGET=10
  2. In config.yaml, litellm_settings.max_budget, use os.environ/MAX_BUDGET
  3. Start the proxy.
  4. You will get the error message.

Relevant log output

File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 923, in proxy_startup_event

    if prisma_client is not None and litellm.max_budget > 0:

                                     ^^^^^^^^^^^^^^^^^^^^^^

TypeError: '>' not supported between instances of 'str' and 'int'

What part of LiteLLM is this about?

Proxy

What LiteLLM version are you on ?

v1.83.7-stable

Twitter / LinkedIn details

No response

extent analysis

TL;DR

The error can likely be fixed by converting the litellm.max_budget value to an integer before comparing it with an integer.

Guidance

  • Verify that the MAX_BUDGET environment variable is being set correctly and is an integer.
  • Check the config.yaml file to ensure that litellm_settings.max_budget is being set to the value of the MAX_BUDGET environment variable.
  • Consider adding a type conversion to ensure litellm.max_budget is an integer, e.g., int(litellm.max_budget).
  • Review the code to ensure that litellm.max_budget is not being overwritten or modified elsewhere.

Example

if prisma_client is not None and int(litellm.max_budget) > 0:

Notes

This fix assumes that litellm.max_budget is intended to be an integer. If it can be a string, additional error handling may be necessary.

Recommendation

Apply workaround: convert litellm.max_budget to an integer before comparison, as shown in the example code snippet. This should resolve the TypeError issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING