Commit Graph
31459 Commits
Author SHA1 Message Date
Cesar GarciaandSameer Kankute 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
Harshit JainandSameer Kankute 72e5193451 fix: models loadbalancing billing issue by filter (#18891) (#19220)
* fix: models loadbalancing billing issue by filter (#18891)

* fix: models loadbalancing billing issue by filter

* fix: separate key and team access groups in metadata

* fix: lint issues
2026-02-02 18:14:39 +05:30
Aarish AlamandSameer Kankute 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
ChesarsandSameer Kankute b3f1696946 refactor(vertex_ai): reuse get_vertex_base_url for URL construction
Use existing get_vertex_base_url from common_utils instead of duplicating
the global vs regional URL logic in create_vertex_url and get_api_base.
2026-02-02 18:13:18 +05:30
ChesarsandSameer Kankute 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 GomesandSameer Kankute bb5397d9b2 fix: enforce scheme for Azure AI rerank api_base 2026-02-02 18:13:04 +05:30
92763a14a9 Update litellm/llms/azure_ai/rerank/transformation.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-02 18:12:59 +05:30
Emerson GomesandSameer Kankute c4dd22c079 fix: broaden Azure AI rerank URL handling 2026-02-02 18:12:52 +05:30
ChesarsandSameer Kankute 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
ChesarsandSameer Kankute 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 KankuteandGitHub 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 8e2f7e5757 Fix mypy issues 2026-02-02 17:58:01 +05:30
Sameer KankuteandGitHub 686aafe03a Merge pull request #20262 from BerriAI/litellm_test_bedrock_optional_params_embeddings_dimension
Litellm test bedrock optional params embeddings dimension
2026-02-02 17:49:47 +05:30
Sameer Kankute bb363f0307 Fix: test_bedrock_optional_params_embeddings_dimension 2026-02-02 17:49:18 +05:30
Sameer Kankute 01cdc272ec Fix: test_bedrock_optional_params_embeddings_dimension 2026-02-02 17:47:20 +05:30
Sameer Kankute be0bb975c0 Fix test_aaamodel_prices_and_context_window_json_is_valid 2026-02-02 17:46:37 +05:30
Sameer KankuteandGitHub dafa26baa6 Merge pull request #20247 from BerriAI/litellm_smoketest_suite
Add Anthropic caching and context tests
2026-02-02 17:45:25 +05:30
Sameer KankuteandGitHub 19f6640309 Merge pull request #20249 from BerriAI/litellm_add_0_budget_model_bypass2
[Feat] Add support for 0 cost models
2026-02-02 17:45:05 +05:30
Sameer KankuteandGitHub fe7c7dadba Merge pull request #20253 from BerriAI/litellm_SAP-model-routing-to-OpenAI
Fix open_ai_embedding_models to have custom_llm_provider None
2026-02-02 17:44:14 +05:30
Sameer KankuteandGitHub 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 KankuteandGitHub fff35ee032 Merge pull request #20257 from BerriAI/litellm_slack_alert_fix_jfeb_02
Fix: Slack alert issue
2026-02-02 17:43:05 +05:30
Sameer KankuteandGitHub 7773a92069 Merge pull request #20258 from BerriAI/litellm_cerebras_reasoning
fix: add reasoning param support for GPT OSS cerebras
2026-02-02 17:42:28 +05:30
Sameer Kankute 415c26f281 fix: add reasoning param support for GPT OSS cerebras 2026-02-02 17:20:04 +05:30
Sameer Kankute 72482c0cb5 Fix: Slack alert issue 2026-02-02 16:49:10 +05:30
Sameer KankuteandGitHub 15cec5a4a0 Merge pull request #20255 from BerriAI/litellm_tts_doc
Update Vertex AI Text to Speech doc to show use of audio
2026-02-02 16:16:28 +05:30
Sameer Kankute c6f178eeae Update Vertex AI Text to Speech doc to show use of audio 2026-02-02 16:15:48 +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 c2298c2417 Fix open_ai_embedding_models to have custom_llm_provider None 2026-02-02 15:18:56 +05:30
Sameer KankuteandGitHub 6f2dc19ea0 Merge pull request #20214 from cscguochang/feat/bedrock-1hr-tiered-caching-cost
feat(bedrock): add 1hr tiered caching costs for long-context models (#18988)
2026-02-02 15:05:22 +05:30
Sameer KankuteandGitHub 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 14c2932387 Add docs on Zero-Cost Models 2026-02-02 13:29:37 +05:30
Sameer Kankute 1f4222e6b2 Add support for 0 cost models 2026-02-02 13:29:37 +05:30
Sameer Kankute 88cb101d88 Add Anthropic caching and context tests 2026-02-02 13:25:47 +05:30
Sameer KankuteandGitHub c13cb4cf51 Merge pull request #20235 from amirzaushnizer/litellm-support-cohere-embed-v4
feat: Support dimensions param for Cohere embed v4
2026-02-02 12:52:16 +05:30
Sameer Kankute 5e17dea24d Add tutorial to use bedrock nova 2026-02-02 12:19:17 +05:30
Sameer Kankute ea6c31a02a Add documentation on nova sonic 2026-02-02 12:19:04 +05:30
Sameer Kankute cdeefe85ea Add nova sonic tests 2026-02-02 12:18:43 +05:30
Sameer Kankute eb0f019359 Add nova sonic realtime 2026-02-02 12:18:32 +05:30
Sameer Kankute 037c10d7cb Add bedrock route in realtim main.py 2026-02-02 12:16:05 +05:30
amirzaushnizer f0853b2564 feat: enhance Cohere embedding support with additional parameters and model version 2026-02-01 18:04:08 +02:00
df387c39f6 docs: Update v1.81.6 release notes - focus on Logs v2 with Tool Call Tracing (#20225)
- Updated title to highlight Logs v2 feature
- Simplified Key Highlights to focus on Logs v2 / tool call tracing
- Rewrote Logs v2 description with improved language style
- Removed Claude Agents SDK and RAG API from key highlights section
- TODO: Add image (logs_v2_tool_tracing.png)

Co-authored-by: shin-bot-litellm <shin-bot-litellm@users.noreply.github.com>
2026-01-31 19:29:06 -08:00
Ishaan Jaffer b7e48f1d9e test fix 2026-01-31 19:08:07 -08:00
Ishaan JafferandCursor 466e6bdcf1 fix(test): make test_proxy_failure_metrics resilient to missing proxy-level metrics
- Check for both litellm_proxy_failed_requests_metric_total and the deprecated litellm_llm_api_failed_requests_metric_total
- The proxy-level failure hook may not always be called depending on where the exception occurs
- Simplify total_requests check to only verify key fields

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-01-31 18:46:27 -08:00
Ishaan Jaffer 92c8e00520 test_proxy_success_metrics 2026-01-31 18:36:22 -08:00
Ishaan Jaffer faff9d1dc5 test_proxy_failure_metrics 2026-01-31 18:10:17 -08:00
Ishaan Jaffer 35e29c2bcd Revert "Merge pull request #18790 from BerriAI/litellm_key_team_routing_3"
This reverts commit ae26d8e68a, reversing
changes made to 864e8c6543.
2026-01-31 17:58:46 -08:00
0c006794f1 litellm_fix_mapped_tests_core: fix test isolation and mock injection issues (#20209)
* litellm_fix_mapped_tests_core: fix test isolation and mock injection issues

## Problem
Four tests in litellm_mapped_tests_core were failing:
1. test_register_model_with_scientific_notation - KeyError due to test isolation issues
2. test_search_uses_registry_credentials - Mock not being called due to incorrect patch path
3. test_send_email_missing_api_key - Real API calls despite mocking
4. test_stream_transformation_error_sync - Mock not effective, real API called

## Solution

### test_register_model_with_scientific_notation
- Use unique model name to avoid conflicts with other tests
- Clear LRU caches before test to prevent stale data
- Clean up model_cost entry after test

### test_search_uses_registry_credentials
- Use patch.object() on the actual base_llm_http_handler instance
- String-based patching for instance methods can fail; direct object patching is more reliable

### test_send_email_missing_api_key
- Directly inject mock HTTP client into logger instance
- This bypasses any caching issues that could cause the fixture mock to be ineffective

### test_stream_transformation_error_sync
- Patch litellm.completion directly instead of the handler module's litellm reference
- This ensures the mock is effective regardless of import order

## Regression
These tests were affected by LRU caching added in #19606 and HTTP client caching.

* fix(test): use patch.object for container API tests to fix mock injection

## Problem
test_retrieve_container_basic tests were failing because mocks weren't
being applied correctly. The tests used string-based patching:
  patch('litellm.containers.main.base_llm_http_handler')

But base_llm_http_handler is imported at module level, so the mock wasn't
intercepting the actual handler calls, resulting in real HTTP requests
to OpenAI API.

## Solution
Use patch.object() to directly mock methods on the imported handler
instance. Import base_llm_http_handler in the test file and patch like:
  patch.object(base_llm_http_handler, 'container_retrieve_handler', ...)

This ensures the mock is applied to the actual object being used,
regardless of import order or caching.

* fix(test): add missing Prometheus metric labels to test_proxy_failure_metrics

Add client_ip, user_agent, model_id labels to expected metric patterns.
These labels were added in PRs #19717 and #19678 but test wasn't updated.

* fix(test_resend_email): use direct mock injection for all email tests

Extend the mock injection pattern used in test_send_email_missing_api_key
to all other tests in the file:
- test_send_email_success
- test_send_email_multiple_recipients

Instead of relying on fixture-based patching and respx mocks which can
fail due to import order and caching issues, directly inject the mock
HTTP client into the logger instance. This ensures mocks are always used
regardless of test execution order.

* fix(test): use patch.object for image_edit and vector_store tests

- test_image_edit_merges_headers_and_extra_headers: import base_llm_http_handler
  and use patch.object instead of string path patching
- test_search_uses_registry_credentials: import module and patch via
  module.base_llm_http_handler to ensure we patch the right instance

---------

Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
2026-01-31 17:53:54 -08:00
Ishaan JafferandCursor bb3c2a92a0 fix(test): update test_prometheus with masked user_id and missing labels
- Update expected user_id from 'default_user_id' to '*******_user_id' (PII masking)
- Add missing client_ip, user_agent, model_id labels (from PRs #19717, #19678)
- Update label order to match Prometheus alphabetical sorting

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-01-31 17:51:27 -08:00
93a0631ea3 docs: fix dead links in v1.81.6 release notes (#20218)
- Fix /docs/search/index -> /docs/search (404 error)
- Fix /cookbook/ -> GitHub cookbook URL (404 error)

Co-authored-by: shin-bot-litellm <shin-bot-litellm@users.noreply.github.com>
2026-01-31 17:46:56 -08:00
cscguochang-agent 76407bcf37 feat(bedrock): add base cache costs for sonnet v1 (#20214) 2026-02-01 09:36:51 +08:00