Commit Graph
4715 Commits
Author SHA1 Message Date
Cesar GarciaandGitHub 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 ZhangandGitHub 1aed37b8ea Fix missing content in Anthropic to OpenAI conversion (#17693) 2025-12-11 15:31:47 -08:00
Cesar GarciaandGitHub 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 RobertsandGitHub 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 JaffandGitHub 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 JaffandGitHub 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-jiangandGitHub 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 FallowsandGitHub 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-jiangandGitHub 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-jiangandGitHub de9a195d8c Merge pull request #17781 from BerriAI/litellm_daily_agent_table
[Feature] Daily Agent Usage Backend
2025-12-11 15:01:50 -08:00
mubashir1osmaniandGitHub 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 GarciaandGitHub 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
Alexsander HamirandGitHub e9baa83a0f [Fix] CI/CD – Clean Up Performance PR Changes & others (#17838) 2025-12-11 12:50:03 -08:00
Peter Dave HelloandGitHub 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-jiangandGitHub 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-jiangandGitHub f9dc034c73 Merge pull request #17775 from BerriAI/litellm_sendgrid
[Feature] Sendgrid integration
2025-12-11 09:19:41 -08:00
YutaSaitoandGitHub 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 GarciaandGitHub 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 GarciaandGitHub 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
YutaSaitoandGitHub 13df50830d chore: prefer standard trace id for Langfuse logging (#17791) 2025-12-11 08:18:45 -08:00
CyrusTCandGitHub 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 GarciaandGitHub 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 SidhuandGitHub 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
yuneng-jiang 7ca2c2abfc Adding tests 2025-12-10 21:37:38 -08:00
Sameer KankuteandGitHub 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
yuneng-jiang 1c6de2b80d Merge remote-tracking branch 'origin' into litellm_sendgrid 2025-12-10 20:39:25 -08:00
Sameer Kankute 9344d29a15 fix: Preserve systemInstructions for vertex ai generate content request 2025-12-11 09:52:32 +05:30
Sameer KankuteandGitHub 2ea855d225 Merge pull request #17707 from raghav-stripe/raghav-fix-responsesapi-rl
fix: responses api not applying tpm rate limits on api keys
2025-12-11 08:57:16 +05:30
Ishaan JaffandGitHub 4a7437ba5f [Feat] Agent Gateway - allow adding langgraph, bedrock agent core agents (#17802)
* fix: langgraph bridge streaming

* add public/agents/fields

* test_a2a_completion_bridge_non_streaming

* TestA2AStreamingTransformation

* AgentCredentialFieldMetadata

* add new logo

* refactor add agent

* fix add dynamic fields

* feat allow adding langgraph agent

* add langgraph provider

* stash

* add AgentCreateInfo

* agent_create_fields

* fix fields

* test_a2a_completion_bridge_bedrock_agentcore

* test_a2a_completion_bridge_bedrock_agentcore

* add public endpoints

* fix a2a endpoints

* fix dynamic fields
2025-12-10 19:13:50 -08:00
Sameer KankuteandGitHub ad5d94a82f Merge pull request #17771 from BerriAI/litellm_db_videos_issue
fix: respect videos content db creds
2025-12-11 08:27:43 +05:30
Ishaan JaffandGitHub 059fedbed5 [Feat] Agent Gateway - Track agent_id in SpendLogs (#17795)
* add agent_id in metadata in spend logs

* add agent_id in SpendLogsPayload

* add agent_id in SpendLogsPayload

* add _set_agent_id_on_logging_obj

* add agent id tracking in SpendLogs

* add agent id in spend logs

* fix create_a2a_client

* test_asend_message_passes_agent_id_to_callback

* test_get_logging_payload_includes_agent_id_from_kwargs

* test_asend_message_streaming_triggers_callbacks

* fix asend_message_streaming

* asend_message_streaming

* A2AStreamingIterator

* _handle_stream_message

* test_asend_message_streaming_propagates_metadata
2025-12-10 16:09:56 -08:00
Ishaan JaffandGitHub 5d456bcdc3 [Feat] UI SSO - allow fetching role from generic SSO provider (Keycloak) (#17787)
* fix ui SSO

* TestGenericResponseConvertorUserRole

* Assigning User Roles via SSO
2025-12-10 13:09:28 -08:00
Ishaan JaffandGitHub 7ad2a58dcd [Feat] A2a Gateway - allow using bedrock agentcore, langgraph agents with A2a Gateway (#17786)
* init LANGGRAPH

* init LangGraphConfig

* init LangGraphConfig types

* init langgraph

* init getting api base and key

* init transform langgraph

* fix SSE issues

* test_langgraph_acompletion_non_streaming

* add LangGraph to docs

* docs: Setting Up a Local LangGraph Server

* fix langgraph SSE

* fix import uuid

* init A2A to LiteLLM Completion Bridge

* add send message for bridge

* test_a2a_completion_bridge_non_streaming

* add A2ACompletionBridgeTransformation

* add a2a send message support

* init a2a bridge
2025-12-10 13:08:43 -08:00
Ishaan JaffandGitHub 49b91c4a35 [Feat] A2a gateway - Add cost per token pricing (#17780)
* fix calculate_a2a_cost

* add cost_per_query

* add test_asend_message_uses_cost_per_query

* fix: _initialize_slack_alerting_jobs

* feat: add token tracking for agents invoke

* add A2ARequestUtils

* add _set_usage_on_logging_obj

* test_asend_message_token_tracking

* add _handle_a2a_response_logging

* test_asend_message_streaming_token_tracking

* add A2AStreamingIterator

* add cost calculator for agents

* test_asend_message_uses_input_output_cost_per_token

* docs gix
2025-12-10 13:08:15 -08:00
Ishaan JaffandGitHub 5ee32167c0 [Feat] New Provider - add langgraph (#17783)
* init LANGGRAPH

* init LangGraphConfig

* init LangGraphConfig types

* init langgraph

* init getting api base and key

* init transform langgraph

* fix SSE issues

* test_langgraph_acompletion_non_streaming

* add LangGraph to docs

* docs: Setting Up a Local LangGraph Server

* fix langgraph SSE

* fix import uuid
2025-12-10 12:30:35 -08:00
yuneng-jiang 1cad479297 Daily Agent Usage Table WIP 2025-12-10 11:50:52 -08:00
Ishaan JaffandGitHub 7a33579af6 [Feat] Agent Gateway - Add cost per query for agent invocations (#17774)
* fix calculate_a2a_cost

* add cost_per_query

* add test_asend_message_uses_cost_per_query

* fix: _initialize_slack_alerting_jobs
2025-12-10 10:43:52 -08:00
yuneng-jiang 3d7c6cb690 Merge remote-tracking branch 'origin' into litellm_sendgrid 2025-12-10 10:42:47 -08:00
saisurya237andGitHub f3ead2c153 add a new feature fix to expose the team alias when authenticating th… (#17725)
* CLI SSO: show team aliases in team selection

* temp poetry lock fix

* add poetry.lock to gitignore

* Revert proxy_server background job refactor

* Revert proxy_server background job refactor

* rever gitignore and poetry lock file
2025-12-10 10:10:28 -08:00
yuneng-jiangandGitHub ba554a86b9 Merge pull request #16843 from BerriAI/litellm_allow_custom_mount_paths
[Feature] Allow Root Path to Redirect when Docs not on Root Path
2025-12-10 09:52:30 -08:00
Sameer Kankute 15e5a8251e fix: respect videos content db creds 2025-12-10 23:00:01 +05:30
Sameer KankuteandGitHub dea62e3f60 Merge pull request #17769 from BerriAI/litellm_test_fix
Fix nvdia and geminin tests
2025-12-10 22:29:04 +05:30
Sameer KankuteandGitHub 4c78c1afc8 Merge pull request #17756 from BerriAI/litellm_add_gemini_computer_use
Add support for computer use for gemini
2025-12-10 22:28:37 +05:30
Sameer Kankute ec30032bc3 Fix nvdia and geminin tests 2025-12-10 22:05:11 +05:30
Sameer Kankute 9e3a04a725 Add batch passthrough endpoint cost tracking for anthropic 2025-12-10 18:24:31 +05:30
Sameer Kankute b9d3d7c059 Add tests for file and batch feat for anthropic 2025-12-10 17:14:47 +05:30
Sameer KankuteandGitHub 0d2f8ce931 Merge pull request #17711 from BerriAI/litellm_add_additional_drop_params_support
feat: Add nested field removal support to additional_drop_params
2025-12-10 15:37:39 +05:30
Lucas SugiandGitHub c7fd8fabdb fix: Avoid error when we have just the tool_calls in input (#17753)
* fix: Avoid error when we have just the tool_calls in input

* fix: Remove the tool call validation

* feat: Add unit test
2025-12-09 22:59:59 -08:00
Krish DholakiaandGitHub b0a5a4b81d Arize Phoenix OSS - Prompt Management Integration (#17750)
* docs(prompt_management.md): document how to onboard prompts to litellm

* feat(arize_phoenix_prompt_manager.py): support new prompt management integration

allows users to connect arize phoenix prompt manager to litellm

* fix(proxy/utils.py): remove prompt variables to avoid re-processing prompt

* docs(arize_phoenix_prompts.md): document new prompt management integration
2025-12-09 22:53:42 -08:00