litellm/ui
ryan-crabbe-berri 5ce28fb8e2 fix(proxy): rebuild Usage Ask AI as a proxy client instead of a bare SDK caller
The Usage dashboard "Ask AI" feature posted the UI-selected model to
/usage/ai/chat, and the backend called litellm.acompletion(model=...) directly.
When the selected model is a configured proxy alias or model group, the bare SDK
tried to parse the name as a raw provider/model string and the call failed, even
though the same name works on /chat/completions. Every failure was collapsed into
a generic "An internal error occurred", so the real cause was invisible.

This replaces the whole usage_endpoints implementation with a v2 that routes the
LLM call through the proxy's own llm_router, so model groups resolve and the call
gets credentials, spend logging, budgets, rate limits, and guardrails like any
other proxy request. Data access moves behind a ScopedUsageDataProvider whose
authorization is baked in at construction: a non-admin caller gets a provider
that can only ever read its own user_id, so a cross-tenant query is
unrepresentable rather than something each tool has to remember to guard, and
team/tag breakdowns are refused outright for non-admins. The tool loop now runs
multiple rounds and streams the answer, terminal failures are modeled as a tagged
union mapped to actionable messages, and the model comes from a usage_ai_model
general setting rather than a hardcoded default.

The SSE wire contract is unchanged, so the frontend panel is untouched apart from
the model-selector placeholder that no longer advertises a hardcoded default.
2026-07-12 21:23:08 -07:00
..
litellm-dashboard fix(proxy): rebuild Usage Ask AI as a proxy client instead of a bare SDK caller 2026-07-12 21:23:08 -07:00
Dockerfile feat: add componentized proxy deployment with gateway, backend, ui, and migrations (#27557) 2026-05-16 09:25:17 -07:00
nginx.conf feat: add componentized proxy deployment with gateway, backend, ui, and migrations (#27557) 2026-05-16 09:25:17 -07:00