Commit graph

8121 commits

Author SHA1 Message Date
yuneng-jiang
63166c3acc fixing arize tests 2026-01-23 23:13:21 -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
yuneng-jiang
8b5b343841 attempt fix flaky tests 2026-01-23 12:10:08 -08: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
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
YutaSaito
8ac1d96d90
Merge pull request #19634 from BerriAI/litellm_feat_hashicorp_rotate
[feat] hashicorp vault rotate support
2026-01-23 21:08:55 +09:00
Sameer Kankute
12463809bd
Merge pull request #19638 from BerriAI/main
merge main in stagin 1 22 26
2026-01-23 14:54:17 +05:30
Yuta Saito
695fbf4ec5 feat: hashicorp vault rotate support 2026-01-23 17:32:55 +09:00
Yuta Saito
919033a6d0 fix: include tool arguments in proxy_server_request for spend logs callbacks 2026-01-23 16:36:37 +09:00
YutaSaito
12bc66aa5b
Merge pull request #19623 from BerriAI/litellm_fix_completions_mcp_output_ordering
[fix] completions mcp output ordering
2026-01-23 15:56:02 +09:00
Yuta Saito
6a60b3d848 test: completions mcp output test 2026-01-23 15:17:14 +09:00
yuneng-jiang
3ee7aab5f2 All Models Backend Search 2026-01-22 22:00:22 -08:00
John Greek
26a2c90818
[Fix] Anthropic models on Azure AI cache pricing (#19532) (#19614) 2026-01-22 20:00:40 -08:00
Harshit Jain
69c8698e62
fix: pass through endpoints update registry (#19420)
* fix: pass through endpoints update registry

* add test case, fix lint error and comment to avoid confusion

* fix pass through endpoints test case
2026-01-22 19:57:48 -08:00
Harshit Jain
89ecdc405d
fix: recursive pydantic issue (#19531) 2026-01-22 19:56:41 -08:00
Harshit Jain
06a749708d
feat: add datadog cost management support and fix startup callback issue (#19584) 2026-01-22 19:52:14 -08:00
Ishaan Jaff
c23e4b87dc
[Feat] New LiteLLM Policy engine - create policies to manage guardrails, conditions - permissions per Key, Team (#19612)
* init PolicyMatcher

* TestPolicyMatcherGetMatchingPolicies

* TestPolicyMatcherGetMatchingPolicies

* feat: init PolicyResolver

* init resolver types

* init policy from config

* inint PolicyValidator

* validate policy

* init Architecture Diagram

* test_add_guardrails_from_policy_engine

* init _init_policy_engine

* test updates

* test fixws

* new attachment config

* simplify types

* TestPolicyResolverInheritance

* fix policy resolver

* fix policies

* fix applied policy

* docs fix

* docs fix

* fix linting + QA checks

* fix linting + QA fixes

* test fixes
2026-01-22 19:49:53 -08:00
Harshit Jain
1d04414f30
feat(datadog): add agent support for LLM Observability (#19574) 2026-01-22 19:49:22 -08:00
Cesar Garcia
6cf7bd7c0f
Fix gpt-image-1.5 cost calculation not including output image tokens (#19515)
Fixes #19508

The cost calculation for gpt-image-1.5 was not including image tokens
from output_tokens_details, causing costs to be underreported
(e.g., $0.046 instead of $0.14).

Root cause: The OpenAI image generation API uses Responses API naming
(input_tokens, output_tokens, output_tokens_details) but the cost
calculator expected Chat Completions API naming (prompt_tokens,
completion_tokens, completion_tokens_details).

Changes:
- convert_dict_to_response.py: Map Responses API fields to Chat
  Completions API fields and convert dicts to wrapper objects
- cost_calculator.py: Use usage directly if already transformed,
  avoiding double transformation that lost the wrapper objects
- Added test for gpt-image-1.5 output image token cost calculation
2026-01-22 19:42:15 -08:00
moh-dev-stack
65e943dc2b
Bugfix/19481 num retries env var type (#19507)
* Enhance error handling for num_retries in Router class to support string values. Add test case to verify conversion from string to int for deployment num_retries.

* Refactor Router class for improved readability by formatting long lines and enhancing exception handling tests for num_retries. Ensure consistent style in test cases for better maintainability.

* Update exception handling for num_retries in Router class to suppress mypy warnings. Add type ignore comment for clarity in type conversion from string to int.
2026-01-22 19:39:58 -08:00
ruanjiefeng
324f1f4682
add Vertex_AI llm credentials sensitive keywords "vertex_credentials" (#19551)
* add Vertex_AI  llm credentials sensitive keywords "vertex_credentials"

* Update test_litellm_logging.py add test case
2026-01-22 19:38:14 -08:00
jquinter
0622ce3f2c
Fix/nova grounding (#19598)
* added support for nova grounding for amazon nova model

* added citations support

* added integration tests

* removing test file

* refactor: Use web_search_options for Nova grounding instead of system_tool

---------

Co-authored-by: Juhie <juhiechandra@gmail.com>
Co-authored-by: Juhie <75068056+juhiechandra@users.noreply.github.com>
2026-01-22 19:34:29 -08:00
yuneng-jiang
f78fc4e0fe Fix org all proxy model case 2026-01-22 15:32:10 -08:00
mpcusack-altos
88f8f49e1d
fix(websearch_interception): filter internal kwargs before follow-up request (#19577)
The websearch interception handler was passing internal flags like
`_websearch_interception_converted_stream` to the follow-up LLM request.
This caused "Extra inputs are not permitted" errors from providers like
Bedrock that use strict Pydantic validation.

Fix: Filter out all kwargs starting with `_websearch_interception` prefix
before making the follow-up anthropic_messages.acreate() call.
2026-01-22 10:42:20 -08:00
Eric Cao
a51835dfcc
Metrics prometheus user team count (#19520)
* add user count and team count prometheus metrics

* rebase

* revert mistaken deletion
2026-01-22 08:17:15 -08:00
Sameer Kankute
842e5b3ad6
Merge pull request #19560 from BerriAI/litellm_bedrock_invoke_structured_output
[Feat] Add support for output formatfor bedrock invoke via v1/messages
2026-01-22 19:44:48 +05:30
Sameer Kankute
c78c878822
Merge pull request #19558 from BerriAI/litellm_gemini_vertexai_mapping
Add custom vertex ai mapping to the output
2026-01-22 19:44:32 +05:30
Sameer Kankute
73715ab417
Merge pull request #19556 from BerriAI/litellm_fix_gemini_batch_jan22
Fix: generation config empty for batch
2026-01-22 19:44:26 +05:30
Sameer Kankute
f312bf23d0 Fix:test_multiple_function_call 2026-01-22 19:34:54 +05:30
Sameer Kankute
991fee056f Fix batch tests 2026-01-22 19:23:32 +05:30
Yuta Saito
8a622c51f5 feat: Add MCP tools response to chat completions 2026-01-22 19:23:32 +05:30
Sameer Kankute
ad1edd38d5
Merge branch 'main' into litellm_staging_01_21_2026 2026-01-22 17:56:40 +05:30
Sameer Kankute
24faca9bcf Add support for output formatfor bedrock invoke via v1/messages 2026-01-22 16:36:03 +05:30
Sameer Kankute
18240662db Add custom vertex ai mapping to the output 2026-01-22 15:18:24 +05:30
Yuta Saito
ed67bf2705 feat: Add MCP tools response to chat completions 2026-01-22 15:32:04 +09:00
Will Chen
9f57eb3e74
Fix Azure AI costs for Anthropic models (#19530)
* Fix Azure AI cost calculation

* fixup
2026-01-21 21:10:27 -08:00
Emerson Gomes
a3f7f5858b
Fix date overflow/division by zero in proxy utils (#19527)
* Fix date overflow/division by zero in proxy utils

* Fix projected spend calculation

* Strengthen projected spend tests
2026-01-21 21:09:57 -08:00
Yogeshwaran Ravichandran
ab274ac3c4
fix(azure response api): flatten tools for responses api to support nested definitions (#19526)
The Azure Responses API uses a different schema (flattened) for tools compared to the standard OpenAI/Azure Chat Completions API (nested). This caused a `BadRequestError` when users passed standard tool definitions.

Changes:
- Implemented tool flattening logic in `AzureOpenAIResponsesAPIConfig.transform_responses_api_request`.
- Added comprehensive unit tests in test_azure_transformation.py to verify nested-to-flat transformation, pass-through of flat tools, and immutability.
- Ensures cross-provider compatibility for tool definitions.

Fixes #19523
2026-01-21 21:08:28 -08:00
João Dinis Ferreira
60840ea292
fix(bedrock): correct streaming choice index for tool calls (#19506)
Bedrock's contentBlockIndex identifies content blocks within a message
(text=0, tool_call=1), not OpenAI's choice index (which varies with n>1).
This caused OpenAI SDK's ChatCompletionAccumulator to fail when tool call
chunks arrived on index 1 while finish_reason arrived on index 0.

Bedrock doesn't support n>1 (no such parameter exists):
https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_InferenceConfiguration.html

OpenAI choice index spec:
https://platform.openai.com/docs/api-reference/chat/streaming
2026-01-21 20:57:14 -08:00
Harshit Jain
746414eb9b
Fix/per service ssl override v2 (#19538)
* refactor(ssl): support per-service SSL verification overrides

* add test cases for ssl
2026-01-21 20:10:04 -08:00
davida-ps
7777aeb695
fixing prompt-security's guardrail implementation (#19374)
* Consolidated change

* fix(prompt_security): update message processing to persist sanitized files and filter for API calls

* fix per krrishdholakia suggestion
2026-01-21 20:09:40 -08:00
jay prajapati
363b0cc132
fix(azure): preserve content_policy_violation details for images (#19328) (#19372)
Azure OpenAI Images (DALL·E 3) returns policy violations as a structured payload under body["error"], including inner_error.content_filter_results and revised_prompt.

LiteLLM previously:
- Failed to extract nested error messages (get_error_message only handled body["message"])
- Missed policy violation detection when error strings were generic
- Dropped inner_error details when raising ContentPolicyViolationError

This change:
- Extracts nested Azure error fields (code/type/message + inner_error)
- Detects policy violations via structured error codes
- Passes an OpenAI-style error body + provider_specific_fields to preserve details

Tests:
- python3 -m pytest tests/test_litellm/llms/azure/test_azure_exception_mapping.py
- python3 -m pytest tests/test_litellm/litellm_core_utils/test_exception_mapping_utils.py

Fixes #19328
2026-01-21 20:06:51 -08:00
jay prajapati
0e738a5027
fix(mcp): forward static_headers to MCP servers (#19341) (#19366)
Forward static_headers from /mcp-rest/test/* routes into the MCP client so headers are present during session.initialize() and tool discovery.

Also add a shared merge_mcp_headers() helper to keep header precedence consistent and ensure OpenAPI-to-MCP generated tools include static_headers.

Tests:
- pytest tests/test_litellm/proxy/_experimental/mcp_server/test_rest_endpoints.py
- pytest tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py -k register_openapi_tools_includes_static_headers

Fixes #19341

Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
2026-01-21 19:30:55 -08:00