Commit Graph
216 Commits
Author SHA1 Message Date
Ishaan Jaff 825d6b08f0 test fix location of encode bedrock runtime modelid arn 2025-08-22 17:34:09 -07:00
Jugal D. BhattandGitHub 3c1dcb64cc fix by adding init lock (#13666) 2025-08-22 11:42:43 -07:00
Krish DholakiaandGitHub 6214d22126 Merge pull request #13863 from luizrennocosta/fix/pll-req-lim-v3-api-key
fix: fixing descriptor/response size mismatch on parallel_request_limiter_v3
2025-08-21 23:14:04 -07:00
Krish DholakiaandGitHub a61275f6e2 Merge pull request #13796 from 0x-fang/fix_aip_pass_through_08_20
Fix(Bedrock): fix application inference profile for pass-through endpoints for bedrock
2025-08-21 19:41:23 -07:00
Ishaan JaffandGitHub 77a5de37b1 [Fix] Ensure Service Account Keys require team_id field on API Endpoints (#13873)
* fixes for generating service accounts through the API

* fixes for test_update_service_account_works_with_team_id
2025-08-21 14:55:06 -07:00
Luiz Rennó Costa f8711200d0 fix: fixing descriptor/response size difference when indexing descriptor 2025-08-21 13:43:23 -03:00
Fang Gong 91040b6b56 fix the api key support for bedrock guardrail in proxy 2025-08-20 18:46:00 -07:00
Fang Gong caad9b3ca7 fix application inference profile for pass-through endpoints for bedrock 2025-08-20 00:40:43 -07:00
Krrish Dholakia 2e16f2cb13 test: add unit tests 2025-08-18 21:19:43 -07:00
Ishaan JaffandGitHub 40395598da [Feat] UI - Allow editing team member rpm/tpm limits (#13669)
* show team member tpm/rpm limits

* ui - allow setting team settings

* fix better debugging

* fix types: TeamMemberUpdateRequest

* add _upsert_budget_and_membership

* allow updating team member RPM/TPM in teamMemberUpdateCall

* editing team member rpm/tpm

* UI - fixes for team member component

* fix info

* test_upsert_rpm_only_creates_new_budget
2025-08-15 17:29:44 -07:00
Daniel BarkerandGitHub 47edecd5bc Fixed incorrect key info endpoint (#13633) 2025-08-15 11:10:06 -07:00
Jugal D. BhattandGitHub b8fe5f7b17 [MCP Gateway] LiteLLM Fix MCP gateway key auth (#13630)
* Fix - add safe divide by 0 for most places to prevent crash

* Enhance MCPRequestHandler to support permission inheritance and intersection logic for access groups. Added integration tests to verify behavior when keys have no permissions and when both keys and teams have overlapping permissions.

* Remove redundant assertions for permission checks in test_user_api_key_auth_mcp.py to streamline test logic.

* Refactor integration tests for MCPRequestHandler to simplify mocking. Replace complex database mocks with direct function mocks for permission inheritance and intersection scenarios, improving test clarity and maintainability.

* Revert "Fix - add safe divide by 0 for most places to prevent crash"

This reverts commit 265d40e39051e148996b9fb7f354730c57ff23ac.
2025-08-14 16:32:18 -07:00
Jugal Bhatt 45f188b041 Add mock user API key authentication in tag management tests
This update integrates mock user API key authentication into the tag management endpoint tests, ensuring accurate simulation of user roles for creating, updating, and deleting tags. The changes enhance the reliability of the tests by properly setting up user authentication before executing test cases.
2025-08-14 15:03:21 -07:00
Jugal Bhatt d21f467264 Revert "Add mock user API key authentication in tag management tests"
This reverts commit 5fc0803b94.
2025-08-14 14:58:49 -07:00
Jugal Bhatt 5fc0803b94 Add mock user API key authentication in tag management tests
This update introduces a helper function to create a mock user API key authentication object, which is utilized in the tag management endpoint tests. The mock authentication is integrated into the test cases for creating, updating, and deleting tags, enhancing the reliability of the tests by simulating user roles accurately.
2025-08-14 14:40:49 -07:00
Ishaan Jaff cd893134b7 test team endpoints 2025-08-13 18:43:50 -07:00
Ishaan Jaff 086621e3d3 test_handle_jwt.py 2025-08-13 17:27:50 -07:00
Ishaan JaffandGitHub 8e76f8e7d0 [Feat] Team Member Rate Limits + Support for using with JWT Auth (#13601)
* fix - assign tpm/rpm limit onJWT

* add team member rpm/tpm limits

* update - rate limiter v3 with team member rate limits

* update utils

* fixes for LiteLLM_BudgetTable

* undo change

* add TeamMemberBudgetHandler

* add _process_team_member_budget_data

* add get_team_membership

* add safe_get_team_member_rpm_limit and safe_get_team_member_tpm_limit

* LiteLLM_TeamMembership

* add LiteLLM_TeamMembership rate limit for JWTs

* fix

* tests
2025-08-13 17:21:36 -07:00
Krzysztof GąsiorowskiandGitHub 0b28930ad4 [Fix] Hide sensitive data in /model/info - azure entra client_secret (#13577)
* Remove litellm_params.client_secret from /model/info

Added pop of client_secret (Azure provider secret) from litellm_params in remove_sensitive_info_from_deployment used by /model/info endpoints

* Added test for litellm.proxy.common_utils.openai_endpoint_utils.remove_sensitive_info_from_deployment
2025-08-13 07:35:53 -07:00
Krish DholakiaandGitHub f00e891004 LiteLLM SDK <-> Proxy: support user param + Prisma - remove use_prisma_migrate flag - redundant as this is now default (#13555)
* fix(litellm_proxy/chat/transformation.py): support 'user' and all other openai chat completion params

Fixes issue where 'user' was not being sent in request to litellm proxy via sdk

* fix(prisma_migration.py): remove 'use_prisma_migrate' flag, is now default

* docs: cleanup docs

* fix(proxy_cli.py): remove --use_prisma_migrate flag

* refactor: remove references to use_prisma_migrate env var

This is now the default flow for db migrations
2025-08-12 22:03:39 -07:00
Ishaan JaffandGitHub 74ddd21067 [Bug fix] SCIM Team Memberships - handle metadata (#13553)
* test_update_group_metadata_serialization_issue

* fixes for update_group

* test_update_group_metadata_serialization_issue
2025-08-12 20:53:12 -07:00
Ishaan JaffandGitHub f60a9cf908 [Bug]: Fix JWTs access not working with model groups (#13474)
* fix can_team_access_model

* test_find_team_with_model_access_model_group
2025-08-09 16:14:51 -07:00
Jugal D. BhattandGitHub 67833590d6 [Proxy changes] Litellm add model price reload schedule for multi-pod (#13470)
* added mcp guardrails doc in mcp.md

* add button to reload models

* Added button changes

* added button for scheduling reload

* add multi pod support to reloading the model price json

* fix ruff
2025-08-09 16:12:13 -07:00
Krish DholakiaandGitHub 1c8761111f Router - reduce p99 latency w/ redis enabled by 50% + OTEL - track pre_call hook latency (#13362)
* feat(proxy/utils.py): track pre-call hooks in OTEL

some pre call hooks can cause latency in high traffic - make sure this is tracked

* fix(router.py): move redis call on deployment_callback_on_success to pipeline operation

reduces p99 latency by half when redis is enabled

* fix(parallel_request_limiter_v3.py): only run check if any item has rate limits set

Prevents unnecessary latency added by rate limit checks

* test: add unit tests

* Latency Improvements: only track tpm/rpm usage when set on deployment+ LLM Caching - use an in-memory cache to reduce redis calls + OTEL - track time spent on LLM caching (#13472)

* fix(router.py): only track usage for deployments with tpm/rpm set

ensures additional latency avoided for non-tpm/rpm models

* fix(caching_handler.py): log time spent on request get cache to OTEL

enables easy debugging of call latency

* fix(caching_handler.py): use dual cache object for in-memory caching + trace redis call within caching handler

* fix(caching_handler.py): working in-memory cache for redis calls

ensures dual cache works when redis cache setup for llm calls

makes calls quicker by only checking redis when in-memory cache missed for llm api call

* test: remove redundant test

* test: add unit tests
2025-08-09 16:09:51 -07:00
Ishaan JaffandGitHub 60306d34a0 [Bug Fix] Allow using Swagger for /chat/completions (#13469)
* fix get_openapi_schema

* fixes for ProxyChatCompletionRequest

* TestSwaggerChatCompletions

* fix working request body

* fix - add "messages"

* fix messages

* TestSwaggerChatCompletions

* test_messages_field_has_example

* ruff check fix
2025-08-09 15:35:45 -07:00
Jugal D. BhattandGitHub 1270df08a4 [Proxy + UI] Litellm add reload model api and button (#13464)
* added mcp guardrails doc in mcp.md

* add button to reload models

* Added button changes

* remove the model_reload
2025-08-09 13:52:56 -07:00
Jugal D. BhattandGitHub 10a1fe21c5 [LLM Translation] Litellm azure o series drop params (#13353)
* added route check

* fix ruff

* Added support for dropping o_series params

* Added ruff fix

* fix tests
2025-08-09 13:52:45 -07:00
Ishaan JaffandGitHub eb4bd26f24 [Bug Fix] - Get Routes (#13466)
* fixes get_routes_for_mounted_app

* fix - use _safe_get_endpoint_name

* fix code QA check

* test_get_routes_for_mounted_app_with_static_files

* test fixes
2025-08-09 12:52:23 -07:00
Jugal D. BhattandGitHub 51c2ff7c15 fix user membership issue (#13433) 2025-08-08 12:00:58 -07:00
Ishaan Jaff dbb651ea95 remove old mapped test 2025-08-07 13:51:50 -07:00
Ishaan JaffandGitHub 08ac2aeb6d Revert "Fix SSO Logout | Create Unified Login Page with SSO and Username/Password Options (#12703)" (#13387)
This reverts commit a752d7acc9.
2025-08-07 13:13:05 -07:00
Ishaan JaffandGitHub 4d941c914e [Feat] Responses API Session Handling - Multi media support (#13347)
* rename ResponsesSessionHandler

* use ResponsesSessionHandler

* test session handler

* refactor ResponsesSessionHandler

* fix get_proxy_server_request_from_spend_log

* use constant for LITELLM_TRUNCATED_PAYLOAD_FIELD

* add _should_check_cold_storage_for_full_payload

* add get_class_type_for_custom_logger_name

* get_active_custom_logger_for_callback_name

* add get_proxy_server_request_from_cold_storage to CustomLogger

* add ColdStorageHandler

* start using cold storage integration

* add get_proxy_server_request_from_cold_storage

* fixes from manual testing

* s3 v2 fix getting region name

* ChatCompletionImageUrlObject

* use _get_configured_cold_storage_custom_logger

* fixes for _should_check_cold_storage_for_full_payload

* fix _download_object_from_s3

* test_s3_v2_with_cold_storage

* add cold_storage_object_key to StandardLoggingMetadata

* use get_proxy_server_request_from_cold_storage_with_object_key

* add cold_storage_object_key to SpendLogsMetadata

* add cold_storage_object_key

* get_proxy_server_request_from_cold_storage_with_object_key

* use get_proxy_server_request_from_cold_storage_with_object_key

* test responses API

* add get_proxy_server_request_from_cold_storage_with_object_key

* session handler fixes

* test session handler

* fix ruff checks

* _download_object_from_s3

* cleanup

* test

* lint fix

* test_e2e_cold_storage_successful_retrieval

* test_e2e_generate_cold_storage_object_key_successful

* test_async_gcs_pub_sub_v1

* test fix

* test fix

* test fix

* test_standard_logging_metadata_has_cold_storage_object_key_field

* test_sanitize_request_body_for_spend_logs_payload_basic

* test_transform_input_image_item_to_image_item_with_image_data
2025-08-07 10:59:53 -07:00
Anand KhinvasaraandGitHub 96dca4eff8 fix: 12152 - Redacted sensitive information logged in bedrock guardrails (#13356) 2025-08-07 08:42:11 -07:00
yeahyungandGitHub a92bf8173e Fix create, search vector store error (#13285)
* (#13284) add avector_store_create to route_type which doesn't require model

* (#13284) exclude hidden params in metadata when create vector store

* (#13284) fix lint error

* (#13284) keep metadata None if metadata is None(not empty dict)

* (#13284) add test code

* (#13284) change test code name

* (#13284) add avector_store_search to route_type which doesn't require model
2025-08-06 11:15:17 -07:00
Krish DholakiaandGitHub 0da25fadc0 Exclude none fields on /chat/completion - fixes n8n bug + Allow calling /v1/models when end user over budget (#13320)
* fix(proxy_server.py): exclude none fields before returning

Fixes https://github.com/BerriAI/litellm/issues/13055

* test: add unit tests

* feat(auth_checks.py): allow info routes to work when end user over budget

Fixes https://github.com/BerriAI/litellm/issues/13286
2025-08-05 21:39:46 -07:00
Jugal D. BhattandGitHub efd34966dc [LLM Translation] Support /v1/models/{model_id} retrieval (#13268)
* added model id endpoint

* fix test

* add route to internal users

* make the functions reusable

* fixed mypy
2025-08-04 18:03:59 -07:00
Ishaan JaffandGitHub 849f5e0ba0 [Bug Fix] Fix Server root path regression on UI when using "Login" (#13267)
* bug fix serve_login_page

* test_serve_login_page_server_root_path
2025-08-04 15:58:28 -07:00
Ishaan Jaff 2dd9361cd9 Revert "Revert "Fix SSO Logout | Create Unified Login Page with SSO and Username/Password Options (#12703)""
This reverts commit 5fe37b6f72060add859a22ddda0665cd1635f98f.
2025-08-02 12:25:22 -07:00
Ishaan Jaff af9031ba41 Revert "Fix SSO Logout | Create Unified Login Page with SSO and Username/Password Options (#12703)"
This reverts commit a752d7acc9.
2025-08-02 12:25:22 -07:00
Alexander YastrebovandGitHub 825923e7be litellm/proxy: preserve model order of /v1/models and /model_group/info (#13178)
Closes #12644

Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
2025-08-02 08:57:38 -07:00
Jugal D. BhattandGitHub a4c11600a9 [LLM] fix model reload on model update (#13216)
* fix model reload on model update

* remove the flag
2025-08-01 18:08:02 -07:00
Ishaan Jaff 1358978abb test_recreate_prisma_client_successful_disconnect 2025-08-01 15:38:48 -07:00
Jugal D. BhattandGitHub bfabf2709a [LLM translation] Fix bedrock computer use #13143 (#13150)
* fix json test

* fix pr

* fix bedrock computer use tool

* added unit test

* fix failing prisma tesT

* fix prisma connect
2025-08-01 15:02:44 -07:00
Jason RobertsandGitHub 04c299410e Fix/panw prisma airs post call hook (#13185)
* fix(guardrails): Fix PANW Prisma AIRS post-call hook method name

- Changed async_post_call_hook to async_post_call_success_hook to match proxy calling convention
- Added event_hook parameter to initialization to ensure proper hook registration
- Fixes post-call response scanning for PANW Prisma AIRS guardrails

Resolves issue where post-call hooks were not being invoked due to method name mismatch.

* Update PANW Prisma AIRS tests to use correct method name
2025-07-31 21:50:32 -07:00
Ishaan JaffandGitHub 115d2480c1 [Bug Fix] Infra - ensure that stale Prisma clients disconnect DB connection (#13140)
* ensure original client is disconnected when re-creating

* test_recreate_prisma_client_successful_disconnect

* test_recreate_prisma_client_successful_disconnect
2025-07-31 16:43:26 -07:00
Jugal D. BhattandGitHub 524a1ffd5f [Proxy Startup]fix db config through envs (#13111)
* fix db config through envs

* add helper

* fix ruff

* fix imports

* add unit tests in db config changes
2025-07-31 13:52:56 -07:00
Jugal D. BhattandGitHub e324f76859 [MCP Gateway] add health check endpoints for MCP (#13106)
* add health check endpoints for MCP

* add import

* Clean up endpopints

* fix ruff
2025-07-30 20:40:44 +05:30
Ishaan Jaff 1af0743e58 Revert "Revert "[MCP Gateway] Add protocol headers (#13062)""
This reverts commit acd915f2db.
2025-07-29 18:14:31 -07:00
Ishaan Jaff acd915f2db Revert "[MCP Gateway] Add protocol headers (#13062)"
This reverts commit 8de24bab7c.
2025-07-29 17:26:00 -07:00
Cole McIntoshandGitHub 8826e02a98 feat: Add dot notation support for all JWT fields (#13013)
* feat: Add dot notation support for all JWT fields

- Updated all JWT field access methods to use get_nested_value for dot notation support
- Enhanced get_team_id to properly handle team_id_default fallback with nested fields
- Added comprehensive unit tests for nested JWT field access and edge cases
- Updated documentation to reflect dot notation support across all JWT fields
- Maintains full backward compatibility with existing flat field configurations

Supported fields with dot notation:
- team_id_jwt_field, team_ids_jwt_field, user_id_jwt_field
- user_email_jwt_field, org_id_jwt_field, object_id_jwt_field
- end_user_id_jwt_field (roles_jwt_field was already supported)

Example: user_id_jwt_field: 'user.sub' accesses token['user']['sub']

* fix: Add type annotations to resolve mypy errors

- Add explicit type annotation for team_ids variable in get_team_ids_from_jwt
- Add type ignore comment for sentinel object return in get_team_id
- Resolves mypy errors while maintaining functionality

* fix: Resolve mypy type error in get_team_ids_from_jwt

- Remove explicit List[str] type annotation that conflicts with get_nested_value return type
- Simplify return logic to use 'team_ids or []' ensuring always returns List[str]
- Fixes: Incompatible types in assignment (expression has type 'list[str] | None', variable has type 'list[str]')

* fix: Add proper type annotation for team_ids variable

- Use Optional[List[str]] type annotation to satisfy mypy requirements
- Resolves: Need type annotation for 'team_ids' [var-annotated]
- Maintains functionality while ensuring type safety

* refactor: remove outdated JWT unit tests and consolidate JWT-related functionality

- Deleted the test_jwt.py file as it contained outdated and redundant tests.
- Consolidated JWT-related tests into test_handle_jwt.py for better organization and maintainability.
- Updated tests to ensure proper functionality of JWT handling, including token validation and role mapping.
- Enhanced test coverage for JWT field access and nested claims handling.

* test: add comprehensive unit tests for JWT authentication

- Introduced a new test file `test_jwt.py` containing unit tests for JWT authentication.
- Implemented tests for loading configuration with custom role names, validating tokens, and handling team tokens.
- Enhanced coverage for JWT field access, nested claims, and role-based access control.
- Added fixtures for Prisma client and public JWT key generation to support testing.
- Ensured proper handling of valid and invalid tokens, including user and team scenarios.

* revert test_handle_jwt.py

* rename file

* test: remove outdated JWT nesting tests and add new nested field access tests

- Deleted the `test_jwt_nesting.py` file as it contained outdated tests.
- Introduced new tests in `test_handle_jwt.py` to verify nested JWT field access.
- Enhanced coverage for accessing nested values using dot notation and ensured backward compatibility with flat field names.
- Added tests for handling missing nested paths and appropriate default values.
- Improved handling of metadata prefixes in nested field access.

* restore file
2025-07-29 16:51:17 -07:00