litellm/ui/litellm-dashboard
Tin Chi Lo 8d300d98d8 refactor(spend): fold auto-router turns in the flusher, not on the request path
Classifying a turn is a read-modify-write over the session's stored state, and
the read and the modify were happening on the request path while the write
happened in the background flusher. Splitting one unit of work across two
contexts is what produced all three findings from the last review round.

The logging path now only stages the turn's facts; record_turn no longer takes a
prisma client at all, so a database round trip in front of spend processing is
not expressible. The flusher owns the whole read, fold and write per session, so
a read that faults has no half-finished write to corrupt. It re-stages the turns
through the same path a failed write already used, and the except branch that
returned an empty state, then persisted it over real history, is gone rather
than guarded.

Folding at flush time also lets an interval's turns be sorted by start time
before they are classified. Completion order is not start order, so two turns in
flight together used to leave the earlier one read as a late arrival and dropped
from every bucket; at arrival there is no later turn to compare against, so this
was not fixable in the previous shape.

StateUnavailable separates "the read failed" from "this session has no history",
which were the same value before. Only the second one is writable.

The staging ceiling counts turns rather than sessions, which is the quantity that
actually bounds the memory a caller sending a fresh session id per request can
make the proxy hold.

Benchmark window dates are typed as dates on the route, so a malformed one is
rejected by the framework instead of raising inside the aggregate, and an
inverted range is a 400 instead of an empty dashboard that reads as no traffic
2026-08-04 13:39:19 -07:00
..
public refactor(ui): migrate MCP, callback, guardrail, SSO, and search tool logos to the shared Logo component (#34169) 2026-07-21 22:22:54 +00:00
scripts chore(ui): add filename, size, JSX-handler, prefer-const, and antd lint rules (#34341) 2026-07-22 19:34:35 -07:00
src refactor(spend): fold auto-router turns in the flusher, not on the request path 2026-08-04 13:39:19 -07:00
tests chore(build): move the Admin UI toolchain to Node 24 (#35801) 2026-08-04 12:36:07 -07:00
.env.development hidden dashboard routing, dev and build env files 2025-10-06 19:21:34 -07:00
.env.production remove next env 2026-04-18 16:45:32 -07:00
.npmrc chore(build): move the Admin UI toolchain to Node 24 (#35801) 2026-08-04 12:36:07 -07:00
.nvmrc chore(build): move the Admin UI toolchain to Node 24 (#35801) 2026-08-04 12:36:07 -07:00
.prettierignore feat(ui): generate dashboard API types from the proxy OpenAPI spec (#29816) 2026-06-05 17:20:01 -07:00
.prettierrc added and ran prettier autoformatter 2025-10-04 18:19:48 -07:00
build_release_ui.sh build release ui script 2026-01-17 18:16:14 -08:00
build_ui.sh chore(build): move the Admin UI toolchain to Node 24 (#35801) 2026-08-04 12:36:07 -07:00
build_ui_custom_path.sh chore(build): move the Admin UI toolchain to Node 24 (#35801) 2026-08-04 12:36:07 -07:00
CLAUDE.md test(ui): tier the MCP create tests into unit and integration 2026-08-03 16:22:54 -07:00
components.json refactor(ui): switch shadcn primitives from Radix to Base UI (#32124) 2026-07-07 09:55:41 -07:00
eslint-budgets.json feat(ui): add eslint rules for nested ternaries, large inline object args, and long condition chains (#32415) 2026-07-08 21:32:16 +00:00
eslint-suppressions.json feat(team): custom metadata validation hook for team create and update (#33353) 2026-08-03 18:37:45 -07:00
eslint.config.mjs chore(ui): add filename, size, JSX-handler, prefer-const, and antd lint rules (#34341) 2026-07-22 19:34:35 -07:00
knip.json test(e2e): move Admin UI Playwright suite to tests/e2e/ui (#34196) 2026-07-22 19:43:10 +00:00
next.config.mjs chore(ui): preserve console.warn in prod builds to match lint allow-list 2026-07-03 14:51:14 -07:00
package-lock.json chore(build): move the Admin UI toolchain to Node 24 (#35801) 2026-08-04 12:36:07 -07:00
package.json chore(build): move the Admin UI toolchain to Node 24 (#35801) 2026-08-04 12:36:07 -07:00
postcss.config.js feat(ui): shadcn migration foundation: Tailwind v4, shadcn init, antd cascade fix (#31995) 2026-07-02 19:02:27 -07:00
README.md build(ui/litellm-dashboard): initial commit of litellm dashboard 2024-01-27 12:12:48 -08:00
tsconfig.json test(e2e): move Admin UI Playwright suite to tests/e2e/ui (#34196) 2026-07-22 19:43:10 +00:00
tsconfig.tsbuildinfo refactor(ui): migrate inline provider logo lookups to the shared Logo component (#34141) 2026-07-21 14:28:05 -07:00
vitest.config.ts chore(build): move the Admin UI toolchain to Node 24 (#35801) 2026-08-04 12:36:07 -07:00

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

This project uses next/font to automatically optimize and load Inter, a custom Google Font.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.