-
-
Notifications
You must be signed in to change notification settings - Fork 11k
fix(batches): attribute Vertex passthrough batch cost to key/team/tags #34456
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
Merged
yucheng-berri
merged 1 commit into
litellm_internal_staging
from
litellm_vertex_batch_cost_attribution_oss
Aug 8, 2026
Merged
Changes from all commits
Commits
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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
5 changes: 5 additions & 0 deletions
5
...rations/20260730000000_add_api_key_and_request_tags_to_managed_object_table/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,5 @@ | ||
| -- Add api_key and request_tags columns to LiteLLM_ManagedObjectTable | ||
| -- Captured at batch-create time so CheckBatchCost can attribute batch-cost spend | ||
| -- back to the creating virtual key (and its tags) even when created_by is null. | ||
| ALTER TABLE "LiteLLM_ManagedObjectTable" ADD COLUMN IF NOT EXISTS "api_key" TEXT; | ||
| ALTER TABLE "LiteLLM_ManagedObjectTable" ADD COLUMN IF NOT EXISTS "request_tags" JSONB DEFAULT '[]'; | ||
|
yucheng-berri marked this conversation as resolved.
|
||
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.
🟡 New attribution code builds and mutates a dictionary instead of the required immutable style
CLAUDE.md requires new code to avoid mutation and to annotate every variable with
: Final, but the new attribution builder seeds a dictionary and then mutates it three times (metadata[...] = ...atenterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py:110-123) with plain non-final locals.Impact: The new code does not follow the repository's mandated coding conventions and adds to the lint budgets it is supposed to ratchet down.
Rule source
CLAUDE.md: "No mutation; don't reassign variables... Instead of mutable lists and dicts, prefer tuples, frozen dataclasses..." and "Annotate every variable with
: Final(LIT010)", plus LIT001/LIT002 guidance to build values in one shot with comprehensions or a single expression rather than seeding an empty container and mutating it.api_key,team_id,request_tags,metadata, andteam_aliasare all unannotated, andmetadatais mutated after construction. The same pattern appears inenterprise/litellm_enterprise/proxy/hooks/managed_files.py:198-206.Prompt for agents
Was this helpful? React with 👍 or 👎 to provide feedback.