Commit graph

6027 commits

Author SHA1 Message Date
michelligabriele
558f01e848
fix(proxy): use return value from CustomLogger.async_post_call_success_hook (#19670)
* fix(proxy): use return value from CustomLogger.async_post_call_success_hook

Previously the return value was ignored for CustomLogger callbacks,
preventing users from modifying responses. Now the return value is
captured and used to replace the response (if not None), consistent
with CustomGuardrail and streaming iterator hook behavior.

Fixes issue with custom_callbacks not being able to inject data into
LLM responses.

* fix(proxy): also fix async_post_call_streaming_hook to use return value

Previously the streaming hook only used return values that started with
"data: " (SSE format). Now any non-None return value is used, consistent
with async_post_call_success_hook and streaming iterator hook behavior.

Added tests for streaming hook transformation.

---------

Co-authored-by: Gabriele Michelli <michelligabriele0@gmail.com>
2026-01-26 08:48:22 -08:00
Ephrim Stanley
caa2c57619 Fix /batches to return encoded ids (from managed objects table) 2026-01-26 10:36:43 -05:00
Tamir Kiviti
aa8134fee9
add timeout to onyx guardrail (#19731)
* add timeout to onyx guardrail

* add tests
2026-01-25 23:13:46 -08:00
Harshit Jain
79603b9c3a
fix: optimize logo fetching and resolve mcp import blockers (#19719) 2026-01-25 23:08:16 -08:00
Harshit Jain
344ea3d9f2
feat: add clientip and user agent in metrics (#19717)
* feat: add clientip and user agent in metrics

* fix: lint errors

* Add model id and other req labels

---------

Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
2026-01-25 23:07:19 -08:00
Harshit Jain
a65ac2af13
add callbacks and labels to prometheus (#19708) 2026-01-25 23:03:23 -08:00
jquinter
5666c725ce
Fix/non standard mcp url pattern (#19738)
* fix(mcp): Add standard MCP URL pattern support for OAuth discovery (#17272)

  OAuth discovery endpoints now support both URL patterns:
  - Standard MCP pattern: /mcp/{server_name} (new)
  - Legacy LiteLLM pattern: /{server_name}/mcp (backward compatible)

  The standard pattern is required by MCP-compliant clients like
  mcp-inspector and VSCode Copilot, which expect resource URLs
  following the /mcp/{server_name} convention per RFC 9728.

  Changes:
  - Add _build_oauth_protected_resource_response() helper
  - Add oauth_protected_resource_mcp_standard() endpoint
  - Add oauth_authorization_server_mcp_standard() endpoint
  - Keep legacy endpoints for backward compatibility
  - Add tests for both URL patterns

  Fixes #17272

* fix(mcp): Add standard MCP URL pattern support for OAuth discovery (#17272)

  OAuth discovery endpoints now support both URL patterns:
  - Standard MCP pattern: /mcp/{server_name} (new)
  - Legacy LiteLLM pattern: /{server_name}/mcp (backward compatible)

  The standard pattern is required by MCP-compliant clients like
  mcp-inspector and VSCode Copilot, which expect resource URLs
  following the /mcp/{server_name} convention per RFC 9728.

  Changes:
  - Add _build_oauth_protected_resource_response() helper
  - Add oauth_protected_resource_mcp_standard() endpoint
  - Add oauth_authorization_server_mcp_standard() endpoint
  - Keep legacy endpoints for backward compatibility
  - Add tests for both URL patterns

  Fixes #17272

* Test was relocated

* refactor(mcp): Extract helper methods from run_with_session to fix PLR0915

Split the large run_with_session method (55 statements) into smaller
helper methods to satisfy ruff's PLR0915 rule (max 50 statements):

- _create_transport_context(): Creates transport based on type
- _execute_session_operation(): Handles session lifecycle

Also changed cleanup exception handling from Exception to BaseException
to properly catch asyncio.CancelledError (which is a BaseException subclass
in Python 3.8+).

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

* test(mcp): Fix flaky test by mocking health_check_server

The test_mcp_server_manager_config_integration_with_database test was
making real network calls to fake URLs which caused timeouts and
CancelledError exceptions.

Fixed by mocking health_check_server to return a proper
LiteLLM_MCPServerTable object instead of making network calls.

* test(mcp): Fix skip condition to properly detect claude model names

The skip condition for missing API keys was checking for "anthropic" in
the model name, but the test uses "claude-haiku-4-5" which doesn't match.
Updated to check for both "anthropic" and "claude" model patterns.

Also added skip condition for OpenAI models when OPENAI_API_KEY is not set.

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

* test(mcp): Fix skip condition to properly detect claude model names

The skip condition for missing API keys was checking for "anthropic" in
the model name, but the test uses "claude-haiku-4-5" which doesn't match.
Updated to check for both "anthropic" and "claude" model patterns.

Also added skip condition for OpenAI models when OPENAI_API_KEY is not set.

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 23:00:53 -08:00
Jay Prajapati
582d324a76
fix(proxy): support slashes in google generateContent model names (#19737)
* fix(proxy): support slashes in google route params

* fix(proxy): extract google model ids with slashes

* test(proxy): cover google model ids with slashes
2026-01-25 22:59:50 -08:00
Harshit Jain
6df0406cf6
fix: args issue & refactor into helper function to reduce bloat for both(#19441) 2026-01-25 10:21:20 +05:30
Ishaan Jaffer
f148207b11 fix patch reliability mock tests 2026-01-24 17:37:17 -08:00
Ishaan Jaffer
73dd1bd97a test_stream_transformation_error_sync 2026-01-24 17:19:21 -08:00
Harshit Jain
05fdd099ba
fix(presidio): resolve runtime error by handling asyncio loops in bac… (#19714)
* fix(presidio): resolve runtime error by handling asyncio loops in background threads

* add test case for thread safety
2026-01-24 15:36:49 -08:00
Ishaan Jaffer
53d3868ff2 TestBedrockInvokeToolSearch 2026-01-24 15:36:30 -08:00
yuneng-jiang
99e9462ec9
Merge pull request #19713 from BerriAI/litellm_model_search_id_team
[Feature] UI - Model Page: Filter by Model ID and Team ID
2026-01-24 15:04:20 -08:00
yuneng-jiang
47810f1523 Model and Team filtering 2026-01-24 14:45:14 -08:00
Ishaan Jaffer
9f99e8231c test_retrieve_container_basic 2026-01-24 14:31:54 -08:00
Ishaan Jaffer
f2fd54ffcf test fixes 2026-01-24 14:27:56 -08:00
Ishaan Jaffer
d8e0c43a21 test fixes 2026-01-24 14:08:48 -08:00
Ishaan Jaffer
e4e76a4963 test_team_update_sc_2 2026-01-24 13:17:32 -08:00
Ishaan Jaffer
489c986cac test_hanging_request_azure 2026-01-24 13:14:48 -08:00
Ishaan Jaffer
a62ccd582d fix flaky tests 2026-01-24 13:04:20 -08:00
Ishaan Jaffer
31a4cb65bf test_get_default_unvicorn_init_args 2026-01-24 12:59:51 -08:00
Ishaan Jaffer
a7e26460d0 fix unstable tests 2026-01-24 11:15:16 -08:00
Ishaan Jaffer
bd38374a45 fix: FLAKY tests 2026-01-24 11:13:44 -08:00
Ishaan Jaffer
6710abd1fa test_web_search 2026-01-24 11:06:23 -08:00
Ishaan Jaffer
6587cd228b test_partner_models_httpx_streaming 2026-01-24 10:58:35 -08:00
yuneng-jiang
5e395db1dc
Merge pull request #19604 from BerriAI/litellm_team_update_org
[Fix] Team Update with Organization having All Proxy Models
2026-01-24 09:09:55 -08:00
yuneng-jiang
f88a32de05
Merge pull request #19622 from BerriAI/litellm_ui_model_backend
[Feature] UI - Models Page: Model Search
2026-01-24 09:09:03 -08:00
yuneng-jiang
b44ac6c682 Fixing ruff check 2026-01-24 09:08:29 -08:00
yuneng-jiang
63166c3acc fixing arize tests 2026-01-23 23:13:21 -08:00
yuneng-jiang
e1bb4ae280 deactivating non root tests 2026-01-23 22:55:36 -08:00
yuneng-jiang
86676142c9 Fixing failing tests 2026-01-23 22:33:00 -08:00
Harshit Jain
09b07df587
fix: propagate JWT auth metadata to OTEL spans (#19627) 2026-01-23 21:21:23 -08:00
jquinter
f43757f71b
Feature/guardrail model argument (#19619)
* [Feat] Add model parameter to Generic Guardrail API

Add model information to guardrail requests, allowing guardrails to make
model-specific security decisions.

Changes:
- Add `model` field to GenericGuardrailAPIInputs TypedDict
- Add `model` field to GenericGuardrailAPIRequest Pydantic model
- Update OpenAI and Anthropic handlers to pass model from request/response
- Add unit tests for model parameter handling

* [Feat] Add model parameter to all guardrail_translation handlers

Extend model parameter support to all guardrail handlers for consistent
implementation across all endpoint types:
- OpenAI Responses API (input/output + streaming)
- OpenAI Image Generation (input only)
- OpenAI Text Completion (input/output)
- OpenAI Text-to-Speech (input only)
- OpenAI Audio Transcription (output only)
- Cohere Rerank (input only)
- Pass-through Endpoints (input/output)
- MCP Server (input only)

This addresses the review feedback requesting consistent model parameter
handling across all guardrail_translation/handler.py files.

---------

Co-authored-by: Igal Boxerman <igal@pillar.security>
2026-01-23 20:48:42 -08:00
John Greek
4c5351f43b
[Fix] Password comparison with non-ASCII characters (#19559) (#19568) 2026-01-23 20:27:42 -08:00
Misha
de538456e3
feat: support role_mappings from environment variables (#19498)
* feat: support role_mappings from environment variables

* fix linter
2026-01-23 19:54:23 -08:00
Ishaan Jaff
a870722f65
[Feat] UI + Backend - Allow adding policies on Keys/Teams + Viewing on Info panels (#19688)
* ui for policy mgmt

* test_add_guardrails_from_policy_engine_accepts_dynamic_policies_and_pops_from_data
2026-01-23 19:03:44 -08:00
ryan-crabbe
d67d12fc54
perf: Add LRU caching to get_model_info for faster cost lookups (#19606)
- Add @lru_cache decorator to get_model_info() and _cached_get_model_info_helper()
- Update _invalidate_model_cost_lowercase_map() to clear these caches when model_cost changes
- Update test to call cache invalidation after modifying litellm.model_cost

Reduces get_model_cost_information from 46% to <1% of request handling time.
2026-01-23 17:26:45 -08:00
mubashir1osmani
8e060593bf
feat(vercel_ai_gateway): add embeddings support
feat(vercel_ai_gateway): add embeddings support
2026-01-23 18:28:25 -05:00
mubashir1osmani
c41963c949
fix: add openinference span kinds to arize phoenix
fix: add openinference span kinds to arize phoenix
2026-01-23 16:32:49 -05:00
yuneng-jiang
fbe5ae9e17 fixing flaky tests 2026-01-23 12:20:27 -08:00
yuneng-jiang
8b5b343841 attempt fix flaky tests 2026-01-23 12:10:08 -08:00
yuneng-jiang
647a6898a9 skipping non root tests entirely 2026-01-23 11:51:38 -08:00
yuneng-jiang
89bf7e50c4 skipping flaky tests 2026-01-23 11:43:39 -08:00
Chesars
1ac32992de fix(oci): serialize imageUrl as object for OCI GenAI API
OCI GenAI expects imageUrl to be an object with a 'url' property,
not a plain string. This was causing 400 errors when sending images.

Fixes #19589
2026-01-23 15:25:40 -03:00
Chesars
188c2315ad feat(vercel_ai_gateway): add embeddings support
Add support for /embeddings endpoint via Vercel AI Gateway.

Closes #19658

Changes:
- Add VercelAIGatewayEmbeddingConfig in litellm/llms/vercel_ai_gateway/embedding/
- Register provider in utils.py and main.py
- Add unit tests for embedding transformation
- Update documentation with embeddings examples

Usage:
```python
from litellm import embedding

response = embedding(
    model="vercel_ai_gateway/openai/text-embedding-3-small",
    input="Hello world",
    api_key="your-api-key"
)
```
2026-01-23 15:11:37 -03:00
xqe2011
ca8c2c3938
fix #19620: SSO user roles are not updated for existing users (#19621)
* Fix: SSO user roles are not updated for existing users
Fixes #19620

* Refactor: Remove redundant user_info retrieval in SSOAuthenticationHandler

* Test: add new tests for user creation and updates in get_user_info_from_db
2026-01-23 09:05:29 -08:00
Nikita Timofeev
e63537c6c1 Fix: ensure function content is valid JSON for GigaChat 2026-01-23 15:27:46 +00:00
Sameer Kankute
9894721285
Merge pull request #19548 from BerriAI/litellm_staging_01_22_2026
Litellm staging 01 22 2026
2026-01-23 20:03:11 +05:30
Sameer Kankute
23f7d4f0b0
Merge pull request #19645 from BerriAI/litellm_gigachat_big_fix
Add tool choice mapping for giga chat
2026-01-23 19:52:35 +05:30