Commit Graph
35081 Commits
Author SHA1 Message Date
yuneng-jiangandGitHub beb521b241 Merge pull request #23437 from BerriAI/litellm_user-info-endpoint-v2-24cc
[Feature] User Info V2 Endpoint
2026-03-12 17:39:03 -07:00
Cursor Agentandyuneng-jiang cd1b31b77f fix: resolve N+1 query, double-fetch, and silent error bugs in _check_user_info_v2_access
Three bugs fixed in the RBAC helper for /v2/user/info:

1. N+1 query: target user was fetched inside the team loop, causing one
   redundant DB round-trip per team the caller administers. Now hoisted
   before the loop — single fetch regardless of team count.

2. Double fetch: the handler performed a second find_unique on the target
   user after the access check already fetched it. The helper now returns
   the user row directly (Optional[row] instead of bool), so the handler
   reuses it.

3. Silent error swallowing: a bare except Exception caught real DB errors
   (connection failures, timeouts) and returned False, surfacing them as
   mysterious 404s. Removed the try/except so real errors propagate as 500s.

Co-authored-by: yuneng-jiang <yuneng-jiang@users.noreply.github.com>
2026-03-13 00:11:58 +00:00
yuneng-jiangandGitHub 8c96e43aab Merge pull request #23489 from BerriAI/litellm_mcp_tools_tests
[Test] MCP tools component unit tests
2026-03-12 15:31:31 -07:00
yuneng-jiangandClaude Opus 4.6 c557286cac Add unit tests for 5 untested MCP tools components
Cover utils, types, MCPStandardsSettings, MCPLogoSelector, and
mcp_connection_status with 44 behavior-focused Vitest tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-12 15:24:44 -07:00
Cursor Agentandyuneng-jiang 7737e9c313 feat(ui): migrate user_dashboard.tsx and user_info_view.tsx to /v2/user/info
- user_dashboard.tsx: Replace userInfoCall with userGetInfoV2 for spend data,
  remove keys/teams logic (keys come from props/useKeys hook, teams from fetchTeams)
- user_info_view.tsx: Replace userInfoCall with userGetInfoV2, flatten data
  structure from nested {user_info: {...}} to flat response, fetch team details
  separately using teamInfoCall, remove keys display (Virtual Keys section)
- Update user_dashboard.test.tsx and user_info_view.test.tsx mocks

Co-authored-by: yuneng-jiang <yuneng-jiang@users.noreply.github.com>
2026-03-12 07:50:36 +00:00
Cursor Agentandyuneng-jiang d03404d21e feat(ui): add userGetInfoV2 networking function and migrate useCurrentUser hook
- Add UserInfoV2Response type and userGetInfoV2() function in networking.tsx
- Migrate useCurrentUser hook from userInfoCall to userGetInfoV2
- Update useCurrentUser.test.ts to test new v2 API integration
- The hook no longer needs userRole since the endpoint handles auth itself

Co-authored-by: yuneng-jiang <yuneng-jiang@users.noreply.github.com>
2026-03-12 07:48:10 +00:00
Cursor Agentandyuneng-jiang 679b8fd52a test: add unit tests for /v2/user/info endpoint and route checks
- 9 tests for the endpoint: admin access, self-lookup, unauthorized access,
  default to self, nonexistent user, response shape, team admin access,
  team admin denied, URL encoding
- 2 tests for route checks: route in info_routes, route access control

Co-authored-by: yuneng-jiang <yuneng-jiang@users.noreply.github.com>
2026-03-12 07:46:31 +00:00
Cursor Agentandyuneng-jiang 81e3a2e421 feat: add /v2/user/info endpoint - lightweight user info with RBAC
- Add UserInfoV2Response type in _types.py (returns only user object, no keys/teams)
- Add /v2/user/info endpoint handler with proper access control:
  - Proxy admins can query any user
  - Team admins can query users in their teams
  - Internal users can query themselves only
  - Returns 404 for unauthorized/not-found (not 403)
- Add /v2/user/info to info_routes in LiteLLMRoutes
- Add route check passthrough in route_checks.py
- Add get_user_v2() method to Python client

Co-authored-by: yuneng-jiang <yuneng-jiang@users.noreply.github.com>
2026-03-12 07:43:55 +00:00
yuneng-jiangandGitHub 2495579210 Merge pull request #23433 from BerriAI/litellm_fix_auth_error_message_typos
[Fix] Auth Error Message Typos
2026-03-11 23:31:33 -07:00
yuneng-jiangandClaude Opus 4.6 9aab3eddb3 Fix typos in auth error messages for blocked teams and keys
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 23:30:14 -07:00
yuneng-jiangandGitHub 56557bfae1 Merge pull request #23400 from BerriAI/litellm_/elated-hoover
[Fix] Replace deprecated models in tests
2026-03-11 17:25:37 -07:00
yuneng-jiangandClaude Opus 4.6 82de82f1b6 Fix test_completion_cost_prompt_caching gemini parametrization
gemini/gemini-2.5-flash lacks cache_creation_input_token_cost in the
model cost map, causing a TypeError when the test multiplies
cache_creation_input_tokens by None. Use claude-haiku-4-5 instead,
which has the required prompt caching cost fields.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 17:12:15 -07:00
yuneng-jiangandClaude Opus 4.6 c9f7075690 Replace additional deprecated models across test files
- tests/local_testing/test_completion_cost.py:
  - claude-3-5-sonnet-20240620 -> claude-sonnet-4-6
  - gemini/gemini-1.5-flash-001 -> gemini/gemini-2.5-flash

- tests/test_litellm/test_utils.py:
  - claude-3-5-sonnet-20240620 -> claude-sonnet-4-6 (VertexAI config test, proxy tests)
  - gemini-1.5-pro -> gemini-2.5-pro (pre_process_non_default_params)
  - gemini/gemini-1.5-pro -> gemini/gemini-2.5-pro (proxy tests)

- tests/litellm_utils_tests/test_utils.py:
  - claude-3-opus-20240229 -> claude-sonnet-4-6 (trimming, vision tests)
  - gemini-pro -> gemini-2.5-pro (function calling test)
  - gemini-pro-vision -> gemini-2.5-flash (vision test)
  - gemini-1.5-pro -> gemini-2.5-pro (response schema test)
  - gemini/gemini-1.5-flash -> gemini/gemini-2.5-flash (function calling test)
  - gemini-1.5-pro -> gemini-2.5-pro (vision gemini test)
  - gpt-4-vision-preview -> gpt-4o (vision test)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 17:03:54 -07:00
ryan-crabbeandGitHub fdfb65c204 Merge pull request #23395 from BerriAI/litellm_fix-default-user-perms-respected-through-SCIM
fix: fix default user perms respected through SCIM
2026-03-11 16:57:29 -07:00
yuneng-jiangandClaude Opus 4.6 9379cb1038 [Fix] Replace deprecated models in function calling tests
Replace deprecated model references in test_proxy_function_calling_support_consistency:
- claude-3-5-sonnet-20240620 -> claude-sonnet-4-6
- gemini-pro -> gemini-2.5-pro
- gemini/gemini-1.5-pro -> gemini/gemini-2.5-pro
- gemini/gemini-1.5-flash -> gemini/gemini-2.5-flash

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 16:46:56 -07:00
yuneng-jiangandGitHub c239d33925 Merge pull request #23393 from BerriAI/litellm_ui_component_tests
[Test] Add Unit Tests for 5 UI Components
2026-03-11 16:44:15 -07:00
ryan-crabbeandGitHub e4e5436bc2 Merge pull request #23399 from BerriAI/revert-23174-feat_adding_timezone_to_usage_page
Revert "feat: adding a timezone picker to the usage page"
2026-03-11 16:34:14 -07:00
yuneng-jiangandGitHub 8617ca6e12 Merge pull request #23390 from BerriAI/litellm_/reverent-kalam
[Fix] Update test_bad_database_url CI check for new error message
2026-03-11 16:33:45 -07:00
ryan-crabbeandGitHub c2c102c6e2 Revert "feat: adding a timezone picker to the usage page" 2026-03-11 16:33:03 -07:00
yuneng-jiangandClaude Opus 4.6 28989a11e7 [Fix] Update test_bad_database_url to match new startup error message
PR #23257 changed proxy startup to exit early with "Database setup
failed after multiple retries" instead of letting uvicorn emit
"Application startup failed. Exiting." Update the CI grep check
to accept either error message for robustness.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 16:25:35 -07:00
Ishaan JaffandGitHub f5e5d17e4a fix(mcp): fix OpenAPI OAuth flow — transport mapping, error messages, and discovery bypass (#23315)
* fix(mcp): fix OpenAPI OAuth flow — transport mapping, error messages, and discovery bypass

Three bugs fixed to make the end-to-end OAuth flow work for OpenAPI MCP servers:

1. **Transport mapping in getTemporaryPayload**: `TRANSPORT.OPENAPI` is a UI-only concept;
   the backend only accepts `"http"`, `"sse"`, or `"stdio"`. The pre-OAuth temp-session
   call was sending `transport: "openapi"` and getting a 422. Fixed by mapping to `"http"`.

2. **deriveErrorMessage handles FastAPI 422 arrays**: FastAPI validation errors return
   `detail` as an array of `{loc, msg, type}` objects. The shared error extractor was
   returning the array directly, causing `Error: [object Object]`. Fixed to map each
   item to its `.msg` field.

3. **Skip OAuth discovery when authorization_url already provided**: `build_mcp_server_from_table`
   was unconditionally calling `_descovery_metadata(server_url)` for OAuth servers. For
   OpenAPI servers the url is the spec JSON file, not the API base — this caused a timeout
   fetching e.g. the GitHub spec (2 MB). Fixed by skipping discovery when `authorization_url`
   is already set.

Also: collapsible auth section in MCP server form, "Create OAuth App →" link next to
Client ID when a docs URL is available (e.g. GitHub OAuth App creation page), and
`extractErrorMessage` helper in `useMcpOAuthFlow` for cleaner error display.

* refactor(mcp): extract needs_discovery flag and reduceStaticHeaders helper

* feat(mcp): user OAuth connect flow — OAuthConnectModal, MCPCredentialsTab, useUserMcpOAuthFlow

Adds the user-facing MCP OAuth2 PKCE connect flow:

- OAuthConnectModal: modal that launches the PKCE flow for a user to connect to an MCP server
- MCPCredentialsTab: credentials management tab in the MCP apps panel
- useUserMcpOAuthFlow: hook that handles the full PKCE auth code exchange for user-level connections
- MCPAppsPanel: wires up the new credentials tab and connect modal
- ChatPage: further cleanup after responses-API revert
- db.py / mcp_management_endpoints.py / _types.py: backend support for storing user MCP credentials

* fix(mcp): make client_id optional in /authorize — use server's stored client_id when not provided

* address greptile review feedback

* fix(mcp): narrow bare except to RecordNotFoundError in BYOK credential delete

* refactor(mcp): move inline imports to module level in db.py

* docs(claude): add MCP OAuth, transport mapping, and browser storage patterns

* fix(security): remove accessToken from sessionStorage in OAuth flow state

The LiteLLM API key was being serialised into sessionStorage as part of
StoredFlowState. After the OAuth redirect the component re-mounts with the
same accessToken prop, so it never needed to be stored. Read it from props
in resumeOAuthFlow instead.

* fix(ui): remove duplicate extractErrorMessage, sessionStorage-only in admin OAuth hook, call delete API on disconnect

* fix(ui): guard resumeOAuthFlow against wrong hook instance consuming OAuth result

* fix(ui): separate OAuth result keys per flow, sessionStorage-only, surface revoke errors

* fix(ui): remove dead OAuthConnectModal, revert tsconfig jsx mode to preserve

* fix(mcp): guard BYOK overwrite in oauth credential store, raise clear error when client_id absent

* fix: forward OAuth error params in callback, fix BYOK guard exception handling in db.py
2026-03-11 16:16:08 -07:00
yuneng-jiangandGitHub 1f721fd133 Merge pull request #23394 from BerriAI/litellm_internal_dev_staging_branch
[Infra] Add Daily Internal Dev Staging Branch
2026-03-11 15:57:18 -07:00
yuneng-jiangandClaude Opus 4.6 202b5b29de Add daily internal dev branch creation job
Adds a new job to the existing daily staging branch workflow that creates
a `litellm_internal_dev_MM_DD_YYYY` branch from main twice a day. This
branch serves as a staging area before merging into main to improve
stability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 15:53:42 -07:00
yuneng-jiangandClaude Opus 4.6 4405837aaa Add unit tests for 5 untested UI components
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 15:46:14 -07:00
Ryan Crabbe 18c0e8843c test: unit test for mkaing sure that user being created with correct value 2026-03-11 15:20:17 -07:00
yuneng-jiangandGitHub 56af724943 Merge pull request #23379 from BerriAI/litellm_ui_perf_fixes
[Fix] UI - Usage: Memoize Expensive Computations in UsagePageView
2026-03-11 14:55:23 -07:00
yuneng-jiangandGitHub 52f93aedc2 Merge pull request #23387 from BerriAI/litellm_fix_ruff_lint_errors
[Fix] Ruff Lint Errors: Unused Imports, Undefined Names, Statement Counts
2026-03-11 14:39:44 -07:00
ryan-crabbeandGitHub 79058ad596 Merge pull request #23174 from BerriAI/feat_adding_timezone_to_usage_page
feat: adding a timezone picker to the usage page
2026-03-11 14:38:19 -07:00
yuneng-jiangandGitHub 896e7b7623 Merge pull request #23367 from BerriAI/litellm_auto_redirect_sso_config
[Feature] Support auto_redirect_ui_login_to_sso in config.yaml
2026-03-11 14:37:24 -07:00
yuneng-jiangandGitHub 3968146f67 Merge pull request #23363 from BerriAI/litellm_fix_is_master_key_none_api_key
[Fix] TypeError in spend tracking when request has no API key
2026-03-11 14:34:44 -07:00
yuneng-jiangandClaude Opus 4.6 9c0cd6e02e Fix ruff lint errors: unused imports, undefined names, and statement counts
Remove unused imports (F401), add missing TYPE_CHECKING imports for
forward references (F821), and extract helpers to reduce statement
counts below the 50-statement limit (PLR0915).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 14:34:43 -07:00
yuneng-jiangandGitHub b5dfde892c Merge pull request #23377 from BerriAI/litellm_fix_flaky_mcp_and_agentcore_tests
[Fix] Flaky MCP Server and AgentCore Streaming Tests
2026-03-11 13:20:59 -07:00
yuneng-jiangandClaude Opus 4.6 13c0741262 Memoize expensive computations in UsagePageView to prevent unnecessary recalculations on every render
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 13:20:50 -07:00
Mr. ÅnandGitHubCursorgreptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
05fba27b0c Add Retool Assist tutorial with LiteLLM Proxy to docs (#21952)
* docs: add Retool Assist integration guide

- Add tutorials/retool_assist.md with setup instructions
- Add screenshots: Resources screen, Custom Provider config, resource query test
- Add retool_assist to AI Tools sidebar

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: refine Retool Assist guide layout

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs: update Retool Assist guide with new screenshots

- Add Resources screen after step 1
- Update AI category and LiteLLM config modal images

Co-authored-by: Cursor <cursoragent@cursor.com>

* Apply suggestion from @greptile-apps[bot]

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

* updated blank line

* Added video & gifs

Made-with: Cursor

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-11 13:17:08 -07:00
yuneng-jiangandClaude Opus 4.6 64d3d7626f [Fix] Flaky MCP server and AgentCore streaming tests in CI
- MCP tests: set mock_mcp_server.oauth2_flow = None to prevent MagicMock
  leaking into Pydantic Literal validation for MCPServer
- AgentCore tests: pass api_key="test-jwt-token" to bypass SigV4 credential
  lookup that fails in CI without AWS credentials

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 13:08:48 -07:00
yuneng-jiangandGitHub 08bb3808bc Merge pull request #23374 from BerriAI/ui_build_fix_mar11
[infra] Fixing UI Build and Tests
2026-03-11 12:55:58 -07:00
yuneng-jiang d415ffc70b fixing ui build and tests 2026-03-11 12:55:16 -07:00
Ryan Crabbe 2773adba6d fix(ui): move timezone search icon to the left side in date picker 2026-03-11 12:20:34 -07:00
yuneng-jiangandClaude Opus 4.6 e5245adae6 Support auto_redirect_ui_login_to_sso in config.yaml general_settings
Previously this setting was only honored via the AUTO_REDIRECT_UI_LOGIN_TO_SSO
environment variable. Now it can also be set in config.yaml under general_settings,
matching the pattern used by other proxy settings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 11:34:17 -07:00
Cesar GarciaandGitHub 59c24b7405 Merge pull request #17717 from Chesars/docs/responses-api-bridge-clarification
docs: clarify when to use openai/responses/ prefix for built-in tools
2026-03-11 15:18:32 -03:00
Cesar GarciaandGitHub 57e73c8f5e Merge pull request #20795 from Chesars/chore/remove-deprecated-models
chore: cleanup deprecated models from pricing JSON
2026-03-11 15:18:13 -03:00
Chesars 1a3fdc7ae3 fix: align Vertex AI Claude deprecations with Google's schedule
- Restore vertex_ai/claude-3-7-sonnet@20250219 (Vertex AI shutdown is
  May 11, 2026, still active — was incorrectly removed based on
  Anthropic API retirement date)
- Remove vertex_ai/claude-3-5-sonnet-v2 and
  vertex_ai/claude-3-5-sonnet-v2@20241022 (Vertex AI shutdown was
  Feb 19, 2026, already past)
- Remove deprecated claude-3-7-sonnet-20250219 from web search test,
  use only non-deprecated models

Source: https://docs.google.com/vertex-ai/generative-ai/docs/deprecations/partner-models
2026-03-11 15:11:07 -03:00
yuneng-jiangandClaude Opus 4.6 1a08ac6619 Fix TypeError in _is_master_key when api_key is None
When a request arrives without an API key, auth fails and the failure
hook triggers spend tracking. _is_master_key was called with api_key=None,
causing secrets.compare_digest to raise TypeError. Add a None guard for
api_key matching the existing guard for _master_key.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 11:01:29 -07:00
yuneng-jiangandGitHub 1d1baa2cd5 Merge pull request #23362 from BerriAI/litellm_ui_model_mcp
[Fix] Null safe checks for MCP Hub Tab
2026-03-11 10:50:54 -07:00
Chesars d81d751af0 fix(tests): update tests to use models still present in pricing JSON
Replace removed deprecated models (claude-3-5-sonnet-20241022,
claude-3-5-haiku-20241022, claude-3-5-haiku-latest) with current
models in web_search and cost calculation tests.
2026-03-11 14:50:47 -03:00
yuneng-jiang 8af34ffebc null-safe array checks 2026-03-11 10:35:51 -07:00
Chesars 45ca8b5b2b chore: resolve merge conflicts with upstream/main
Accept upstream's new models and re-apply removal of 133 deprecated models.
2026-03-11 14:24:53 -03:00
Chesars f9a538b583 fix(docs): close unclosed code block before Examples heading 2026-03-11 14:15:54 -03:00
Cesar GarciaGitHubgreptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
274bf42493 Update docs/my-website/docs/providers/openai.md
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-11 14:13:56 -03:00
Chesars 9e7a6a73ed docs: remove duplicate gpt-5.4 tip block 2026-03-11 13:48:47 -03:00