Commit graph

8121 commits

Author SHA1 Message Date
Ariel
647f2f5d86
[feat]: graceful degradation for pillar service when using litellm (#15857)
* graceful degradation for pillar service when using litellm

* remove unnecessary mode

* simplify docs

* final fixes

* lint fixes

* fix linting
2025-10-27 19:51:29 -07:00
Katsuhiro Muto
2074b4d662
Fix: Support tool usage messages with Langfuse OTEL integration (#15932)
* Log tool use in langfuse otel integration

* Add test for logging function calling

---------

Co-authored-by: eycjur <eycjur@example.com>
2025-10-27 19:47:31 -07:00
YutaSaito
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
Ishaan Jaff
4cef208c5f
[Fix] - Responses API - add /openai routes for responses API. (Azure OpenAI SDK Compatibility) (#15988)
* add /openai routes for responses API

* TestResponsesAPIEndpoints
2025-10-27 19:12:13 -07:00
Ishaan Jaff
0bb53f5048
[Fix] Azure OpenAI - Add handling for v1 under azure api versions (#15984)
* fix _is_azure_v1_api_version

* test_is_azure_v1_api_version
2025-10-27 13:45:44 -07:00
Ishaan Jaff
02df4c6b30
[Fix] DD logging - ensure key's metadata + guardrail is logged on DD (#15980)
* fix get_sanitized_user_information_from_key

* test_get_sanitized_user_information_from_key_includes_guardrails_metadata
2025-10-27 13:45:09 -07:00
Ishaan Jaff
20f9e189fb
[Buf fix] - Azure OpenAI, fix ContextWindowExceededError is not mapped from Azure openai errors (#15981)
* fix is_error_str_context_window_exceeded

* test_is_error_str_context_window_exceeded
2025-10-27 13:44:55 -07:00
pinkgu
4758e2998b
feat: support during_call for model armor guardrails (#15970)
Signed-off-by: bjornjee <bjornjee95@gmail.com>
2025-10-27 13:34:59 -07:00
YutaSaito
c0890e7d33
[Feat] add support for dynamic client registration (#15921) (enables Atlassian MCP to work via Oauth on LiteLLM)
* feat: add support for dynamic client registration #13856

* fix: test

* feat: return 401 when oauth2_header is missing for OAuth2-based MCP servers
2025-10-26 10:13:46 -07:00
Ishaan Jaffer
cd0db19750 unstable test 2025-10-25 17:11:13 -07:00
Ishaan Jaffer
cbadcd4a77 TestPerplexityIntegration 2025-10-25 17:06:01 -07:00
Ishaan Jaffer
04ff660276 fixes exception handling 2025-10-25 16:55:16 -07:00
Krrish Dholakia
0f7e1acfc6 test: update tests 2025-10-25 16:14:19 -07:00
Krrish Dholakia
3c0df6a2da test: update unit testing 2025-10-25 16:09:53 -07:00
Krrish Dholakia
da3988b768 fix: fix test 2025-10-25 15:43:16 -07:00
Krish Dholakia
346e036399
fix(opentelemetry.py): fix issue where headers were not being split correctly + feat(bedrock): add titan image generations w/ cost tracking (#15916)
* fix(opentelemetry.py): fix issue where headers were not being split correctly

* feat(bedrock/image): Support bedrock titan image generation

Closes https://github.com/BerriAI/litellm/issues/361

* build(model_prices_and_context_window.json): track titan image gen pricing

enables cost tracking per request

* feat(amazon_titan_transformation.py): support titan image generation cost tracking

* docs: document new model

* docs: update docs to indicate cost tracking + refactor rerank into separate doc

* fix: fix mypy linting error

* fix: fix type ignore
2025-10-25 13:45:13 -07:00
Krish Dholakia
72bbdfd3f3
(security) Responses API - prevent User A from retrieving User B's response, if response.id is leaked (#15757)
* feat(responses_id_security.py): encrypt response.id - prevent user A from retrieving user B's response

additional security for retrievals on shared accounts

Closes LIT-1307

* feat(responses_id_security.py): allow admin to disable responses id security check

* test: add initial unit testing

* feat(responses_id_security.py): add streaming support

* docs: document new param

* docs: document new param

* feat(responses_id_security.py): add team id checks - ensure it works for service accounts

prevent service accounts keys from different teams from accessing each other's responses

more secure

* test: add unit testing

* fix: fix linting error
2025-10-25 13:41:59 -07:00
Krish Dholakia
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 Dholakia
2bd41dc034
Guardrails - Responses API, Image Gen, Text completions, Audio transcriptions, Audio Speech, Rerank, Anthropic Messages API support via the unified apply_guardrails function (#15706)
* fix(presidio.py): handle content as a list of texts

covers openai + anthropic messages api

* fix(presidio.py): safe get messages

* test: add unit testing for presidio guardrails

* fix(unified_guardrail.py): initial commit

* fix(enkryptai.py): implement apply_guardrail to enkrypt guardrail

* fix(unified_guardrail.py): support unified guardrail on input

* feat(unified_guardrail.py): add post call success hook implementation

allows us to just have 1 place to handle llm translation to guardrail api spec

* refactor: refactor initial unified guardrail component

* refactor: more refactoring

* feat(responses/): add guardrails to responses api

allows existing guardrails to work for new llm endpoints

* docs(adding_guardrail_support.md): document new guardrail endpoint support

* test: add unit tests

* feat(image_generation/): add guardrail support for image generation endpoint

* feat(openai/text_completion): support guardrails on `/v1/completions` API

* docs: document guardrails support on new endpoints

* docs: clarify when guardrails run

* feat(openai/speech): add guardrail support for input

* docs(rerank/): add guardrail support on input query

* fix: fix ruff check
2025-10-25 13:38:57 -07:00
Krrish Dholakia
b90e916c68 build: squash merge litellm_dev_10_10_2025_p1 2025-10-25 12:21:12 -07:00
Krish Dholakia
1543891763
Responses API - support tags in metadata
* fix(ui/): fix routing for custom server root path

* fix: fix eslint errors

* fix(vector_store_pre_call_hook.py): Fix https://github.com/BerriAI/litellm/issues/15724

* fix(responses/main.py): have 'tags' work across metadata + litellm_metadata

* fix: add unit testing
2025-10-25 12:07:54 -07:00
Ishaan Jaffer
0bedf1c0a7 fix tests 2025-10-25 10:19:24 -07:00
Shadi
8a5ff84e49
fixed lasso import config, redis cluster hash tags for test keys (#15917) 2025-10-24 14:31:59 -07:00
Sam Chou
a173232f8c
Fix MLFlow tags - split request_tags into (key, val) if request_tag has colon (#15914)
* Fix mlflow tags - split request_tags into (key, val) if request_tag has colon

* Redundant name: tag_dict -> tags
2025-10-24 12:57:15 -07:00
Carlo Alberto Ferraris
8b1424166b
attempt to avoid/minimize deadlocks (#15281)
Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
2025-10-24 12:22:38 -07:00
Sameer Kankute
0f9996a4d0
Litellm sameer oct staging (#15806)
* Addd v2/chat support for cohere

* fix streaming

* Use v2_transformation for logging passthrough:

* Use v2_transformation for logging passthrough:

* Add test for checking if document and citation_options is getting passed

* Update the cohere model

* Add cost tracking for vertex ai passthrough batch jobs

* Add full passthrough support

* refactor code according to the comments

* Add passthrough handler

* remove invalid params

* Updated documentation

* Updated documentation

* Updated documentation

* Correct the import

* Add openai videos generation and retrieval support

* add retrieval endpoint

* Add docs

* Add imports

* remove orjson

* remove double import

* fix openai videos format

* remove mock code

* remove not required comments

* Add tests

* Add tests

* Add other video endpoints

* Fix cost calculation and transformation

* Fixed mypy tests

* remove not used imports

* fix documentation for get batch req (#15742)

* Add grounding info to responses API (#15737)

* Add grounding info to responses API

* fix lint errors

* Use typed objects for annotations

* Use typed objects for annotations

* fix mypy error

* Litellm fix json serialize alreting 2 (#15741)

* fix json serializable error for alerts

* Add test

* fix mypt errors

* fix mypt errors

* Add Qwen3 imported model support for AWS Bedrock (#15783)

* Add qwen imported model support

* fix mypy errors

* fix empty user message error (#15784)

* fix typed dict for list

* Add azure supported videos endpoint

* fix mapped tests

* add azure sora models to model map

* Add OpenAI video generation and content retrieval support (#15745)

* Add openai videos generation and retrieval support

* add retrieval endpoint

* Add docs

* Add imports

* remove orjson

* remove double import

* fix openai videos format

* remove mock code

* remove not required comments

* Add tests

* Add tests

* Add other video endpoints

* Fix cost calculation and transformation

* Fixed mypy tests

* remove not used imports

* fix typed dict for list

* fix mypy errors

* move directory

* make v2 chat default

* Fix mypy tests

* Fix mypy tests

* Fix mypy tests

* Fix mypy tests

* Revert "Add Azure Video Generation Support with Sora Integration"

* refactor videos repo

* add test

* Add azure openai videos support

* Add azure openai videos support

* Add router endpoint support for videos

* fix mypy error

* add azure models

* fix mapped test

* fix mypy error

* Add proxy router test

* Add proxy router test

* remove deprecated model name from tests

* fix import error

* fix import error

* Add gaurdrail integration in videos endpoint

* Add logging support for videos endpoint

* Add final documentation supporting videos integration

* fix model name and document input

* Update literals to avoid mypy errors

* Remove unused imports and print statements

* revert guardrail support for video generation and video remix

* revert guardrail support for video generation and video remix

* Fix failing mapped and llm translation tests
2025-10-24 12:17:22 -07:00
oroxenberg
c793bd5ba9
Lasso Security Guardrail: Add v3 API Support (#12452)
* 1. add v3 classify
2. add new classifix for masking
3. support same id for the conversation for pre and post
working with duplicates

* clean code, remove some debug and run tests

* update liter errors

* improvment for Code Organization, httpx Error Handling Specificity, Logging Improvements and Type

* transfer test test_lasso_guard_config to the new location

* Fix type hints and linting errors in lasso.py

- Add type: ignore for httpx module when None
- Fix return type issues in _handle_classification and _handle_masking
- Ensure masked_messages is not None before passing to _apply_masking_to_model_response
- Convert LassoResponse to dict for _log_masking_applied call
2025-10-24 11:03:58 -07:00
Byron Grogan
bf47c25de0
[fix] Pass user-defined headers and extra_headers to image-edit calls (#15811) 2025-10-23 15:08:10 -07:00
Krish Dholakia
e0c4baf66f
fix(ui/): fix routing for custom server root path (#15701)
* fix(ui/): fix routing for custom server root path

* fix: fix eslint errors
2025-10-23 13:59:29 -07:00
Jacob Linney
0644c20604
fix(vertex-ai): cost tracking for search spend (#15859) 2025-10-23 13:29:10 -07:00
Ishaan Jaff
6d947d7326
[Bug Fix] Exa Search API - ensure request params are sent to Exa AI (#15855)
* fix filter_out_litellm_params

* use filter_out_litellm_params

* test_filter_out_litellm_params
2025-10-23 11:56:30 -07:00
Ishaan Jaff
511d435f6f
[Bug Fix]: Hooks broken on /bedrock passthrough due to missing metadata (#15849)
* refactor handle_bedrock_passthrough_router_model

* test_bedrock_router_passthrough_metadata_initialization
2025-10-23 11:52:37 -07:00
Ishaan Jaffer
8e65f99ebb test fix TTS 2025-10-23 08:50:54 -07:00
Ishaan Jaffer
5498a8b099 test_ensure_initialize_azure_sdk_client_always_used 2025-10-23 08:50:39 -07:00
Ishaan Jaffer
74b8a1dbdf test_aaamodel_prices_and_context_window_json_is_valid 2025-10-23 08:47:08 -07:00
Ishaan Jaff
ec6a5ffa2d
[Fix] Azure AI Speech - Ensure voice is mapped from request body -> SSML body , allow sending role and style (#15810)
* update map_openai_params

* fix update voice transform

* fix text_to_speech_provider_config

* test_azure_ava_tts_with_custom_voice

* test Azure AVA style, role sent

* _build_express_as_element

* docs custom params

* build LANG

* fix transform

* fix transform

* fix speech

* docs update

* docs azure ai speech
2025-10-22 14:41:11 -07:00
Sameer Kankute
2ab2d15efc
Fix Token Spend is under budget for passthrough (#15805) 2025-10-22 10:55:22 -07:00
Roman G
eac3cba44f
Support for embeddings_by_type Response Format in Bedrock Cohere Embed v1 (#15707)
* feat(cohere): Enhance embedding transformation to support Bedrock's embeddings by type

* test(cohere): Add unit tests for embedding transformation responses
2025-10-22 09:32:11 -07:00
Ishaan Jaffer
e80bba83e3 test fix 2025-10-22 09:29:04 -07:00
soo-jin.kim
03e1d93199
fix: Apply max_connections configuration to Redis async client (#15797)
* fix: Apply max_connections configuration to Redis async client

- Add max_connections to available Redis cluster kwargs
- Add connection_pool parameter to get_redis_async_client()
- Pass connection_pool to Redis client if provided
- Prevents Redis connection exhaustion under high load

* test: Add tests for Redis max_connections feature

- Test max_connections is included in cluster kwargs
- Test connection_pool parameter is properly passed to async client
- Test async client works without connection_pool parameter

All 3 tests pass successfully
2025-10-22 09:19:08 -07:00
soo-jin.kim
8050995dbb
fix: Rename configured_cold_storage_logger to cold_storage_custom_logger (#15798)
- Change variable name in litellm/__init__.py from configured_cold_storage_logger to cold_storage_custom_logger
- Update all references across the codebase to use the new variable name
- This fixes silent failure of cold storage logging due to variable name mismatch
- Configuration files use cold_storage_custom_logger, code should match

Files updated:
- litellm/__init__.py
- litellm/litellm_core_utils/litellm_logging.py
- litellm/proxy/spend_tracking/cold_storage_handler.py
- litellm/responses/litellm_completion_transformation/session_handler.py
- tests/test_litellm/litellm_core_utils/test_litellm_logging.py
- tests/test_litellm/responses/litellm_completion_transformation/test_session_handler.py
2025-10-22 09:17:08 -07:00
Sameer Kankute
44495c0117
fix encrypted content error (#15782) 2025-10-21 23:29:48 -07:00
wenhua
b0ccc35a9c
fix(ollama): Enhance chunk parsing for empty responses without 'thinking' and improve error logging (#13333) (#15717) 2025-10-21 16:59:01 -07:00
Javier Garcia
b0a3a7c4fb
Add details in docs (#15721)
* Add details in docs

* add logic to set span attributes and unit tests

* Restore html files

* Remove html files

* Remove html files
2025-10-21 16:57:51 -07:00
Thomas Mildner
1cfc4624c3
[Feat] Add SENTRY_ENVIRONMENT configuration for Sentry integration (#15760)
* [Feat] Add SENTRY_ENVIRONMENT configuration for Sentry integration and corresponding tests

* [Refactor] Enhance test_sentry_environment by mocking sentry_sdk and improving environment handling

* [Fix] Update default SENTRY_ENVIRONMENT to 'production' and enhance test for Sentry integration

* [Fix] Update test_sentry_environment to verify correct handling of SENTRY_ENVIRONMENT values

* [Fix] Update test_sentry_environment to assert correct handling of production environment
2025-10-21 16:40:55 -07:00
YutaSaito
d79bdd491f
feat: add GraySwan Guardrails support (#15756) 2025-10-21 11:13:50 -07:00
Talal
46d55bd92a
fix: Add response_type + PKCE parameters to OAuth authorization endpoint (#15720)
* fix: Add response_type parameter to OAuth authorization endpoint

Fixes #15684

OAuth providers like Google require the response_type parameter during
the authorization flow. This commit adds response_type=code to the
authorization redirect parameters, which is required by the OAuth 2.0
specification (RFC 6749 Section 4.1.1).

Changes:
- Added response_type=code to authorization params in discoverable_endpoints.py
- Added test coverage for the response_type parameter

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

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

* fix oauth flow by forwarding code_challenge and forwarding code_verifier

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-21 09:43:19 -07:00
Tom Haynes
98f1d63508
use correct otel logger, and normalise otel paths (#15645) 2025-10-21 09:16:03 -07:00
Ishaan Jaffer
60fab591db rename test files 2025-10-20 18:00:17 -07:00
Ishaan Jaff
157739da01
[Bug]: Fix Incorrect status value in responses api with gemini (#15753)
* _map_chat_completion_finish_reason_to_responses_status

* test_transform_chat_completion_response_with_reasoning_content

* test_transform_chat_completion_response_output_item_status
2025-10-20 17:58:56 -07:00