Repository navigation
feat(proxy): add project-level model_itpm_limit/model_otpm_limit #35058
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
shivijain2323
wants to merge
13
commits into
BerriAI:litellm_internal_staging
from
shivijain2323:feature/bedrock-mantle-quota-project
Closed
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
a2d19c2
feat(proxy): add project-level model_itpm_limit/model_otpm_limit
shivijain2323 d7f0996
fix(proxy): refund itpm/otpm reservations correctly on proxy-side rej…
shivijain2323 105585d
fix(proxy): fix double refund and multimodal undercounting in project…
shivijain2323 7f6ffb3
fix(proxy): don't misclassify Responses API calls as embeddings in io…
shivijain2323 165eff9
fix(proxy): Non-text input bypasses upfront ITPM enforcement
shivijain2323 709a95c
fix(proxy): refund ITPM/OTPM reservations on stream disconnect
shivijain2323 b65ad2b
fix(proxy): don't skip the Responses API output cap or undercount its…
shivijain2323 07c4aae
test(proxy): cover all new lines in parallel_request_limiter_v3 patch
shivijain2323 8c291f4
fix(proxy): estimate audio ITPM tokens from payload size, not a flat 300
shivijain2323 666df21
fix(proxy): expose dedicated ITPM/OTPM columns via project merged_met…
shivijain2323 327daba
fix(proxy): treat max_output_tokens as an explicit output cap in OTPM…
shivijain2323 b2bb76d
fix(proxy): write the implicit ITPM/OTPM output cap to max_output_tok…
shivijain2323 2e29f34
fix(proxy): honor an explicit zero output-token cap in project OTPM r…
shivijain2323 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
.../litellm_proxy_extras/migrations/20260722200000_add_project_itpm_otpm_limit/migration.sql
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| -- AlterTable: Add ITPM/OTPM fields to LiteLLM_ProjectTable | ||
| ALTER TABLE "LiteLLM_ProjectTable" ADD COLUMN IF NOT EXISTS "model_itpm_limit" JSONB NOT NULL DEFAULT '{}'; | ||
| ALTER TABLE "LiteLLM_ProjectTable" ADD COLUMN IF NOT EXISTS "model_otpm_limit" JSONB NOT NULL DEFAULT '{}'; |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Medium: Project rate-limit bypass
The project request validators move these limits into
metadata, but the Prisma columns are non-null and default to{}. Consequently, every loaded row includes non-Noneempty dictionaries here, which overwrite the configured metadata limits before authentication passes them to the limiter; a project key can then exceed its configured model RPM, TPM, ITPM, and OTPM quotas. Persist these fields in the dedicated columns, or merge them in a way that preserves metadata-backed limits while providing an explicit migration/clearing strategy.