Commit Graph

179 Commits

Author SHA1 Message Date
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 Yastrebov 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. Bhatt 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. Bhatt 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 Roberts 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 Jaff 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. Bhatt 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. Bhatt 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 McIntosh 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
Jugal D. Bhatt 8de24bab7c [MCP Gateway] Add protocol headers (#13062)
* Add protocol headers

* fix mypy

* fix tests

* fix tests
2025-07-29 16:03:23 -07:00
Siddharth Sahu 39d59f1900 Fix/gemini api key environment variable support (#12507)
* Fix: Add support for GOOGLE_API_KEY environment variables for Gemini API authentication

* added test cases

* incoperated feedback to make it more maintainable

* fix failed linting CI
2025-07-29 15:56:01 -07:00
Krish Dholakia 5b50a12329 Revert "fix: Set user from token user_id for OpenMeter integration (#13029)" (#13107)
This reverts commit f8c09e44f6.
2025-07-29 15:49:20 -07:00
Better than breakfast. f8c09e44f6 fix: Set user from token user_id for OpenMeter integration (#13029) 2025-07-29 15:41:50 -07:00
Tim O'Farrell 4639be0c64 Fix list team v2 security check (#13094)
* Fix security vulnerability in list_team_v2 endpoint

- Add missing allowed_route_check_inside_route security check to list_team_v2
- Add @management_endpoint_wrapper decorator for consistency with list_team
- Add comprehensive tests to verify security checks work correctly
- Ensure non-admin users can only query their own teams
- Ensure admin users can query all teams

This fixes a security bug where non-admin users could potentially access
team information they shouldn't have access to through the list_team_v2
endpoint, which was missing the authorization check present in list_team.

* Fix test

* Test fixes

* Fixed test

* Restored invalid delete

* Revert

---------

Co-authored-by: openhands <openhands@all-hands.dev>
2025-07-29 10:29:40 -07:00
Krish Dholakia 039c8a922c Azure api_version="preview" support + Bedrock cost tracking via Anthropic /v1/messages (#13072)
* fix(azure/chat/gpt_transformation.py): support api_version="preview"

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

* Fix anthropic passthrough logging handler model fallback for streaming requests (#13022)

* fix: anthropic passthrough logging handler model fallback for streaming requests

- Add fallback logic to retrieve model from logging_obj.model_call_details when request_body.model is empty
- Fixes issue #12933 where streaming requests to anthropic passthrough endpoints would crash due to missing model field
- Ensures downstream logging and cost calculation work correctly for all streaming scenarios
- Maintains backwards compatibility with existing non-streaming requests

* test: add minimal tests for anthropic passthrough logging handler model fallback

- Add unit tests for the model fallback logic in _handle_logging_anthropic_collected_chunks
- Test existing behavior when request_body.model is present
- Test fallback logic when request_body.model is empty but logging_obj.model_call_details has model
- Test edge cases where both sources are empty or missing
- Ensure backwards compatibility and graceful degradation

* fix(anthropic_passthrough_logging_handler.py): add provider to model name (accurate cost tracking)

* fix(anthropic_passthrough_logging_handler.py): don't reset custom llm provider, if already set

* fix: fix check

---------

Co-authored-by: Haggai Shachar <haggai.shachar@backline.ai>
2025-07-29 08:13:55 -07:00
Ishaan Jaff deb1efa8ce [Bug Fix] Pass through logging handler VertexAI - ensure multimodal embedding responses are logged (#13050)
* fix _is_multimodal_embedding_response

* test_vertex_passthrough_handler_multimodal_embedding_response
2025-07-28 16:30:19 -07:00
Krrish Dholakia 2da6d457ef test: update logic to fix for unit tests 2025-07-28 07:38:58 -07:00
Krish Dholakia 94aa6b0b5d Bulk User Edit - additional improvements - edit all users + set 'no-default-models' on all users (#12925)
* feat(bulk_user_update/): support updating all users on proxy

* fix(bulk_edit_user.tsx): persist user settings when 'add to team' clicked

* fix(team_endpoints.py): bulk add all proxy users to team

supports flow from UI to add all existing users to a team

* fix: minor fixes

* feat(user_edit_view.tsx): support setting no default model on user edit

allows preventing users from calling models outside team scope

* fix(user_edit_view.tsx): prevent triggering submit when 'cancel' is clicked

* refactor(internal_user_endpoints.py): refactor to reduce function size
2025-07-27 10:12:30 -07:00
Jugal D. Bhatt b921e22594 [MCP Gateway] Litellm mcp multi header propagation (#13003)
* change alias-> server_name

* add server alias uses

* add tests

* schema

* ruff fix

* fix alias for config

* fix tests

* add alias

* fix tests

* add multi server header support

* add and fix tests

* fix tests

* fix tests

* add a common util

* ruff fix

* fix ruff

* fix tests

* fix migration

* mypy fix

* change server py
2025-07-26 11:45:14 -07:00
Krish Dholakia eed0cf2ee9 UI SSO - fix reset env var when ui_access_mode is updated (#13011)
* fix(ui_sso.py): fix form action on login when sso is enabled

* fix: multiple fixes - fix resetting env var in proxy config + add key to exception message on key decryption

fixes issue where env vars would be reset

* refactor(proxy_server.py): cleanup redundant decryption line

* fix(proxy_setting_endpoints.py): show saved ui access mode

allows admin to know what they'd previously stored in db
2025-07-26 11:42:41 -07:00
Krish Dholakia 4b50566d6d [FEAT] Model-Guardrails: Add on UI (#13006)
* feat(proxy_server.py): working guardrails on streaming output

ensures guardrail actually raises an error if flagged during streaming output

* test: add unit tests

* feat(advanced_settings.tsx): add guardrails option as ui component on model add

enables setting guardrails on model add

* feat(add_model_tab.tsx): fix add model form

* feat(model_info_view.tsx): support adding guardrails on model update

* fix(add_model_tab.tsx/): working health check when guardrails selected

* fix(proxy_server.py): fix yield
2025-07-26 11:42:03 -07:00
Jugal D. Bhatt 10595ea077 [MCP Gateway] add Litellm mcp alias for prefixing (#12994)
* change alias-> server_name

* add server alias uses

* add tests

* schema

* ruff fix

* fix alias for config

* fix tests

* add alias

* fix tests

* fix tests

* add a common util

* ruff fix

* fix migration
2025-07-25 17:57:52 -07:00
Dmitriy Alergant 0cc320cc0a GuardrailsAI: use validatedOutput to allow usage of "fix" guards. Previously "fix" guards had no effect in llmOutput mode. (#12891) 2025-07-24 22:07:06 -07:00
Krish Dholakia 1a57875d24 Proxy - specify key_type - allows specifying if key can call LLM API routes vs. Management routes only (#12909)
* feat(key_management_endpoints.py): Support new 'key_type' field

allow user to specify if key should be 'management' or 'llm api' key

Security fix

* test(test_route_checks.py): add unit tests

* fix(create_key_button.tsx): add ui component to select key type

allows specifying if key can call llm api vs. management routes

* feat(create_key_button.tsx): add specifying key type to ui

* fix(route_checks.py): add sensitive data masker for user id on not allowed error message

prevent leaking sensitive information
2025-07-24 16:40:40 -07:00
Murad Khafizov a6ddf5c744 feat: extended /v1/models endpoint, now it returns with fallbacks on demand (#12811)
* Extended `/v1/model` endpoint to support fallbacks

* unit tests reworked

* linting fixes

* fix lining error

* fix linting
2025-07-22 23:16:46 -07:00
Krish Dholakia d26f74ade5 Request Headers - support x-litellm-num-retries + Usage - support usage by model group (#12890)
* feat(litellm_pre_call_utils.py): add num_retries to litellm data for backend call

allow user to pass in num retries via request headers

* test(test_litellm_pre_call_utils.py): add unit test

* docs(request_headers.md): document new request header

* fix(common_daily_activity.py): show spend breakdown by model group

Partial fix for https://github.com/BerriAI/litellm/issues/12887

* feat(new_usage.tsx): new tab switcher for viewing usage by model group vs. received model

Closes https://github.com/BerriAI/litellm/issues/12887
2025-07-22 23:09:36 -07:00
Ishaan Jaff b41ce5c92f [Feat] - Track cost + add tags for health checks done by LiteLLM Proxy (#12880)
* refactor to use add_user_api_key_auth_to_request_metadata

* add get_litellm_internal_health_check_user_api_key_auth

* add get_litellm_internal_health_check_user_api_key_auth

* add _update_model_params_with_health_check_tracking_information

* add HealthCheckHelpers

* refactor to use clean helpers

* test_update_model_params_with_health_check_tracking_information

* test_get_litellm_internal_health_check_user_api_key_auth

* test_add_user_api_key_auth_to_request_metadata

* fix _update_model_params_with_health_check_tracking_information
2025-07-22 18:45:57 -07:00
Krish Dholakia db498c1805 Fix team_member_budget update logic (#12843)
* fix(team_endpoints.py): always remove team member budget from updated_kv

this is not a field for the litellm team table

Prevents startup issue

* test(test_team_endpoints.py): add unit test to ensure 'team_member_budget' is never in update to table - separate logic

* refactor: cleanup
2025-07-21 22:06:29 -07:00
tanjiro a752d7acc9 Fix SSO Logout | Create Unified Login Page with SSO and Username/Password Options (#12703) 2025-07-20 20:24:38 -07:00
Krish Dholakia 0c461b2719 Litellm fix proxy unit testing p2 (#12779)
* test: update tests

* test: update test

* test: update unit tests
2025-07-19 16:35:05 -07:00
Cole McIntosh b04b456bc2 fix(proxy): Fix Model Armor project_id initialization order (#12766)
When using Model Armor guardrail with explicit project_id in config,
the project_id was being overwritten to None due to incorrect
initialization order between ModelArmorGuardrail and VertexBase parent class.

This fix ensures that user-provided project_id is preserved by initializing
parent classes before setting instance attributes.

Fixes #12757
2025-07-19 15:20:40 -07:00
Jugal D. Bhatt b443817a56 [Key Access] Litellm disabled callbacks for UI (#12769)
* add disabled callbacks to ui

* added body

* update edit settings

* add tests
2025-07-19 14:32:05 -07:00
Ishaan Jaff 5802a5bbe3 [Feat] LLM API Endpoint - Expose OpenAI Compatible /vector_stores/{vector_store_id}/search endpoint (#12749)
* fix _pass_through_endpoint_without_required_model

* add get_litellm_managed_vector_store_from_registry

* undo router change

* fix for using router + vector search methods

* add simple helper for _update_request_data_with_litellm_managed_vector_store_registry

* add vector_stores routes

* test_router_avector_store_search_passes_correct_args

* [Feat] UI - Allow clicking into Vector Stores (#12741)

* Add View Vector Store

* add /info for vector store

* fix updated_at

* allow easily testing the KB on litellm

* fix

* rename test

* test_init_vector_store_api_endpoints

* test_update_request_data_with_litellm_managed_vector_store_registry
2025-07-18 18:18:53 -07:00
Cole McIntosh 506dc80b15 feat: integrate Google Cloud Model Armor guardrails (#12492)
* feat: integrate Google Cloud Model Armor guardrails (LIT-298)

- Add ModelArmorGuardrail class that extends CustomGuardrail and VertexBase
- Support for both pre-call (sanitizeUserPrompt) and post-call (sanitizeModelResponse) sanitization
- Integrate with existing Vertex AI authentication using VertexBase
- Add configuration model for Model Armor in guardrail types
- Register Model Armor in guardrail initializers and registry
- Include comprehensive test suite for Model Armor functionality
- Support content masking for both requests and responses
- Handle streaming responses with content sanitization

This integration allows LiteLLM to use Google Cloud Model Armor API for
content moderation and sanitization, providing similar functionality to
Bedrock Guards but using Google Cloud's security infrastructure.

* fix: remove unused imports flagged by ruff linter

- Remove unused asyncio import at top level (moved to local import where needed)
- Remove unused TextCompletionResponse import

* fix: remove additional unused imports

- Remove unused TextChoices import from line 34
- Remove duplicate asyncio import from line 384
- Replace asyncio.iscoroutine() with hasattr check for __await__

* fix: remove final unused imports

- Remove unused 'import sys' from line 9
- Remove unused 'StreamingChoices' from imports

* fix: remove unused import from model_armor.py

- Remove unused 'import os' from the top of the file

* fix: remove commented-out header from model_armor.py

- Eliminate unnecessary comments at the top of the file to improve code clarity.

* feat(guardrails): Add Model Armor UI support

- Convert model_armor.py to a directory structure with __init__.py for dynamic discovery
- Add get_config_model() method to ModelArmorGuardrail class for UI integration
- Add ui_friendly_name() to ModelArmorConfigModel returning "Google Cloud Model Armor"
- Remove manual registration from guardrail_registry.py to use dynamic discovery
- Model Armor now appears in the UI guardrails dropdown with proper configuration fields

This enables users to configure Model Armor guardrails through the LiteLLM UI interface.

* fix(guardrails): Fix undefined name 'GuardrailConfigModel' in Model Armor

- Import TYPE_CHECKING and GuardrailConfigModel from base module
- Fixes F821 linting error for undefined name in type annotation
- Follows same pattern as other guardrail implementations

* fix(guardrails): Fix Model Armor type errors and config model inheritance

- Create ModelArmorGuardrailConfigModel that properly inherits from GuardrailConfigModel base class
- Move config model to litellm/types/proxy/guardrails/guardrail_hooks/model_armor.py following convention
- Update get_config_model() to return the properly typed config model
- Remove ModelArmorConfigModel from LitellmParams inheritance chain
- Add template_id field to BaseLitellmParams instead

This fixes the mypy type errors and follows the same pattern as other guardrail implementations.

* fix(guardrails): Add missing Model Armor fields to BaseLitellmParams

- Add location, credentials, api_endpoint, and fail_on_error fields
- Fixes mypy errors about missing attributes in LitellmParams
- All Model Armor configuration parameters are now properly defined

* fix: Apply PR review feedback for Model Armor guardrail

- Move test file to tests/test_litellm/ for GitHub Actions
- Extract only last consecutive user messages to avoid context limits
- Use get_content_from_model_response helper for response extraction
- Handle non-ModelResponse types (e.g., TTS) gracefully
- Maintain newline separation for multi-part content

* refactor: Simplify message content extraction in ModelArmorGuardrail

- Removed the custom _extract_content_from_messages method.
- Integrated get_last_user_message helper for improved content extraction.
- Updated test to reflect changes in content formatting.

* refactor: Remove unused import in model_armor.py

- Deleted the unused import of AllMessageValues to clean up the codebase.

* Add unit tests for Model Armor guardrail functionality

- Implement tests for pre-call and post-call hooks, including content sanitization and blocking behavior.
- Validate error handling for API responses and credential management.
- Test streaming responses and handling of list content in user messages.
- Ensure proper assertions for API interactions and response sanitization.

* Add comprehensive test coverage for Model Armor guardrail

- Add test for requests with no messages field
- Add test for empty message content handling
- Add test for system/assistant-only messages
- Add test for fail_on_error=False behavior
- Add test for custom API endpoint configuration
- Add test for dictionary credentials (non-file path)
- Add test for action=NONE response handling
- Add test for missing sanitized_text field fallback
- Add test for non-text response types (TTS/image)
- Add test for auth token refresh behavior

All tests ensure robust edge case handling and proper error management.

* feat: improve Model Armor handling of non-ModelResponse types

- Add debug logging when skipping non-text responses (TTS, images, etc.)
- Improve docstring to clarify behavior for non-text responses
- Add test coverage for non-ModelResponse handling
- Ensure guardrail gracefully skips processing for response types it cannot handle
2025-07-18 12:51:09 -07:00
Krish Dholakia 5004b915d1 Guardrails AI - support llmOutput based guardrails as pre-call hooks (#12674)
* build: move build_and_test to use prisma migrate

* fix(guardrails_ai.py): default to guardrail accepting 'llmOutput' as the input param

enables same guardrail to work for pre call and post call

* fix(__init__.py): set default value

* fix(guardrails_ai.py): updates

* fix: fix linting error
2025-07-18 11:31:30 -07:00
Jugal D. Bhatt a112ec5b02 Health check app on separate port (#12718)
* add separate health app

* add new docs

* refactor

* fix colons

* Update config_settings.md

* refactor

* docs

* add unit test

* added supervisord

* remove app

* add supervisor conf

* Add markdown

* add video to md

* remove test

* docs build failure

* add to all docker files, change prod.md and add tests

* change dockerfiles

* remove extra file

* remove extra file

* remove extra file

* change apt->apk

* remove rdb file

* add fixed file
2025-07-18 11:17:15 -07:00
Cole McIntosh 491555d32d fix(test_team_endpoints.py): fix AsyncMock error in test_new_team_with_object_permission (#12730)
Replace MagicMock with AsyncMock for litellm_teamtable.update to fix:
TypeError: object MagicMock can't be used in 'await' expression

The test was failing because it tried to await a MagicMock object.
Added AsyncMock for the update method to properly handle async operations.
2025-07-18 07:25:16 -07:00
Krish Dholakia b77c9f5de2 fix(team_endpoints.py): ensure user id correctly added when new team … (#12719)
* fix(team_endpoints.py): ensure user id correctly added when new team created with user email as member

Fixes issue where user not correctly added to team on /team/new

* fix(internal_user_endpoints.py): make user email validation check case insensitive

Fixes issue where uppercase email was added even when lowercase email existed

* test: update test
2025-07-17 22:31:44 -07:00
Krish Dholakia b515d051ff Litellm encrypt admin UI values (#12675)
* build: move build_and_test to use prisma migrate

* feat(proxy_setting_endpoints.py): encrypt env var before storing in db

Ensures env var can be read when loaded in from DB

Fixes issue when trying to add SSO from admin UI

* test: update tests
2025-07-17 22:24:58 -07:00
Jugal D. Bhatt 4b09d0d517 [Liveness/Liveliness probe] add separate health app for liveness probes in files (#12669)
* add separate health app

* add new docs

* refactor

* fix colons

* Update config_settings.md

* refactor

* docs

* add unit test
2025-07-16 20:35:09 -07:00
Ishaan Jaff 43e7d5288f [Bug Fix] SCIM - add GET /ServiceProviderConfig (#12664)
* add scimv2 config endpoint

* test_get_service_provider_config
2025-07-16 15:43:25 -07:00
Jugal D. Bhatt 83b0c4cba7 [MCP Gateway] Allow MCP sse and http to have namespaced url for better segregation LIT-304 (#12658)
* fix tools fetch for keys

* Add namespacing in url

* add test for namespacing url

* helper method

* fix test
2025-07-16 14:47:45 -07:00
Cole McIntosh 79e4d77bcf fix: Handle circular references in spend tracking metadata JSON serialization (#12643)
* fix: Handle circular references in spend tracking metadata JSON serialization

- Fixes issue #12634 where circular references in metadata caused
  ValueError: Circular reference detected when logging spend data
- Adds _safe_json_dumps() function that detects and handles circular
  references by replacing them with placeholder strings
- Maintains full functionality for normal objects while preventing
  crashes from circular references
- Adds comprehensive tests for circular reference handling
- Critical fix for v1.74.3 stable release

* fix: Replace bare except clauses with specific Exception handling

- Fixes E722 linting errors in _safe_json_dumps function
- Maintains same error handling behavior while following best practices
- All tests continue to pass

* refactor: Use existing safe_dumps utility instead of custom implementation

- Replace custom _safe_json_dumps() with existing safe_dumps() from litellm_core_utils
- Remove duplicate code and leverage existing circular reference handling
- Update tests to use safe_dumps function
- Maintains same functionality while reducing code duplication
- All tests continue to pass
2025-07-16 07:24:41 -07:00
Marc Abramowitz 40ccd2b70f Add "keys import" command to CLI (#12620)
* Add "keys import" command to CLI

E.g.:

```
litellm-proxy keys import \
  --source-base-url=https://old-litellm.company.com \
  --source-api-key=$LITELLM_KEY \
  --dry-run
```

* Add --created-since option

* Add tests

* Fix lint errors

* Fix lint issues

* Fix lint errors

* Fix response.raise_for_status not being a thing

* Fix a mypy error
2025-07-15 20:14:43 -07:00
Ishaan Jaff 46c950b17b [Bug Fix] Add swagger docs for LiteLLM /chat/completions, /embeddings, /responses (#12618)
* update ProxyChatCompletionRequest

* use custom OpenAPI schema

* use customize_openapi_schema

* add_llm_api_request_schema_body

* add embeddings and response spec

* fix add_llm_api_request_schema_body

* TestCustomOpenAPISpec

* fixes linting

* fix linting

* bump timeout
2025-07-15 13:37:22 -07:00
Ishaan Jaff d2fe8894c8 [Bug Fix] Include /mcp in list of available routes on proxy (#12612)
* create GetRoutes helper class

* update get routes

* TestGetRoutes

* fix get_routes_for_mounted_app
2025-07-15 09:24:48 -07:00