mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-14 23:21:35 +00:00
Vertex and Anthropic passthrough batches built a UserAPIKeyAuth with an empty
api_key and forwarded no tags, so the managed-object row that CheckBatchCost
later reads carried no identity. At cost time the poller had a blank key, so
the batch-cost SpendLogs row was attributed to nobody (or dropped), leaving the
creating key at $0 with blank api_key/team_id/request_tags.
The request metadata already carries the authenticated hashed key, the
user/team ids and the request tags; the old handlers threw them away. Add
user_api_key and request_tags columns to LiteLLM_ManagedObjectTable (schema,
migration, Pydantic model) and persist them in store_unified_object_id, keeping
the identity in the DB row rather than the cached pydantic model. Both
passthrough handlers now go through one shared helper,
store_batch_managed_object, that reads the real identity out of the request
metadata. At cost time CheckBatchCost._build_creator_attribution_metadata
rebuilds the spend-tracking metadata from the row, resolving the key alias from
the hashed token and the team alias from the team id, so the batch-cost row is
attributed exactly like a non-batch request. _get_user_info short-circuits a
null user_id so the poller no longer issues find_unique(where={"user_id": None}),
and every lookup falls back gracefully for older rows that predate the two new
columns.
|
||
|---|---|---|
| .. | ||
| dist | ||
| litellm_proxy_extras | ||
| tests | ||
| build_and_publish.md | ||
| LICENSE | ||
| migration_runbook.md | ||
| pyproject.toml | ||
| README.md | ||
Additional files for the proxy. Reduces the size of the main litellm package.
Currently, only stores the migration.sql files for litellm-proxy.
To install, run:
uv add litellm-proxy-extras
OR
uv tool install 'litellm[proxy]' # installs litellm-proxy-extras and other proxy dependencies
To use the migrations, run:
litellm --use_prisma_migrate