Commit graph

828 commits

Author SHA1 Message Date
Alexsander Hamir
53a1f2d21c
perf(prometheus): parallelize budget metrics, fix caching bug, reduce CPU by ~40% (#20544) 2026-02-06 09:18:24 -08:00
Sameer Kankute
05ce4c68e5 Fix: test_vertex_ai_partner_models_anthropic_remove_prompt_caching_scope_beta_header 2026-02-06 18:34:57 +05:30
Sameer Kankute
358a081f63 Add compaction support for vertex ai 2026-02-06 12:52:28 +05:30
Sameer Kankute
d0444f402c Add test for compaction in anthropic 2026-02-06 12:52:28 +05:30
Sameer Kankute
186fd2e64e Add adaptive thinking support for anthropic opus 4.6 2026-02-06 09:24:43 +05:30
Shivam Rawat
93cf1ef517
Merge pull request #20535 from BerriAI/litellm_move_anthropic_test_script
[Chore] Move anthropic input/output test to right folder
2026-02-05 16:12:08 -08:00
shivam
3dc70c3398 moved the test anthropic file 2026-02-05 15:44:24 -08:00
Ishaan Jaff
887a907e42
[Fix] Guardrails API - Ensure OpenAI Moderations Guard works with OpenAI Embeddings (#20523)
* init OpenAIEmbeddingsHandler

* init apply_guardrail

* use apply guardrails for OpenAI moderations

* test_embeddings_handler_string_input

* test_openai_moderation_guardrail_apply_guardrail

* fix typing

* test_openai_moderation_responses_api_input_field

* test fixes
2026-02-05 14:40:15 -08:00
shin-bot-litellm
1d92968e17
Fix test isolation for test_watsonx_gpt_oss_prompt_transformation (#20474)
Set cached tokenizer config directly and mock both sync and async
tokenizer functions to avoid race conditions when running with
parallel test execution (-n 16).

The issue was that parallel tests could populate the
litellm.known_tokenizer_config cache between clearing it and
when the code checked it. This caused the sync code path to be
used instead of the async path, bypassing the mocked async functions.

Fix:
1. Set cache directly instead of clearing it
2. Also mock sync versions _get_tokenizer_config and _get_chat_template_file

This ensures the test is deterministic regardless of test execution order.
2026-02-05 12:57:20 -08:00
Sameer Kankute
a21b625a59
Merge pull request #20105 from qiniu/fix/vertex-gemini-streaming-content-filter
Fix Vertex AI Gemini streaming content_filter handling
2026-02-05 16:48:48 +05:30
Ishaan Jaff
2a3843aa57
[Fix] inconsistent response format in anthropic.messages.acreate() when using non anthropic providers (#20442)
* _translate_openai_content_to_anthropic

* test_response_format_consistency

* test fixes unit tests

* test fix

* fix: use dict access for anthropic content blocks in tests (#20447)

The translate_openai_response_to_anthropic method returns dicts, not objects.
Changed .type/.text/.thinking attribute access to dict ['key'] access.

---------

Co-authored-by: shin-bot-litellm <shin-bot-litellm@berri.ai>
2026-02-04 16:37:40 -08:00
Kris Xia
bfabb39fc6
fix: Fix Vertex AI Gemini streaming content_filter handling
- Add promptFeedback.blockReason check in chunk_parser
- Return content_filter finish_reason when blocked
- Extract content filter logic into _check_prompt_level_content_filter() method
- Update unit tests to reflect simplified implementation

Signed-off-by: Kris Xia <xiajiayi0506@gmail.com>
2026-02-04 21:11:47 +08:00
Sameer Kankute
b2feedc469
Merge pull request #20318 from BerriAI/litellm_oss_staging_02_03_2026
feat(guardrails): implement team-based isolation guardrails mgmnt (#1…
2026-02-04 17:49:30 +05:30
Ishaan Jaff
da4cf4942f
[Feat] Add xAI /realtime API Support - works with LiveKitSDK (#20381)
* init: _realtime_health_check + routing

* refactor: OpenAIRealtime

* refactor: XAI_API_BASE

* feat: XAIRealtime

* init feat: XAIRealtime

* OpenAIRealtime

* TestXAIRealtime

* test fixes

* test OAI

* TEST xAI, OAI

* clean realtime jobs

* refactor

* test XAI

* docs xAI

* fix xAI

* fix lint errors

* test_async_realtime_url_contains_model

* test fix

* document test changes

* _realtime_health_check

* docs xai realtime

* fix handlers

* add additional_headers

* fix
2026-02-03 19:58:28 -08:00
Sameer Kankute
25fa1ad4e7
Merge pull request #20386 from naaa760/fix/extra-head-chat-comp-brid
fix(proxy): forward extra headers in chat
2026-02-04 09:11:43 +05:30
Sameer Kankute
f11c16a0e7
Merge pull request #20334 from BerriAI/litellm_fireworks_ai_field_remoal
Fix: Extra inputs are not permitted, field: 'messages[2].provider_specific_fields
2026-02-04 08:50:04 +05:30
Sameer Kankute
bd87c446f2
Merge pull request #20329 from BerriAI/litellm_delete_files_bug
Add support for delete and GET via file_id for gemini
2026-02-04 08:49:24 +05:30
michelligabriele
a50896f91e
fix: revert httpx client caching that caused closed client errors (#20025)
AsyncHTTPHandler.__del__ was closing httpx clients still in use by
AsyncOpenAI/AsyncAzureOpenAI due to independent cache lifecycles.
Restores standalone httpx client creation for OpenAI/Azure providers.
2026-02-03 16:15:04 -08:00
Alexander Grattan
cc76f95555
fix: check for model_response_choices before guardrail input (#19784)
* fix: check for model_response_choices before guardrail input

* test: add tests for responses api translation

* fix: protect other guardrail translations

* refactor: remove type ignores

* anthropic request body got mutated fix

* add warning when extra_body is provided but user is non premium

* fix: resolve mypy union-attr errors in anthropic guardrail handler

Cast choices[0] to Choices type before accessing .message attribute
to satisfy mypy's union type checking for Choices | StreamingChoices.

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

* add logger when model response has no choices for streaming /response and /messages

* update pyproject.toml as requested

* Revert "update pyproject.toml as requested"

This reverts commit 541a2b075a.

* update pyproject.toml as requested

* Revert "update pyproject.toml as requested"

This reverts commit 716ea0caa1.

---------

Co-authored-by: Xiaohan Fu <xiaohan@grayswan.ai>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 14:41:13 -08:00
Sameer Kankute
ff568de2cb Add get files API support and tests 2026-02-03 18:57:39 +05:30
Sameer Kankute
3765d88809 Fix: Extra inputs are not permitted, field: 'messages[2].provider_specific_fields' 2026-02-03 16:23:18 +05:30
Ishaan Jaff
5cfcf67d7c
[Feat] /chat/completions - allow using OpenAI style tools for web_search with VertexAI/gemini models (#20280)
* test_gemini_openai_web_search_tool_to_google_search

* feat: Handle OpenAI style web search tools
2026-02-02 19:36:36 -08:00
Sameer Kankute
7329fa8e7a fix: litellm_oss_staging_01_31_2026_3 failing tests 2026-02-02 18:50:58 +05:30
Lovro Seder
726988aed4 Fix Azure AI Anthropic CountTokens 401 auth error (#20069)
Add x-api-key header to CountTokens handler to match chat completion
authentication. Azure AI Anthropic requires this header per Microsoft's
native API format.
2026-02-02 18:24:06 +05:30
Cesar Garcia
61a84e9fdb fix(anthropic-adapter): truncate tool names exceeding OpenAI's 64-char limit (#20107)
When using LiteLLM's Anthropic /v1/messages endpoint to route requests to
OpenAI models, requests fail if any tool name exceeds OpenAI's 64-character
limit. Anthropic API has no such limit, causing compatibility issues.

Changes:
- Add truncate_tool_name() function using {55-char-prefix}_{8-char-hash} format
- Modify translate_anthropic_tools_to_openai() to truncate and return mapping
- Modify translate_anthropic_tool_choice_to_openai() to truncate tool name
- Restore original tool names in responses using the mapping
- Support tool name restoration in streaming responses
- Add backwards-compatible API (existing methods still work)

The fix only applies when routing Anthropic requests to OpenAI models.
Native Anthropic/Claude requests pass through unchanged.
2026-02-02 18:16:07 +05:30
Aarish Alam
3e04e20205 🐛 Bug Fix #19642 : bug in Vertex AI context caching (#19657)
* add vertex tests

* add uperbound

* add pagination tests
2026-02-02 18:13:34 +05:30
Chesars
3215dc4d4e feat(vertex_ai): add global endpoint support for Qwen MaaS models
Fixes #19788

- Add `supported_regions: ["global"]` to Qwen MaaS models in model_prices_and_context_window.json
- Update `get_supported_regions()` to read directly from `model_cost` dict
- Update `get_complete_vertex_url()` to use `get_vertex_region()` for global-only models
- Update `create_vertex_url()` to generate correct URL for global location (without region prefix)
- Add tests for Qwen global endpoint support
2026-02-02 18:13:10 +05:30
Emerson Gomes
bb5397d9b2 fix: enforce scheme for Azure AI rerank api_base 2026-02-02 18:13:04 +05:30
Chesars
11fd92c21b refactor(image-gen): move thought_signature to provider_specific_fields
Per review feedback, thought_signature should not be a root-level
param on ImageObject as it's not OpenAI compatible. Moved to
provider_specific_fields dict to match the pattern used in chat
completions (Message, Delta, Choices, etc).
2026-02-02 18:12:41 +05:30
Chesars
b2463291c7 fix(image-gen): add thought_signature to ImageObject for Gemini 3 Pro
Fixes #17184 - Gemini 3 Pro image preview model returns a thoughtSignature
field required for interactive image editing. This change:

- Adds thought_signature field to ImageObject class
- Updates Gemini and Vertex AI transformations to extract thoughtSignature
- Adds test for thought_signature in response transformation
2026-02-02 18:12:28 +05:30
Sameer Kankute
27b4052231
Merge pull request #20244 from BerriAI/litellm_nova_sonic_imp_2_feb
[Feat]Add support for nova sonic Speech to speech model
2026-02-02 18:04:02 +05:30
Sameer Kankute
8d65ac62f7
Merge pull request #20254 from BerriAI/litellm_anthropic_reasoning_content
fix: Map reasoning content to anthropic thinking block(streaming+non-streaming)
2026-02-02 17:43:50 +05:30
Sameer Kankute
eee737520f fix: Map reasoning content to anthropic thinking block(streaming+non-streaming) 2026-02-02 16:04:13 +05:30
Sameer Kankute
1a7fcfb713
Merge pull request #19881 from jayy-77/feat/user-agent-customization-issue-19017
feat: add User-Agent customization support
2026-02-02 15:01:39 +05:30
Sameer Kankute
cdeefe85ea Add nova sonic tests 2026-02-02 12:18:43 +05:30
yuneng-jiang
ae2cf7104d
Merge pull request #20086 from BerriAI/litellm_watsonx_inte_fix
[Fix] Add WATSONX_ZENAPIKEY to WatsonX credentials
2026-01-31 09:13:42 -08:00
shin-bot-litellm
10194d96cf
litellm_fix: handle unknown models in Azure AI cost calculator (#20150) 2026-01-31 07:37:48 -08:00
shin-bot-litellm
395ad9bdc1
litellm_fix(test): add acancel_batch to Azure SDK client initialization test (#20143) 2026-01-31 07:34:54 -08:00
shin-bot-litellm
14a5706131
litellm_fix(test): fix Bedrock tool search header test regression (#20135) 2026-01-31 00:44:47 -08:00
shin-bot-litellm
013b4701f4
litellm_fix(test): fix Azure AI cost calculator test - use Logging class (#20134) 2026-01-31 00:43:53 -08:00
Ishaan Jaff
5345a763c2
[Feat] v2 - Logs view with side panel and improved UX (#20091)
* init: azure_ai/azure-model-router

* show additional_costs in CostBreakdown

* UI show cost breakdown fields

* feat: dedicated cost calc for azure ai

* test_azure_ai_model_router

* docs azure model router

* test azure model router

* fix transfrom

* Add transform file

* fix:feat: route to config

* v0 - looks decen view

* refactored code

* fix ui

* fixes ui

* complete v2 viewer

* address feedback

* address feedback
2026-01-30 18:34:13 -08:00
yuneng-jiang
1f5b875181 Add WATSONX_ZENAPIKEY 2026-01-30 13:52:56 -08:00
Sameer Kankute
6e9210381c
Merge pull request #20058 from BerriAI/litellm_vertex_ai_prompt-caching-scope-2026-01-05,
Fix: remove unsupported prompt-caching-scope-2026-01-05 header for vertex ai
2026-01-30 20:32:00 +05:30
Sameer Kankute
8363a26d2e Fix: remove unsupported prompt-caching-scope-2026-01-05 header for vertex ai 2026-01-30 17:33:40 +05:30
Sameer Kankute
1877483deb
Merge pull request #20056 from BerriAI/litellm_vllm_embedding
Fix: vllm embedding format
2026-01-30 17:01:57 +05:30
Sameer Kankute
5277a0cf82
Merge pull request #20053 from BerriAI/litellm_gemini_edit_jan_30
fix aspectRatio mapping in image edit
2026-01-30 17:01:46 +05:30
Sameer Kankute
55348dd9c5 Fix: vllm embedding format 2026-01-30 16:42:59 +05:30
Sameer Kankute
3c451e945a fix aspectRatio mapping 2026-01-30 15:25:18 +05:30
Sameer Kankute
eb50c780e9
Merge branch 'main' into litellm_oss_staging_01_29_2026 2026-01-30 09:03:05 +05:30
Sameer Kankute
df072979e5
Merge branch 'main' into litellm_oss_staging_01_28_2026 2026-01-29 17:39:42 +05:30