Commit Graph

4741 Commits

Author SHA1 Message Date
Ishaan Jaff 3054b6ea60 [Feat] A2A Gateway - allow adding Azure Foundry Agents on UI (#17909)
* add CostConfigFields

* add CostConfigFields

* add output_cost_per_token

* refactor table

* add agent cost view

* add azure foundry fields

* add foundry logo

* fix: clean error

* fix utils

* fix agent edi

* add easter egg

* fix order

* test_handle_streaming_forwards_api_key

* fix forward api key down

* fix a2a send msg

* add A2a comparison on compare playground

* fix chat ui

* fix bedrock agentcore stream
2025-12-12 16:38:04 -08:00
Yuta Saito 864b61b433 fix: support ResponseFunctionToolCall in follow-up input 2025-12-13 07:55:13 +09:00
Yuta Saito 48579eafe3 fix: strip mcp server prefixes in responses 2025-12-13 07:17:50 +09:00
YutaSaito 8899b63fa4 Merge pull request #17747 from BerriAI/litellm_feat_mcp-chat-completions
feat: add support for using MCPs on /chat/completions
2025-12-13 05:05:21 +09:00
Cesar Garcia 1531b58493 feat(openai): add reasoning_effort='xhigh' support for gpt-5.2 models (#17875)
Add support for the 'xhigh' reasoning effort level on all gpt-5.2 model
variants, not just gpt-5.2-pro. This enables deeper reasoning capabilities
for the base gpt-5.2 model.

Changes:
- Add is_model_gpt_5_2_model() method to detect gpt-5.2 variants
- Update xhigh validation to allow gpt-5.2 models
- Update documentation with gpt-5.2 reasoning_effort support
- Update tests to reflect new behavior
2025-12-12 11:40:35 -08:00
Ishaan Jaff d38f241032 [Feat] JWT Auth - auth allow selecting team_id from request header (#17884)
* feat: add get_team_id_from_header for JWT Auth

* fix Auth builder JWT Auth

* test_get_team_id_from_header

* test_auth_builder_uses_team_from_header_e2e

* Select Team via Request Header
2025-12-12 10:18:20 -08:00
Sameer Kankute da81ab6d97 Merge pull request #17758 from BerriAI/litellm_managed_files_target_storage
Add v0 support for target storage
2025-12-12 22:26:34 +05:30
Sameer Kankute afda51d476 Merge pull request #17873 from BerriAI/litellm_rerank_foraward_headers
Add support for forwarding client headers in /rerank endpoint
2025-12-12 22:25:57 +05:30
Sameer Kankute d98ee8a448 Merge pull request #17872 from BerriAI/litellm_embedding_header_forwarding
fix: bedrock header forwarding with cutom api
2025-12-12 22:25:45 +05:30
Sameer Kankute abbf8be07b Merge pull request #17864 from BerriAI/litellm_fix_x-litellm-key-spend
Fix x-litellm-key-spend header update
2025-12-12 22:23:42 +05:30
Sameer Kankute e0428388a7 Merge pull request #17860 from BerriAI/litellm_openai_files_expire_after_support
Add support for expires after param in Files endpoint
2025-12-12 22:23:11 +05:30
Alexsander Hamir d9cf53b555 fix: remove dependency on database and redis from health test (#17880) 2025-12-12 08:21:48 -08:00
Alexsander Hamir c9063d13b1 Add health endpoint tests to CI with database and Redis support (#17877)
- Add database and Redis setup to litellm_mapped_tests_proxy job in CircleCI
- Create shared test helpers in tests/test_litellm/proxy/conftest.py for proxy test setup
- Refactor health endpoint tests to use shared helpers from conftest
- Support automatic Redis cache configuration when REDIS_HOST is set
- Ensure minimal config is created when Redis/database is needed
2025-12-12 07:35:50 -08:00
Devaj Mody f25344484f fix(router): add minimum request threshold for error rate cooldown (#17464)
Fixes #17418

  - Add DEFAULT_FAILURE_THRESHOLD_MINIMUM_REQUESTS constant (default: 5)
  - Require minimum requests before applying error rate cooldown
  - Prevents cooldown from triggering on first failure
2025-12-12 04:36:10 -08:00
Sameer Kankute d28160b2b2 Add tests for header forwarding 2025-12-12 17:54:17 +05:30
Ariel 5df701d15c [feat]: Add opt-in evidence results for Pillar Security guardrail during monitoring (#17812)
* add evidence headers to litellm

* ensure that evidence is surface-able, even in opt-in mode

* update the docs
2025-12-12 04:09:13 -08:00
Peter Chanthamynavong f8e7e153d5 fix(cache): handle string content in is_cached_message (#17853)
Fixes #17821

The `is_cached_message` function crashed with TypeError when message
content was a string instead of a list of content blocks.

Changes:
- Add explicit `isinstance(content, list)` check before iteration
- Add `isinstance(content_item, dict)` check inside loop to skip non-dict items
- Use `.get()` for safer nested dict access
- Follow same pattern as `extract_ttl_from_cached_messages` (same module)

Tests:
- Add TestIsCachedMessage class with 9 test cases covering:
  - String content (the reported bug)
  - None content
  - Missing content key
  - Empty list content
  - List with/without cache_control
  - Mixed content types (strings + dicts)
  - Wrong cache_control type
2025-12-12 03:59:52 -08:00
Vinnie Giarrusso 78012ad9a9 fix(prometheus): add 'exception_status' to prometheus logger (#17847)
* fix(prometheus): add 'exception_status' to prometheus logger

* use existing prometheuslogger

* remove unneeded test
2025-12-12 03:57:46 -08:00
nlineback e223cadb9f fix: add speechConfig to GenerationConfig for Gemini TTS (#17851)
Moved speechConfig from RequestBody to GenerationConfig TypedDict so that
TTS configuration survives the filtering in _transform_request_body().

This fixes the 400 INVALID_ARGUMENT error when using Gemini TTS models
(gemini-2.5-flash-tts, gemini-2.5-flash-preview-tts, etc.) with both
vertex_ai and gemini providers.

Fixes: speechConfig was being created correctly in map_openai_params()
but then filtered out because GenerationConfig.__annotations__.keys()
didn't include it.

Tested with both preview and non-preview TTS model names and both
vertex_ai and gemini providers.
2025-12-12 03:56:44 -08:00
Sameer Kankute 19b48d7bad fix: bedrock header forwarding with cutom api 2025-12-12 16:12:06 +05:30
Sameer Kankute caaf8a6784 Fix x-litellm-key-spend update 2025-12-12 11:44:51 +05:30
Sameer Kankute 49e0f8e95f Add support for expires after param 2025-12-12 10:01:18 +05:30
Cesar Garcia d693596e87 feat(langfuse): Add support for custom masking function (#17826)
* feat(langfuse): Add support for custom masking function

Allow users to pass a custom masking function via metadata to selectively
redact sensitive data (credit cards, emails, PII) before sending to Langfuse.

Usage:
```python
def mask_pii(data):
    if isinstance(data, str):
        data = re.sub(r'\b\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}\b', '[CARD]', data)
    return data

litellm.completion(
    model="gpt-4",
    messages=[...],
    metadata={"langfuse_masking_function": mask_pii}
)
```

* fix(langfuse): Isolate masking function from other logging integrations

Extract langfuse_masking_function from metadata early in the flow and store
it in a dedicated key (_langfuse_masking_function) that only the Langfuse
logger knows to look for. This prevents the callable from leaking to other
logging integrations (Datadog, S3, etc.) which would serialize it as
"<function at 0x...>".

Changes:
- scrub_sensitive_keys_in_metadata() now extracts and stores the function
- Langfuse logger looks in the dedicated key first, falls back to metadata
- Added tests to verify isolation works correctly
2025-12-11 15:36:54 -08:00
Yuge Zhang 1aed37b8ea Fix missing content in Anthropic to OpenAI conversion (#17693) 2025-12-11 15:31:47 -08:00
Cesar Garcia a037414985 feat(deepseek): add native support for thinking and reasoning_effort params (#17712)
* feat(deepseek): add native support for thinking and reasoning_effort params

Add proper parameter mapping for DeepSeek thinking mode, allowing users
to use the unified LiteLLM interface instead of extra_body workarounds.

Supported formats:
- thinking={"type": "enabled"}
- thinking={"type": "enabled", "budget_tokens": X} (budget_tokens ignored)
- reasoning_effort="low|medium|high" (maps to thinking enabled)

DeepSeek only supports {"type": "enabled"} without budget_tokens,
so any budget_tokens are stripped and all reasoning_effort values
(except "none") map to enabled.

Reference: https://api-docs.deepseek.com/guides/thinking_mode

* docs(deepseek): add thinking and reasoning_effort parameter documentation
2025-12-11 15:28:43 -08:00
Jason Roberts 6fc39d31b4 feat(guardrails): add configurable fail-open, timeout, and app_user to PANW Prisma AIRS guardrail (#17785)
Add configurable fail-open/fail-closed behavior, timeout settings, and app_user
metadata tracking. Includes security hardening, enhanced
observability (:unscanned header), and comprehensive test coverage (44/44 passing).

No breaking changes.
2025-12-11 15:23:59 -08:00
Ishaan Jaff cca21c0926 [Feat] New API Provider - Add Azure AI Foundry Agents on /chat/completions, /responses, /messages + Agent Gateway (#17845)
* init get_azure_ai_route

* init AzureAIAgentsConfig

* init AzureAIAgentsConfig

* AzureAIAgentsHandler

* test_azure_ai_agents_acompletion_non_streaming

* test_azure_ai_agents_acompletion_streaming

* fix stream

* _process_sse_stream

* Azure AI Foundry Agents

* init  Azure AI Foundry Agent

* fix code QA checks

* fix api key

* docs fix
2025-12-11 15:21:28 -08:00
Ishaan Jaff 8041e373d6 [Bug Fix] Watsonx Audio Transcription - ensure only correct params are sent to API (#17840)
* fix transform

* test_watsonx_transcription_only_user_params_sent
2025-12-11 15:21:09 -08:00
yuneng-jiang cb9bae1aba Merge pull request #16764 from BerriAI/litellm_tag_spend_dedupe
[Fix] Deduplicate /tag/daily/activity metadata
2025-12-11 15:20:16 -08:00
Dominic Fallows 756c60540e feat: add support for configurable confidence score thresholds and scope in Presidio PII masking (#17817)
* feat: add support for configurable confidence score thresholds in Presidio PII masking

* feat: enhance Presidio PII masking with configurable score thresholds and behavior documentation

* feat: add configurable output masking and filter scope for Presidio PII guardrail
2025-12-11 15:19:11 -08:00
yuneng-jiang 2a864e25f8 Merge pull request #17668 from BerriAI/litellm_sso_config_2
[Fix] Remove SSO Config Values from Config Table on SSO Update
2025-12-11 15:17:33 -08:00
yuneng-jiang de9a195d8c Merge pull request #17781 from BerriAI/litellm_daily_agent_table
[Feature] Daily Agent Usage Backend
2025-12-11 15:01:50 -08:00
mubashir1osmani 1b2ea270b4 fix: attach team to org table (#17832)
* fix: attach team to org table

* add test
2025-12-11 14:54:50 -08:00
Cesar Garcia f7425f297b fix(openai): use optimized async http client for text completions (#17831)
* fix(openai): use optimized async http client for text completions

OpenAITextCompletion.acompletion was using litellm.aclient_session directly
instead of the optimized http client with aiohttp transport that
OpenAIChatCompletion uses. This fixes inconsistent behavior where custom
SSL configs and the faster aiohttp transport were not applied to async
text completion requests.

Fixes #17676

* test(openai): add test for text completion async http client

Verify that OpenAITextCompletion.acompletion uses the optimized
BaseOpenAILLM._get_async_http_client() instead of litellm.aclient_session.

Related to #17676

* test: move http client test to existing test file

Move test_acompletion_uses_optimized_http_client to
test_text_completion_unit_tests.py instead of separate file.
2025-12-11 14:54:26 -08:00
Yuta Saito 8cccf3e9f0 fix: update MCP handler invocation to pass full call context from main.py 2025-12-12 06:41:58 +09:00
Alexsander Hamir e9baa83a0f [Fix] CI/CD – Clean Up Performance PR Changes & others (#17838) 2025-12-11 12:50:03 -08:00
Peter Dave Hello 70643a8b9c Add support for OpenAI GPT-5.2 models (#17836)
References:
- https://openai.com/index/introducing-gpt-5-2/
- https://platform.openai.com/docs/models/gpt-5.2
2025-12-11 12:49:30 -08:00
yuneng-jiang 26926d5fea Merge pull request #17804 from BerriAI/litellm_add_model_settings_fix
[Fix] Ensure Model Page Honors UI Settings
2025-12-11 09:20:28 -08:00
yuneng-jiang f9dc034c73 Merge pull request #17775 from BerriAI/litellm_sendgrid
[Feature] Sendgrid integration
2025-12-11 09:19:41 -08:00
YutaSaito e9571ddbc4 fix: MCP OAuth callback routing and URL handling (#17789)
* fix: MCP OAuth callback routing and URL handling

* test: add test for proxy_server
2025-12-11 08:22:59 -08:00
Cesar Garcia 6a3e6465ea fix(completion): transform image content in tool results for Responses API (#17799)
When using litellm.completion() with model="openai/responses/...", images
in tool message content were not being transformed from Chat Completion
format to Responses API format.

Chat Completion format: {"type": "image_url", "image_url": {"url": "..."}}
Responses API format: {"type": "input_image", "image_url": "..."}

This caused OpenAI to reject the request with error 400 since "image_url"
is not a valid type for function_call_output content.
2025-12-11 08:21:05 -08:00
Cesar Garcia 2e303bf556 fix(anthropic): capture web_search_tool_result in streaming for multi-turn conversations (#17798)
This fix addresses two issues with Anthropic web search streaming:

1. Fix trailing {} in tool call arguments
   - web_search_tool_result blocks have input_json_delta events that were
     incorrectly emitted as tool calls
   - Added current_content_block_type tracking to only emit tool calls for
     tool_use and server_tool_use blocks

2. Capture web_search_tool_result for multi-turn
   - The web_search_tool_result content comes ALL AT ONCE in content_block_start
   - Now captured in provider_specific_fields.web_search_results
   - stream_chunk_builder combines these for final message
   - Allows multi-turn conversations to work with streaming web search
2025-12-11 08:19:23 -08:00
YutaSaito 13df50830d chore: prefer standard trace id for Langfuse logging (#17791) 2025-12-11 08:18:45 -08:00
CyrusTC 5d326386fb feat(bedrock): add serviceTier support for Converse API (#17810)
Add support for the Bedrock Converse API serviceTier parameter to allow
specifying processing tier (priority, default, or flex).

Changes:
- Add ServiceTierBlock type in litellm/types/llms/bedrock.py
- Add serviceTier to CommonRequestObject
- Add serviceTier to get_config_blocks() in AmazonConverseConfig
- Add comprehensive tests for serviceTier functionality
- Add documentation for serviceTier usage

This allows users to configure service tier via:
- litellm_params in proxy config
- optional_params in SDK calls
2025-12-11 08:16:32 -08:00
Cesar Garcia 97be0da0d2 fix(azure_ai): Remove unsupported params from Azure AI Anthropic requests (#17822)
* fix(azure_ai): Remove unsupported params from Azure AI Anthropic requests

Azure AI Anthropic endpoint rejects max_retries and stream_options parameters
with "Extra inputs are not permitted" error. These are LiteLLM-internal
parameters that should not be sent to the API.

Fixes 400 Bad Request error when using azure_ai/claude-sonnet-4-5 and other
Azure AI Anthropic models.

* test(azure_ai): Add test for unsupported params removal in Azure AI Anthropic

Verifies that max_retries, stream_options, and extra_body are properly
removed from the request before sending to Azure AI Anthropic endpoint.
2025-12-11 08:09:13 -08:00
Ashton Sidhu a514313540 Add Hiddenlayer Guardrail Hooks (#17728)
* Core logic working, need to add tests

* Re add removed files

* Remove mistaken files

* one more file

* Add deployment params

* Add tests

* Remove unused imports

* Update docs from feedback

* Update guardrails
2025-12-11 07:43:26 -08:00
Sameer Kankute 7b1cef86a7 Add support for target_storage param 2025-12-11 15:08:17 +05:30
yuneng-jiang 7ca2c2abfc Adding tests 2025-12-10 21:37:38 -08:00
Sameer Kankute 8942053c8b Merge pull request #17700 from BerriAI/litellm_batches_passthrough_cost_tracking
Add anthropic retrieve batches and retreive file content support
2025-12-11 10:31:54 +05:30
yuneng-jiang 91056c1d7e Merge remote-tracking branch 'origin' into litellm_daily_agent_table 2025-12-10 20:47:58 -08:00