litellm/litellm-proxy-extras
Tin Chi Lo 3e50a52ecb fix(spend): key the session rollup on the caller's credential as well
session_id is caller-controlled, and this row sums spend, baseline spend and the
savings between them. Keyed on the session alone, one caller reusing another's
id folds their turns into that tenant's dollars and merges two conversations
into one benchmark row.

The codebase has two keying conventions and this table was following the wrong
one. Session-scoped state is keyed on the session and the router that owns it:
LiteLLM_AdaptiveRouterSession is @@id([session_id, router_name, model_name]) and
the deployment-affinity cache key is model_group plus session_id, neither
carrying a tenant. Spend accounting is keyed on the credential: every daily
table is @@unique([<entity>, date, api_key, model, ...]). The discriminator is
not whether a row is per-session, it is whether the row adds up money, and this
one does.

So the key gains api_key, matching the accounting tables it belongs with. A
credential rotated mid-conversation now splits that session's rollup in two,
which undercounts one row rather than merging two tenants into one wrong number.
2026-08-04 14:27:15 -07:00
..
dist adding build 2026-03-21 22:55:04 -07:00
litellm_proxy_extras fix(spend): key the session rollup on the caller's credential as well 2026-08-04 14:27:15 -07:00
tests [Fix] v2 resolver: swallow non-connection DB errors; wrap resolve failures 2026-04-21 15:53:07 -07:00
build_and_publish.md build: migrate packaging, CI, and Docker from Poetry to uv (#25007) 2026-04-09 11:46:23 -07:00
LICENSE install prisma migration files - connects litellm proxy to litellm's prisma migration files (#9637) 2025-03-29 15:27:09 -07:00
migration_runbook.md [Infra] Add freshness and destructive guards to migration workflow 2026-04-21 12:00:23 -07:00
pyproject.toml bump: litellm-enterprise 0.1.51 -> 0.1.52, litellm-proxy-extras 0.4.80 -> 0.4.81 2026-07-25 16:28:42 -07:00
README.md build: migrate packaging, CI, and Docker from Poetry to uv (#25007) 2026-04-09 11:46:23 -07:00

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