Commit Graph
147 Commits
Author SHA1 Message Date
98a244450e Fix sso users not added to entra synced team (#17331)
* test: add failing tests for SSO user not added to Entra-synced teams bug

Adds tests reproducing the bug where new SSO users with teams=None
(from NewUserResponse) are not added to Entra ID synced teams because
add_missing_team_member() returns early when teams is None.

Tests demonstrate:
- NewUserResponse with teams=None fails to add user to teams (bug)
- LiteLLM_UserTable with teams=[] correctly adds user to teams (control)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: treat None as empty list in add_missing_team_member for new SSO users

Fixed bug where new SSO users logging in via Microsoft SSO were not added
to their Entra-synced teams. The issue was an early return when
user_info.teams is None (default for NewUserResponse). Now treats None
as an empty list so new users are properly added to all their SSO teams.

Location: litellm/proxy/management_endpoints/ui_sso.py:438-440

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-12-01 19:53:30 -08:00
rioiartandGitHub 70126d9130 Fix/new org team validate against org (#17333)
* fix: skip user budget/model validation for org-scoped teams

When creating a team with organization_id, budget and model constraints
should be validated against the organization's limits, not the user's
personal limits. This allows org admins with restrictive personal
budgets to create teams within their organization's more generous limits.

Adds 4 unit tests to verify:
- Org-scoped teams bypass user budget validation
- Org-scoped teams bypass user model validation
- Standalone teams still validate against user limits

* fix: enforce user budget/model limits for standalone teams in update_team

- Add user-level budget and model validation to update_team endpoint for standalone teams,
  matching the existing pattern in new_team
- Org-scoped teams correctly bypass user validation and use organization limits instead
- Add 5 new comprehensive tests covering standalone/org team budget/model validation

* fix: Add direct TPM/RPM org limit validation and consolidate user team limit checks

- Add direct TPM/RPM comparison against org limits in _check_org_team_limits()
- Consolidate budget/models/TPM/RPM user validation into _check_user_team_limits() helper
- Ensure user limits only apply to standalone teams (organization_id=None)
- Org-scoped teams now validate TPM/RPM against org limits (not user limits)
- Add 8 tests for TPM/RPM validation scenarios (org and user limits)
- Reduce code duplication between new_team() and update_team()
2025-12-01 19:51:42 -08:00
Saar wintrovandGitHub 87050c6a02 SSO: fix the generic SSO provider (#17227)
* SSO: fix the generic SSO provider

* adding tests
2025-11-27 21:27:23 -08:00
yuneng-jiang e629a6b703 Merge remote-tracking branch 'origin' into litellm_org_usage 2025-11-24 21:14:05 -08:00
yuneng-jiangandGitHub 3f5a34d72c Deleting a user from team deletes key user created for team (#17057) 2025-11-24 20:47:43 -08:00
YutaSaitoandGitHub b72b49757e feat: add backend support for OAuth2 auth_type registration via UI (#17006) 2025-11-23 21:52:18 -08:00
yuneng-jiang 7be3a0bd5d Merge remote-tracking branch 'origin' into litellm_org_usage 2025-11-22 10:19:28 -08:00
yuneng-jiangandGitHub b074c79734 Allow partial matches for user id in user table (#16952) 2025-11-21 19:12:16 -08:00
yuneng-jiang d785205a70 Merge remote-tracking branch 'origin' into litellm_org_usage 2025-11-21 16:25:55 -08:00
yuneng-jiangandGitHub 0abfb07ab8 Remove UI Session Token from user/info return (#16851) 2025-11-21 16:11:58 -08:00
yuneng-jiang 6029a24baa Merge remote-tracking branch 'origin' into litellm_org_usage 2025-11-20 20:19:16 -08:00
Ishaan JaffandGitHub e2fc225201 [Feat] SSO - Ensure role from SSO provider is used when a user is inserted onto LiteLLM (#16794)
* test_apply_user_info_values_sso_role_takes_precedence

* fix SSO
2025-11-18 15:35:38 -08:00
yuneng-jiangandGitHub f9ec353b80 [Feature] UI - Allow setting base_url in API reference docs (#16674)
* Allow setting base_url in API reference docs

* Add logic to change base url for test key page
2025-11-18 11:27:28 -08:00
Ishaan JaffandGitHub bdb1e16dcf [Feat] AI Gateway Auth - Allow using JWTs for signing in with Proxy CLI (#16756)
* fix auth

* get_cli_jwt_auth_token

* fix linting

* test fixes

* docs

* test fixes

* fix refactor
2025-11-17 19:47:29 -08:00
Ishaan JaffandGitHub 25cb873467 [UI] expose backend endpoint for callbacks settings (#16698)
* init json for

* add SQS fields

* fix params

* return callbacks configs

* test_get_callback_configs

* test_get_callback_configs

* vercel build fix
2025-11-15 16:44:17 -08:00
yuneng-jiang 63dcd00b8b Merge remote-tracking branch 'origin/main' into litellm_org_usage 2025-11-14 18:05:50 -08:00
Ishaan JaffandGitHub b360cc957e [Feat] Model Management API - Add API Endpoint for creating model access group (#16663)
* add NewModelGroupRequest

* add endpoint for create_model_group

* fix model_access_group_management_router

* add UpdateModelGroupRequest, info and delete

* fix model management tag

* fix validate_models_exist

* fix get_all_access_groups_from_db

* test_create_duplicate_access_group_fails

* test fixes

* fix working create access groups

* fix access group management endpoints

* add is db model checks for model access groups
2025-11-14 16:40:43 -08:00
YutaSaitoandGitHub 331be4f57b fix: avoid crashing when MCP server record lacks credentials (#16601) 2025-11-13 22:01:11 -08:00
yuneng-jiang 94da5c076c Add Daily Org Spend Table, read path, and write path 2025-11-12 18:22:26 -08:00
Mubashir OsmaniandGitHub e6bbf3ce81 fix: app_roles missing from jwt payload (#16448)
* fix: jwt app_roles missing

* add test
2025-11-12 12:07:04 -08:00
yuneng-jiangandGitHub ba674f241c [Fix] Use user budget instead of key budget when creating new team (#16074)
* Use end user budget instead of key budget when creating new team

* Fixed implementation to use user's max budget from the UserTable instead of EndUserTable
2025-11-11 18:55:05 -08:00
Ishaan JaffandGitHub dc76b6c76e [Fix] Management Endpoints - Fixes inconsistent error responses in customer management endpoints. Non-existent user errors now return proper 404 status codes with consistent error schema format across all endpoints. (#16450)
* fix: ensure end user endpoints use "handle_exception_on_proxy" correctly

* test 404 on info and update for non-existent user

* test 404 for no customer found

* fix 404 handling for customer endpoints

* test_error_schema_consistency

* test_customer_endpoints_error_schema_consistency
2025-11-10 17:16:53 -08:00
Ishaan Jaffer 1bf284abca test_delete_callbacks_in_db 2025-11-08 14:05:44 -08:00
YutaSaitoandGitHub 6eb74bd62a Feat/persist mcp credentials in db (#16308)
* feat: persist mcp credentials in db

* feat: remove Auth Value field from MCP Tool Testing Playground

* fix: test
2025-11-07 19:22:49 -08:00
Ishaan Jaffer 5157078e0a test_delete_callbacks_in_db 2025-11-06 18:37:36 -08:00
Ishaan Jaffer 8a9fe7b056 fix delete callbacks 2025-11-06 17:06:34 -08:00
yuneng-jiangandGitHub 812c8b88e9 Fixed /model_group/info returning entire model list for SSO users (#16296) 2025-11-05 18:30:30 -08:00
Krish DholakiaandGitHub 3f40613c56 fix(ui_sso.py): support dot notation on ui sso (#16135) 2025-11-02 09:35:52 -08:00
Ishaan JaffandGitHub c59a0c9681 [Feat] UI - Allow setting cache settings on UI (#16143)
* add LiteLLM_CacheConfig

* add CacheSettingsField

* add UI cache saver

* feat add cache_settings_router

* fix schema

* fix ssl_check_hostname

* refactor into utils

* add groups for field names

* add test_connection in base cache

* add test_connection inredis and redis cluster

* feat _decrypt_db_variables

* add cache settings endpoints

* test_test_cache_connection_calls_cache_test_connection_with_params

* fix: add switch_on_llm_response_caching

* feat use CacheSettingsManager

* feat use CacheSettingsManager

* TestCacheSettingsManager

* fix update_config

* Cache Field test
2025-10-31 17:43:59 -07:00
YutaSaitoandGitHub 8b33328cc1 Perf speed up pytest (#15951)
* perf: Skip sleep delays in base_mail.py during tests to improve test speed

* perf: Mock datetime.now in parallel_request_limiter_v3.py to improve test speed

* pref: Mock urllib system calls in test_aiohttp_transport.py to improve test speed

* chore: add --durations=50 to visualize slowest tests

* pref: reduce setup phase overhead by widening fixture scope in conftest.py

* test: stabilize flaky tests

* fix: minor issue
2025-10-27 19:43:40 -07:00
Krish DholakiaandGitHub 6bb1d77f45 Org level tpm/rpm limits + Team tpm/rpm validation when assigned to org (#15549)
* fix(support-model-specific-tpm/rpm-limits): Allows setting rate limits by tpm/rpm for models by team

* fix(key_management_endpoints.py): enforce guaranteed throughput with key-level model tpm/rpm limits, when team-level tpm/rpm limits are set

* test: add unit testing

* feat(schema.prisma): add metadata to litellm budget table

* feat(proxy/utils.py): add org limits to user api key auth

allows org level tpm/rpm limiting to work

* feat: add org level tpm/rpm limits + inherit org id in key from team

enables org level tpm/rpm limits

* feat: validated working org tpm/rpm limits

* feat: support updating org level, model specific tpm/rpm limits

* fix: working key validation for org level tpm/rpm limits

* fix: working validation for orgs when giving tpm/rpm to teams

* fix(key_management_endpoints.py): fix tpm/rpm limits on orgs

* fix(key_management_endpoints.py): support limits

* refactor: remove duplicate var

* fix: refactor to avoid ruff errors

* fix: fix typign

* fix: fix linting error

* fix: fix testing

* fix(key_management_endpoints.py): document params
2025-10-25 13:40:29 -07:00
Krish DholakiaandGitHub 4e141df03a (feat) Team level model-specific tpm/rpm limits + working key-level validation of tpm/rpm limit when assigned to team (#15513)
* fix(support-model-specific-tpm/rpm-limits): Allows setting rate limits by tpm/rpm for models by team

* fix(key_management_endpoints.py): enforce guaranteed throughput with key-level model tpm/rpm limits, when team-level tpm/rpm limits are set

* test: add unit testing

* fix: fix minor linting errors

* fix: refactor
2025-10-18 13:14:04 -07:00
Ishaan Jaffer ea69f4547d Merge branch 'main' into litellm_oct_staging2 2025-10-16 17:06:29 -07:00
Ishaan JaffandGitHub f27f2d4803 Merge branch 'main' into litellm_sso_add_pkce 2025-10-16 15:48:01 -07:00
Krrish Dholakia e43c3b9b88 test: add unit testing 2025-10-16 15:37:26 -07:00
Ishaan Jaffer 086904f3db TestPKCEFunctionality 2025-10-16 13:18:31 -07:00
berri-teddy 1b55803c76 test: reduce EntraID app roles tests to essential scenarios
- Keep only 2 focused tests: single role extraction and no roles claim
- Remove complex fixtures and edge case tests
- Maintain clean, maintainable test coverage
2025-10-15 18:15:04 -07:00
berri-teddy 6b166e046d fix: correct EntraID app roles JWT claim extraction
- Fix get_app_roles_from_id_token to use 'app_roles' claim instead of 'roles'
- Add comprehensive unit tests for EntraID app roles functionality
- Prevent regressions in Microsoft EntraID SSO authentication

Resolves issue where EntraID app roles were not being extracted correctly
from JWT tokens, causing authentication failures for users with assigned
app roles in Microsoft EntraID.
2025-10-15 18:06:03 -07:00
Ishaan JaffandGitHub 5b7e2fd778 [Feat] UI - Allow setting Provider Discounts on UI (#15550)
* fix cost_discount_config

* add CostBreakdown

* fix: set_cost_breakdown

* test_cost_discount_vertex_ai

* docs fix

* docs fix discounts

* docs fix

* docs custom pricing

* docs fix

* fixes for getting cost breakdown in response headers

* test - response headers wth discount

* - feat: allow setting cost tracking settings

* add cost tracking endpoints

* feat add cost_tracking_settings_router

* add validation when setting cost settings

* add CostTrackingSettings

* add page

* refactor

* use simple table

* add ProviderDiscountTable

* fix ui

* save

* fix: discount settings

* fix edits

* add settings

* add HelpLink

* add help link

* docs HelpLink

* docs fix

* fix how it works

* fix layout

* test TestCostTrackingSettings

* fix Dict
2025-10-14 20:08:18 -07:00
Ishaan Jaffer a163bf9f51 test fix: MicrosoftSSOHandler 2025-10-11 08:55:23 -07:00
Ishaan Jaffer 3aa0f6ed72 test_generate_key_with_object_permission 2025-10-11 08:54:15 -07:00
Ishaan Jaffer 87719640eb test tag mgmt 2025-10-11 08:48:37 -07:00
CopilotGitHubcopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>ishaan-jaff
b9eb05ea63 [Feature]: Include server_name in /v1/mcp/server/health endpoint response (#15431)
* Initial plan

* Add server_name to MCP health check response

Co-authored-by: ishaan-jaff <29436595+ishaan-jaff@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ishaan-jaff <29436595+ishaan-jaff@users.noreply.github.com>
2025-10-10 17:37:53 -07:00
Ishaan Jaffer c4022ade49 test mapped tests MCP 2025-10-08 18:34:30 -07:00
Ishaan Jaffer e1ab3620ee fix: mapped tests 2025-10-07 17:55:52 -07:00
Ishaan JaffandGitHub 7b56ba240e [MCP Gateway] Litellm mcp fixes team control (#15304)
* fix: _set_object_permission

* fix: _set_object_permission on teams

* fix: _set_object_permission

* fixes for team/key permissions

* statsh: object permission view

* fix: MCPServerPermissions
2025-10-07 16:48:00 -07:00
Ishaan JaffandGitHub bc26eff98f Fix: Make PATCH /model/{model_id}/update handle team_id consistently with POST /model/new (#15297)
* fix: _update_team_model_in_db

* test_patch_model_with_team_id_creates_proper_setup
2025-10-07 14:04:08 -07:00
Ishaan JaffandGitHub 07a17d6d6b [Feat] Proxy CLI - dont store existing key in the URL, store it in the state param (#15290)
* Feat: CLI Auth fixes for UI SSO

* fix auth.py

* fix test ui sso.py
2025-10-07 12:36:17 -07:00
Ishaan JaffandGitHub 930f88078e [MCP Gateway] Backend - Allow storing allowed tools by team/key (#15243)
* add mcp_tool_permissions column to LiteLLM_ObjectPermissionTable

* add mcp_tool_permissions

* add LiteLLM_ObjectPermissionTable

* test key/team mgmt

* fix code QA check

* fix check_tool_permission_for_key_team

* test_key_tool_permission_allows_permitted_tool

* test_list_tools_filters_by_key_team_permissions

* fix _get_tools_from_mcp_servers

* fix logger.debug

* fix check_tool_permission_for_key_team

* fix: filter_tools_by_key_team_permissions

* fix _get_team_object_permission

* fix _set_object_permission

* fix handle_update_object_permission_common

* fix add allowed tools to keys

* test add key/team level tool permissions for MCPs
2025-10-06 18:49:32 -07:00
Krrish Dholakia 63cb2764fe test: fix raise 2025-10-04 16:11:22 -07:00