Commit graph

6027 commits

Author SHA1 Message Date
Sameer Kankute
4b385e5b32 Add litellm metadata correctly for file create 2026-01-29 15:20:31 +05:30
Sameer Kankute
fa2b065238 Add tests for user level permissions on file and batch access 2026-01-29 12:29:10 +05:30
Aaron Yim
d4031c8ba6
Add OpenRouter Kimi K2.5 (#19872)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 22:34:48 -08:00
Christopher Chase
87bdfb0253
fix(hosted_vllm): route through base_llm_http_handler to support ssl_verify (#19893)
* fix(hosted_vllm): route through base_llm_http_handler to support ssl_verify

The hosted_vllm provider was falling through to the OpenAI catch-all path
which doesn't pass ssl_verify to the HTTP client. This adds an explicit
elif branch that routes hosted_vllm through base_llm_http_handler.completion()
which properly passes ssl_verify to the httpx client.

- Add explicit hosted_vllm branch in main.py completion()
- Add ssl_verify tests for sync and async completion
- Update existing audio_url test to mock httpx instead of OpenAI client

* feat(hosted_vllm): add embedding support with ssl_verify

- Add HostedVLLMEmbeddingConfig for embedding transformations
- Register hosted_vllm embedding config in utils.py
- Add lazy import for embedding transformation module
- Add unit test for ssl_verify parameter handling
2026-01-28 22:33:07 -08:00
Bernardo Donadio
ba17f51812
fix(proxy): prevent provider-prefixed model leaks (#19943)
* fix(proxy): prevent provider-prefixed model leaks

Proxy clients should not see LiteLLM internal provider prefixes (e.g. hosted_vllm/...) in the OpenAI-compatible response model field.

This patch sanitizes the client-facing model name for both:
- Non-streaming responses returned from base_process_llm_request
- Streaming SSE chunks emitted by async_data_generator

Adds regression tests covering vLLM-style hosted_vllm routing for both streaming and non-streaming paths.

* chore(lint): suppress PLR0915 in proxy handler

Ruff started flagging ProxyBaseLLMRequestProcessing.base_process_llm_request() for too many statements after the hotpatch changes.

Add an explicit '# noqa: PLR0915' on the function definition to avoid a large refactor in a hotpatch.

* refactor(proxy): make model restamp explicit

Replace silent try/except/pass and type ignores with explicit model restamping.

- Logs an error when the downstream response model differs from the client-requested model
- Overwrites the OpenAI `model` field to the client-requested value to avoid leaking internal provider-prefixed identifiers
- Applies the same behavior to streaming chunks, logging the mismatch only once per stream

* chore(lint): drop PLR0915 suppression

The model restamping bugfix made `base_process_llm_request()` slightly exceed Ruff's
PLR0915 (too-many-statements) threshold, requiring a `# noqa` suppression.

Collapse consecutive `hidden_params` extractions into tuple unpacking so the
function falls back under the lint limit and remove the suppression.

No functional change intended; this keeps the proxy model-field bugfix intact
while aligning with project linting rules.

* chore(proxy): log model mismatches as warnings

These model-restamping logs are intentionally verbose: a mismatch is a useful signal
that an internal provider/deployment identifier may be leaking into the public
OpenAI response `model` field.

- Downgrade model mismatch logs from error -> warning
- Keep error logs only for cases where the proxy cannot read/override the model

* fix(proxy): preserve client model for streaming aliasing

Pre-call processing can rewrite request_data['model'] via model alias maps.\n\nOur streaming SSE generator was using the rewritten value when restamping chunk.model, which caused the public 'model' field to differ between streaming and non-streaming responses for alias-based requests.\n\nStash the original client model in request_data as _litellm_client_requested_model after the model has been routed, and prefer it when overriding the outgoing chunk model. Add a regression test for the alias-mapping case.

* chore(lint): satisfy PLR0915 in streaming generator

Ruff started flagging async_data_generator() for too many statements after adding model restamping logic.\n\nExtract the client-model selection + chunk restamping into small helpers to keep behavior unchanged while meeting the project's PLR0915 threshold.
2026-01-28 22:26:38 -08:00
michelligabriele
dcf5f07e5e
fix(proxy): add datadog_llm_observability to /health/services allowed list (#19952)
The /health/services endpoint rejected datadog_llm_observability as an
unknown service, even though it was registered in the core callback
registry and __init__.py. Added it to both the Literal type hint and
the hardcoded validation list in the health endpoint.
2026-01-28 22:16:27 -08:00
Sameer Kankute
70684ca86f Fix File access permissions for .retreive and .delete 2026-01-29 11:19:24 +05:30
Cesar Garcia
c7453c01f9
Fix stream_chunk_builder to preserve images from streaming chunks (#19654)
Fixes #19478

The stream_chunk_builder function was not handling image chunks from
models like gemini-2.5-flash-image. When streaming responses were
reconstructed (e.g., for caching), images in delta.images were lost.

This adds handling for image_chunks similar to how audio, annotations,
and other delta fields are handled.
2026-01-28 21:31:06 -08:00
Cesar Garcia
8a26033a4b
fix(vertex_ai): convert image URLs to base64 in tool messages for Anthropic (#19896)
* fix(vertex_ai): convert image URLs to base64 in tool messages for Anthropic

Fixes #19891

Vertex AI Anthropic models don't support URL sources for images. LiteLLM
already converted image URLs to base64 for user messages, but not for tool
messages (role='tool'). This caused errors when using ToolOutputImage with
image_url in tool outputs.

Changes:
- Add force_base64 parameter to convert_to_anthropic_tool_result()
- Pass force_base64 to create_anthropic_image_param() for tool message images
- Calculate force_base64 in anthropic_messages_pt() based on llm_provider
- Add unit tests for tool message image handling

* chore: remove extra comment from test file header
2026-01-28 19:42:51 -08:00
Ishaan Jaff
9c5fed4f52
[Feat] LiteLLM Vector Stores - Add permission management for users, teams (#19972)
* fix: create_vector_store_in_db

* add team/user to LiteLLM_ManagedVectorStore

* add _check_vector_store_access

* add new fields

* test_check_vector_store_access

* add vector_store/list endpoints

* fix code QA checks
2026-01-28 18:55:40 -08:00
yuneng-jiang
58dd3bd134 fixing sorting for v2/model/info 2026-01-28 18:07:22 -08:00
Alexsander Hamir
69bd4426e8
[Release Day] - Fixed CI/CD issues & changed processes (#19902) 2026-01-28 17:57:24 -08:00
Ishaan Jaff
d12ce3cd5d
[Fix] VertexAI Pass through - fix regression that caused vertex ai passthroughs to stop working for router models (#19967)
* fix(vertex_ai): replace custom model names with actual Vertex AI model names in passthrough URLs (#19948)

When the passthrough URL already contains project and location, the code
was skipping the deployment lookup and forwarding the URL as-is to Vertex AI.
For custom model names like gcp/google/gemini-2.5-flash, Vertex AI returned
404 because it only knows the actual model name (gemini-2.5-flash).

The fix makes the deployment lookup always run, so the custom model name
gets replaced with the actual Vertex AI model name before forwarding.

* add _resolve_vertex_model_from_router

* fix: get_llm_provider

* Potential fix for code scanning alert no. 4020: Clear-text logging of sensitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

---------

Co-authored-by: michelligabriele <gabriele.michelli@icloud.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-01-28 16:54:01 -08:00
Alexsander Hamir
3816570313
fix(presidio): reuse HTTP connections to prevent OOMs (#19964) 2026-01-28 16:08:53 -08:00
yuneng-jiang
cccda30a9e
Merge pull request #19960 from BerriAI/litellm_ui_spend_logs_error_message
[Feature] Add error_message Search in Spend Logs Endpoint
2026-01-28 16:04:29 -08:00
yuneng-jiang
cb8ead6013 Add error_message search in spend logs endpoint 2026-01-28 15:06:31 -08:00
Ishaan Jaff
3ef475b70e
[Fix] A2a Gateway - Allow supporting old A2a card formats (#19949)
* fix: LiteLLMA2ACardResolver

* fix: LiteLLMA2ACardResolver

* feat: .well-known/agent.json

* test_card_resolver_fallback_from_new_to_old_path
2026-01-28 15:02:08 -08:00
Ishaan Jaffer
5135efb60e fix pypdf: >=6.6.2 2026-01-28 14:54:58 -08:00
Alexsander Hamir
4c1b24eed9
Fix thread leak in OpenTelemetry dynamic header path (#19946) 2026-01-28 10:35:37 -08:00
michelligabriele
ea3853e977
fix(vertex_ai): support model names with slashes in passthrough URLs (#19944)
The regex in get_vertex_model_id_from_url() was using [^/:]+
which stopped at the first slash, truncating model names like
'gcp/google/gemini-2.5-flash' to just 'gcp'. This caused
access_groups checks to fail for custom model names.

Changed the pattern to [^:]+ to allow slashes in model names,
only stopping at the colon before the action (e.g., :generateContent).
2026-01-28 09:33:53 -08:00
boarder7395
8e4f06583a
Fix team cli auth flow (#19666)
* Cleanup code for user cli auth, and make sure not to prompt user for team multiple times while polling

* Adding tests

* Cleanup normalize teams some more
2026-01-28 08:52:52 -08:00
Sameer Kankute
169c9dae79
Merge pull request #19914 from BerriAI/litellm_responses_api_bridge_usage
Fix: output_tokens_details.reasoning_tokens None
2026-01-28 18:35:30 +05:30
Sameer Kankute
9fe8b12f44
Merge pull request #19924 from BerriAI/litellm_minimax_reasoning_caching_1
Add Prompt caching and reasoning support for MiniMax, GLM, Xiaomi
2026-01-28 18:04:13 +05:30
Sameer Kankute
b6c769880e
Merge pull request #19842 from BerriAI/litellm_fix_timeout_test_fix
Fixes Timeouts during chat completion calls no longer reported as timeout in failure callback
2026-01-28 18:03:21 +05:30
Sameer Kankute
f5e5569e40
Merge pull request #19636 from BerriAI/litellm_langfuse_callback
Add litellm_callback_logging_failures_metric for Langfuse, Langfuse Otel and other Otel providers
2026-01-28 18:02:17 +05:30
Sameer Kankute
c5c1fbc5a2 Fix test_calculate_usage_completion_tokens_details_always_populated and logging object test 2026-01-28 18:00:42 +05:30
Sameer Kankute
0fadcbb21f
Merge pull request #19915 from BerriAI/litellm_x_ai_responses_web
Add xai websearch params support fo Responses API
2026-01-28 17:34:28 +05:30
Sameer Kankute
7386621d04
Merge pull request #19839 from BerriAI/litellm_oss_staging_01_27_2026
Litellm oss staging 01 27 2026
2026-01-28 17:33:27 +05:30
Sameer Kankute
f6ead49afe Add Prompt caching and reasoning support for MiniMax, GLM, Xiaomi 2026-01-28 17:25:26 +05:30
Sameer Kankute
4f7425df0c
Merge pull request #19661 from Chesars/fix/oci-image-url-format
fix(oci): serialize imageUrl as object for OCI GenAI API
2026-01-28 15:26:50 +05:30
Sameer Kankute
9b44984510
Merge pull request #19899 from xianzongxie-stripe/add_native_background_mode_override
Add native_background_mode to override polling_via_cache for specific models
2026-01-28 12:27:19 +05:30
Sameer Kankute
bd15ebba84 fix: Pydantic will fail to parse it because cached_tokens is required but not provided 2026-01-28 11:51:26 +05:30
Sameer Kankute
6fb2a0d11f Fix: output_tokens_details.reasoning_tokens None 2026-01-28 11:35:18 +05:30
yuneng-jiang
28ca991296 Allow dynamic setting of store_prompts_in_spend_logs 2026-01-27 20:52:07 -08:00
Sameer Kankute
d76fb5932a Add xai websearch params support 2026-01-28 09:54:43 +05:30
Sameer Kankute
5276085f3c
Merge branch 'litellm_fix_timeout_test_fix' into litellm_merge_timeout_issue 2026-01-28 08:56:29 +05:30
mubashir1osmani
9a245031bd
feat(hosted_vllm): support thinking parameter in anthropic_messages() and .completion()
feat(hosted_vllm): support `thinking` parameter in `anthropic_messages()` and `.completion()`
2026-01-27 22:13:53 -05:00
Sameer Kankute
42a0d576f3
Merge pull request #19910 from BerriAI/main
merge 01 27
2026-01-28 08:30:47 +05:30
Cesar Garcia
64c102e3c2
fix(gemini): subtract implicit cached tokens from text_tokens for correct cost calculation (#19775)
When Gemini uses implicit caching, it returns cachedContentTokenCount but
NOT cacheTokensDetails. Previously, text_tokens was not adjusted in this case,
causing costs to be calculated as if all tokens were non-cached.

This fix subtracts cachedContentTokenCount from text_tokens when no
cacheTokensDetails is present (implicit caching), ensuring correct cost
calculation with the reduced cache_read pricing.
2026-01-27 18:18:47 -08:00
Cesar Garcia
807ba011eb
fix(main): use local tiktoken cache in lazy loading (#19774)
The lazy loading implementation for encoding in __getattr__ was calling
tiktoken.get_encoding() directly without first setting TIKTOKEN_CACHE_DIR.
This caused tiktoken to attempt downloading the encoding file from the
internet instead of using the local copy bundled with litellm.

This fix uses _get_default_encoding() from _lazy_imports which properly
sets TIKTOKEN_CACHE_DIR before loading tiktoken, ensuring the local cache
is used.
2026-01-27 18:16:58 -08:00
Brian Caswell
920ef665a3
inspect BadRequestError after all other policy types (#19878)
As indicated by https://docs.litellm.ai/docs/exception_mapping,
BadRequestError is used as the base type for multiple exceptions.  As
such, it should be tested last in handling retry policies.

This updates the integration test that validates retry policies work as
expected.

Fixes #19876
2026-01-27 18:15:04 -08:00
Teo Stocco
d6cf4df3cb
fix: tool with antropic #19800 (#19805) 2026-01-27 18:02:37 -08:00
Jay Prajapati
6a9d41234f
fix: allow tool_choice for Azure GPT-5 chat models (#19813)
* fix: don't treat gpt-5-chat as GPT-5 reasoning

* fix: mark azure gpt-5-chat as supporting tool_choice

* test: cover gpt-5-chat params on azure/openai
2026-01-27 17:51:13 -08:00
Jay Prajapati
4717f742eb
fix: filter unsupported beta headers for Bedrock Invoke API (#19877)
- Add whitelist-based filtering for anthropic_beta headers
- Only allow Bedrock-supported beta flags (computer-use, tool-search, etc.)
- Filter out unsupported flags like mcp-servers, structured-outputs
- Remove output_format parameter from Bedrock Invoke requests
- Force tool-based structured outputs when response_format is used

Fixes #16726
2026-01-27 17:47:27 -08:00
Harshit Jain
d0939075bc
fix: guardrails issues streaming-response regex (#19901) 2026-01-27 17:36:18 -08:00
michelligabriele
8c4ccdc313
test(proxy): add regression tests for vertex passthrough model names with slashes (#19855)
Added test cases for custom model names containing slashes in Vertex AI
passthrough URLs (e.g., gcp/google/gemini-2.5-flash).

Test cases:
- gcp/google/gemini-2.5-flash
- gcp/google/gemini-3-flash-preview
- custom/model
2026-01-27 17:34:40 -08:00
yuneng-jiang
7109aafe4c
Merge pull request #19903 from BerriAI/litellm_ui_model_table_adjustable_col
[Feature] Add sortBy and sortOrder params for /v2/model/info
2026-01-27 17:16:22 -08:00
yuneng-jiang
1581bcf985 add sortBy and sortOrder params for /v2/model/info 2026-01-27 16:54:52 -08:00
Xianzong Xie
f9eea06a37 Add tests for native_background_mode feature
Added 8 new unit tests for the native_background_mode feature:
- test_polling_disabled_when_model_in_native_background_mode
- test_polling_disabled_for_native_background_mode_with_provider_list
- test_polling_enabled_when_model_not_in_native_background_mode
- test_polling_enabled_when_native_background_mode_is_none
- test_polling_enabled_when_native_background_mode_is_empty_list
- test_native_background_mode_exact_match_required
- test_native_background_mode_with_provider_prefix_in_request
- test_native_background_mode_with_router_lookup

Committed-By-Agent: cursor
2026-01-27 16:48:22 -08:00
Ishaan Jaff
51339f5ef1
[Feat] RAG API - Add s3_vectors as provider on /vector_store/search API + UI for creating + PDF support for /rag/ingest (#19895)
* init S3VectorsRAGIngestion as a supported ingestion provider for RAG API

* test: TestRAGS3Vectors

* init S3VectorsVectorStoreOptions

* init s3 vectors

* code clean up + QA

* fix: get_credentials

* S3VectorsRAGIngestion

* TestRAGS3Vectors

* docs: AWS S3 Vectors

* add asyncio QA checks

* fix: S3_VECTORS_DEFAULT_DIMENSION

* init ui for bedrock s3 vectors

* fix add /search support for s3_vectors

* init atransform_search_vector_store_request

* feat: S3VectorsVectorStoreConfig

* TestS3VectorsVectorStoreConfig

* atransform_search_vector_store_request

* fix: S3VectorsVectorStoreConfig

* add validation for bucket name etd

* fix UI validation for s3 vector store

* init extract_text_from_pdf

* add pypdf

* fix code QA checks

* fix navbar

* init s3_vector.png

* fix QA code
2026-01-27 16:30:59 -08:00