Commit graph

33512 commits

Author SHA1 Message Date
Yuneng Jiang
9c2bcbc6e8
chore: fixes 2026-04-04 23:00:36 -07:00
Cursor Agent
f8b9a303b8 Fix LLM arg validation + cap conversation size at 20 messages
- _resolve_fetch_kwargs uses .get() with ValueError for missing dates
  (handles malformed LLM tool arguments gracefully)
- MAX_CHAT_MESSAGES = 20 constant; backend truncates to last 20
- Frontend also sends only last 20 messages per request
- Prevents excessive token usage and context-length errors

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-02-25 00:18:45 +00:00
Cursor Agent
b7c609979b Role-scoped system prompt + additional test coverage
- System prompt is now role-aware: admin sees all 3 tool descriptions,
  non-admin only sees get_usage_data (consistent with tool filtering)
- Added tests: non-admin prompt excludes team/tag tools, date injection
- 15 backend tests, 34 frontend tests passing

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-02-25 00:10:00 +00:00
Cursor Agent
1aca6874da Address greptile round 2: sanitize errors, defense-in-depth allowlist, revert tsconfig
- Sanitize error messages: generic 'An internal error occurred' sent to client,
  full exception logged server-side via verbose_proxy_logger
- Defense-in-depth: _process_tool_call validates fn_name against role-based
  allowlist before dispatch (even though LLM only receives allowed tools)
- Revert tsconfig.json jsx back to 'preserve' (Next.js recommended default)

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-02-24 23:58:58 +00:00
Cursor Agent
84df54cc78 Address greptile review: security fixes and input validation
- Restrict team/tag tools to admin-only users (non-admins only get get_usage_data)
- Constrain ChatMessage.role to Literal['user', 'assistant'] to prevent system prompt injection
- Add test for base tools restriction (non-admin gets 1 tool, admin gets 3)
- Issues 3 (unused imports) and 4 (inline datetime) were already fixed in prior commit

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-02-24 23:44:24 +00:00
Cursor Agent
0a771ac7cc Refactor backend for code quality: proper types, constants, all functions ≤50 LOC
- TypedDict for SSE events (SSEStatusEvent, SSEToolCallEvent, etc.) and ToolHandler
- Constants for table names, entity fields, temperature, page sizes, top-N limits
- Shared _query_activity() eliminates duplicated fetch logic
- _accumulate_breakdown() + _ranked_lines() replace inline aggregation loops
- Extracted _process_tool_call() and _stream_final_response() from main stream fn
- Black + Ruff clean, all 15 functions verified ≤50 LOC
- Replaced Tremor Button with Antd Button in panel (Tremor deprecated per AGENTS.md)

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-02-24 23:18:44 +00:00
Cursor Agent
9eae9183be Show tool calls as distinct steps + render markdown in responses
- Backend emits tool_call events with tool_name, label, args, and status
- Frontend shows each tool call as a step with ✓/spinner/✗ indicator
- Tool call steps show icon, label, date range, and filters
- AI responses rendered with ReactMarkdown (bold, lists, tables, code)
- Cursor-like UX: Thinking → tool calls → Analyzing → streamed answer

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-02-24 22:14:50 +00:00
Cursor Agent
838be8fcb4 Fix: inject today's date into system prompt so AI resolves relative dates correctly
Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-02-24 21:46:46 +00:00
Cursor Agent
b7399de05b Add team/tag tools, status indicators, and improved AI agent
- AI agent now has 3 tools: get_usage_data, get_team_usage_data, get_tag_usage_data
- Stream status events (Thinking... Fetching... Analyzing...) to UI
- Frontend shows spinner + status text during tool execution
- Better system prompt guiding tool selection
- Entity summariser for team/tag data with ranked breakdowns
- 13 backend tests, 34 frontend tests passing

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-02-24 21:17:59 +00:00
Cursor Agent
4f63135e1d Make model selection optional, default to gpt-4o-mini on backend
Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-02-24 21:01:30 +00:00
Cursor Agent
fb8eaf2f7d Add backend AI usage chat endpoint with tool calling
Backend:
- New /usage/ai/chat SSE streaming endpoint
- AI agent has get_usage_data tool that queries /user/daily/activity/aggregated
- Follows same architecture as policy AI suggest (litellm.acompletion + tools)
- Non-admin users are restricted to their own data
- 12 backend unit tests

Frontend:
- Panel now calls /usage/ai/chat backend endpoint via SSE
- Removed direct OpenAI client calls from frontend
- Added usageAiChatStream networking function following enrichPolicyTemplateStream pattern

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-02-24 20:46:02 +00:00
Cursor Agent
1a6ded461a Remove build output directory from tracking
Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-02-24 20:32:31 +00:00
Cursor Agent
e03a5e251d Convert Ask AI from modal to right-side sliding panel
- Replace UsageAIChatModal with UsageAIChatPanel
- Panel slides in from right side, usage page stays visible
- Full-height panel with header, model selector, chat area, and input
- Smooth CSS transition for open/close animation
- Update tests for new panel component (34 tests passing)

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-02-24 20:32:03 +00:00
Cursor Agent
7b43d4b66d Add Ask AI chat component to Usage page
- Create UsageAIChatModal component with streaming chat interface
- Integrate with existing model hub for model selection
- Pass usage data context (spend, models, providers, keys) to AI
- Add Ask AI button next to Export Data button in global view
- Add tests for the new component and integration

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-02-24 20:13:46 +00:00
Sameer Kankute
5219b1d0c3
Merge pull request #22035 from BerriAI/litellm_openai_codex_day_0_codex_5.3
[Feat] OpenAI codex 5.3 day 0 support
2026-02-25 01:29:27 +05:30
Ishaan Jaff
c343bfffda
fix(router): emit x-litellm-overhead-duration-ms header for streaming requests (#22027)
* fix(router): preserve _hidden_params in FallbackStreamWrapper so x-litellm-overhead-duration-ms is emitted for streaming requests

* test(router): add regression test for FallbackStreamWrapper _hidden_params preservation
2026-02-24 11:56:16 -08:00
Ishaan Jaff
e44b9b6b35
feat(prometheus): add opt-in stream label to litellm_proxy_total_requests_metric (#22023)
Set prometheus_emit_stream_label: true in litellm_settings to emit a
stream label (True/False/None) on litellm_proxy_total_requests_metric.

Opt-in to avoid breaking cardinality on existing deployments.
2026-02-24 11:51:42 -08:00
Sameer Kankute
5d291c739f Fix phase docs link 2026-02-25 01:21:38 +05:30
Sameer Kankute
74abf0c8e6 Fix phase docs link 2026-02-25 01:19:10 +05:30
Sameer Kankute
aded14a55a Fix release version for gpt-5.3-codex 2026-02-25 01:04:12 +05:30
yuneng-jiang
4321bc9285
Merge pull request #21985 from BerriAI/litellm_ui_testing_coverage_00
[Fix] UI - Virtual Keys: restrict Edit Settings to key owners
2026-02-24 10:16:40 -08:00
Sameer Kankute
1c48d8fda7 Add gpt-5.3-codex in model cost map 2026-02-24 23:37:09 +05:30
Ishaan Jaff
5e9f24f74c
fix(bedrock): pass timeout param to bedrock rerank http client (#22021)
* fix(bedrock): pass timeout to bedrock rerank http client

* refactor: extract large functions to fix PLR0915 ruff lint errors
2026-02-24 09:32:11 -08:00
Sean Marsh Glover
4652c73259
feat(proxy): limit concurrent health checks with health_check_concurrency (#20584)
* staged first pass

* black

* Update litellm/proxy/health_check.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* simpler

* restore cached logo

* fix tests for perform_health_check max_concurrency arg

* implement pr suggestion

* and the helm chart

* add configureable resources and probes to the deployment in the helm chart

* more helm chart unittests

* move some background healthcheck loggin to debug

---------

Co-authored-by: Sean Glover <sglover@athenahealth.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-24 08:16:59 -08:00
Harshit Jain
1fa0aad3f2
Merge pull request #22008 from BerriAI/litellm_fix_CVE
security: fix critical/high CVEs in OS-level libs and NPM transitive
2026-02-24 21:44:19 +05:30
Harshit28j
132e2ed671 Merge branch 'main' of https://github.com/BerriAI/litellm into litellm_fix_CVE
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
2026-02-24 21:09:16 +05:30
Harshit28j
3e6c10a071 security: fix critical/high CVEs in OS-level libs and NPM transitive 2026-02-24 19:40:09 +05:30
Sameer Kankute
a37cd0fe7c
Merge pull request #22005 from BerriAI/litellm_mcp_server_ui_fix
Fix: Transport Type for OpenAPI Spec on UI
2026-02-24 19:38:34 +05:30
Sameer Kankute
c17caf4cc7
Merge pull request #21992 from BerriAI/litellm_fix_oauth_mcp
fix: Missing OAuth session state
2026-02-24 19:37:09 +05:30
Sameer Kankute
6531d01959
Merge pull request #21982 from BerriAI/litellm_fix_pat_token_mcp
Fix: skip health check for MCP integration with passthrough token auth
2026-02-24 19:36:08 +05:30
Sameer Kankute
7a8499e89f
Merge pull request #21940 from BerriAI/litellm_oss_staging_02_23_2026
litellm oss staging 02 23 2026
2026-02-24 19:32:56 +05:30
Sameer Kankute
b38059b014
Merge branch 'main' into litellm_oss_staging_02_23_2026 2026-02-24 19:32:48 +05:30
Sameer Kankute
816f9052ff Fix: Transport Type for OpenAPI Spec on UI 2026-02-24 19:27:12 +05:30
Julio Quinteros Pro
d0330aa4e3
Merge pull request #22001 from jquinter/revert/pr-21957
Revert PR #21957: atomic RPM rate limiting
2026-02-24 09:53:25 -03:00
Julio Quinteros Pro
737a04b3ea Revert "Merge pull request #21957 from jquinter/fix/flaky-rpm-limit-test"
This reverts commit 77453ada2a, reversing
changes made to 7622f26918.
2026-02-24 09:52:50 -03:00
Julio Quinteros Pro
77453ada2a
Merge pull request #21957 from jquinter/fix/flaky-rpm-limit-test
fix: atomic RPM rate limiting in model rate limit check
2026-02-24 09:51:26 -03:00
Sameer Kankute
ac720defc3 Add documentation related to phase 2026-02-24 17:50:38 +05:30
Sameer Kankute
ef67b6b533 Add support for phase param 2026-02-24 17:48:55 +05:30
Shivam Rawat
7622f26918
Merge pull request #21997 from BerriAI/doc_fix_remove_harcoded_api_key
[Doc] replaced azure openai key with mock key
2026-02-24 03:32:37 -08:00
shivam
c86b174642 replaced with mock key 2026-02-24 03:28:28 -08:00
Sameer Kankute
12f37cea43 fix: Missing OAuth session state. Please retry 2026-02-24 14:22:38 +05:30
yuneng-jiang
c119adb6dc [Fix] UI - Virtual Keys: restrict Edit Settings button to key owners
Non-owner Internal Users could see and interact with the "Edit Settings"
button in the key Settings tab for keys they don't own. The button was
gated by `rolesWithWriteAccess.includes(userRole)` (role-only check)
instead of `canModifyKey` (ownership-aware), unlike the Regenerate and
Delete buttons which already used the correct check.

Replace the condition with `canModifyKey` so the Edit Settings button
follows the same proxy-admin / team-admin / key-owner logic as the
other action buttons. Add tests covering all permission paths.
2026-02-23 23:06:27 -08:00
Sameer Kankute
46ed7fc706 Add Additonal header field on UI for testing passthrough 2026-02-24 12:06:07 +05:30
Sameer Kankute
62d5d96e12 Fix: skip health check for MCP integration with passthrough token authentication 2026-02-24 12:05:37 +05:30
yuneng-jiang
f55fe7afdc
Merge pull request #21980 from BerriAI/litellm_ui_testing_coverage_00
[Refactor] UI - Onboarding: Extract testable view components
2026-02-23 22:03:19 -08:00
yuneng-jiang
36f7722b0f fix: add QueryClientProvider, remove stale file, use should naming in tests
- Wrap onboarding page with QueryClientProvider to prevent runtime crash
  (mirrors the same pattern used in LoginPage)
- Stage deletion of stale litellm/ui/litellm-dashboard/src/app/onboarding/page.tsx
  committed at the wrong path
- Rename all 16 test names to start with "should" per AGENTS.md convention
2026-02-23 21:53:42 -08:00
yuneng-jiang
a3491490f9 refactor onboarding 2026-02-23 21:30:08 -08:00
yuneng-jiang
02a53989cf fix: narrow onSubmit values and use semantic loading assertion 2026-02-23 21:20:22 -08:00
yuneng-jiang
0873494270 feat: extract OnboardingFormBody component with tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-23 21:08:19 -08:00
₳Ⱡ₥Ø₲
d0bcafacf0
fix(aiohttp): only set enable_cleanup_closed when required (#21897)
* fix(aiohttp): only set enable_cleanup_closed when required

* add tests
2026-02-23 21:06:29 -08:00