Commit Graph

28657 Commits

Author SHA1 Message Date
Sameer Kankute bdb8c169be Merge pull request #17818 from BerriAI/litellm_openai_package_bump
bump openai package to 2.9.0
2025-12-12 08:38:22 +05:30
ryan-crabbe 4a8629ce8b updated docs links for mistral and anthropic (#17852) 2025-12-11 17:57:56 -08:00
yuneng-jiang 4f79a026ad Merge pull request #17854 from BerriAI/litellm_ui_usage_select
[Feature] UI - Usage Page View Select
2025-12-11 17:57:23 -08:00
yuneng-jiang 3f1473d9a2 fixing build 2025-12-11 17:49:06 -08:00
yuneng-jiang ac52d2aeef tests 2025-12-11 17:47:11 -08:00
yuneng-jiang dfdd74f9ac Usage View Select 2025-12-11 17:37:09 -08:00
yuneng-jiang a48f048219 Merge pull request #17848 from BerriAI/litellm_ui_usage_refactor
[Refactor] UI - Usage Page Components
2025-12-11 16:43:11 -08:00
yuneng-jiang 0635b1cbf0 rename 2025-12-11 16:33:23 -08:00
yuneng-jiang 52cb54968a Change to useAuthorized hook 2025-12-11 16:28:03 -08:00
yuneng-jiang c1c8a6937e Renaming + fixing tests 2025-12-11 16:11:09 -08:00
Krish Dholakia 7e58931ec1 Prompt Management - new API for integrating providers (#17829)
* Prompt Management API - new API to interact with Prompt Management integrations (no PR required) (#17800)

* feat: initial commit adding prompt management api

* feat: initial commit adding prompt management api

* fix: refactoring to make sure get prompt is async

* fix: additional fixes

* fix: partially working generic api prompt management
2025-12-11 15:43:40 -08:00
yuneng-jiang 424934296f adding all files 2025-12-11 15:40:26 -08:00
yuneng-jiang 4e20f0793f Move Usage into its own folder 2025-12-11 15:37:39 -08:00
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
jichmi a13ee39da2 fix: update pricing for global.anthropic.claude-haiku-4-5-20251001-v1:0 (#17703)
* fix: update pricing for global.anthropic.claude-haiku-4-5-20251001-v1:0

* Update cache_creation_input_token_cost value
2025-12-11 15:29:46 -08:00
Cesar Garcia a2f5174941 fix: use Union syntax for Python 3.9 compatibility (#17714)
Replace `str | List[str]` with `Union[str, List[str]]` in
EmbeddingInput model to support Python 3.9.

The pipe union syntax (PEP 604) is only available in Python 3.10+,
but LiteLLM supports Python >=3.9.

Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
2025-12-11 15:29:16 -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
Peter Chanthamynavong df9a644e37 fix: add Python 3.14 support via grpcio version constraints (#17666)
* fix: add Python 3.14 support via grpcio version constraints

Updates grpcio dependency to support Python 3.14 while maintaining
backward compatibility:

- Python <3.14: grpcio >=1.62.3,<1.68.0 (avoids buggy 1.68.x versions)
- Python >=3.14: grpcio >=1.75.0 (has cp314 wheels + bug fix)

The grpc/grpc#38290 bug was fixed in grpcio 1.75.0+, which also
added Python 3.14 wheel support.

Fixes #15504
Fixes #17374

* chore: regenerate poetry.lock

Update lock file to match pyproject.toml changes for grpcio
Python 3.14 conditional dependency.
2025-12-11 15:24:48 -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 d2141096dc Merge pull request #17797 from BerriAI/litellm_ui_agent_usage
[Feature] Agent Usage UI
2025-12-11 15:03:21 -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
Alexsander Hamir 15404db3d0 [Fix] CI/CD – Docs & Spend logs (#17843)
* fix: resolve mypy type errors in hiddenlayer guardrail and transformation

- Fix return type of apply_guardrail from str to GenericGuardrailAPIInputs
- Add None checks for logging_obj before accessing attributes
- Convert AllMessageValues to dict format for HiddenLayer API compatibility
- Fix payload type annotation in _call_hiddenlayer
- Ensure transformed_output always returns list[dict[str, Any]] in transformation.py

* fix: use litellm_call_id as trace_id fallback in langfuse logging

- Only use standard_logging_object.trace_id if explicitly set via litellm_session_id or litellm_trace_id params
- Fallback to litellm_call_id when no explicit trace_id is provided (matches test expectation)
- Return the trace_id we set instead of generation_client.trace_id for consistency
- Add warning if langfuse modifies the trace_id to help debug potential issues

Fixes test_logging_trace_id test failure where auto-generated UUID was used instead of litellm_call_id

* fix: document envs

* fix: handle None response in /spend/logs endpoint when no records found

- Return empty list [] instead of [None] when spend_log is None
- Prevents 500 errors when querying by request_id, api_key, or user_id with no matching records
- Fixes test_chat_completion_bad_model_with_spend_logs test failure

* fix: use standard_logging_object trace_id when available in langfuse logger

- Fix trace_id selection logic to use standard_logging_object.trace_id when available
- Previously only used standard_logging_object.trace_id if explicitly set via params
- Now uses standard_logging_object.trace_id whenever it's present, matching test expectations
- Falls back to litellm_call_id if no trace_id is found
- Fixes test_log_langfuse_v2_uses_standard_trace_id_when_available test failure
2025-12-11 14:00:33 -08: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 a7c9f7247a Merge pull request #17834 from BerriAI/litellm_ui_team_model_fix
[Fix] Create Team Model Dropdown Honors Organization's Models
2025-12-11 11:44:10 -08:00
yuneng-jiang 6e99faeced Create Team Model Dropdown fix 2025-12-11 10:16:42 -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
Krrish Dholakia 917997cf79 fix: remove dead file 2025-12-11 08:27:55 -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 3de46889bb Merge pull request #17805 from BerriAI/litellm_fix_azure_anthropic_model_map
Fix llm provider for azure_ai in model map
2025-12-11 16:04:11 +05:30
Sameer Kankute 118a06ddfb bump openai package to 2.9.0 2025-12-11 16:01:52 +05:30
Sameer Kankute 51065295ba Fix llm provider for azure_ai in model map 2025-12-11 11:36:56 +05:30
yuneng-jiang 7ca2c2abfc Adding tests 2025-12-10 21:37:38 -08:00
yuneng-jiang 6f6a8f782e Fix UI settings 2025-12-10 21:31:35 -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