Commit graph

8121 commits

Author SHA1 Message Date
Sameer Kankute
eb50c780e9
Merge branch 'main' into litellm_oss_staging_01_29_2026 2026-01-30 09:03:05 +05:30
Sameer Kankute
c509ffcea8
Merge pull request #20042 from BerriAI/main
merge main in passthrough
2026-01-30 08:44:00 +05:30
yuneng-jiang
0b6bacb6d3 adding tests 2026-01-29 16:34:21 -08:00
yuneng-jiang
81e8a127b8 Allow config embedding models 2026-01-29 16:31:30 -08:00
yuneng-jiang
158e1e32d1 error_code in spend logs error metadata 2026-01-29 11:43:18 -08:00
yuneng-jiang
42081a57db
Merge pull request #19886 from BerriAI/litellm_bulk_edit_keys
[Feature] Bulk Update Keys Endpoint
2026-01-29 09:07:58 -08:00
yuneng-jiang
bc23a97e14
Merge pull request #19971 from BerriAI/litellm_v2_model_info_sorting_fix
[Fix] Sorting for /v2/model/info
2026-01-29 09:07:28 -08:00
Sameer Kankute
df072979e5
Merge branch 'main' into litellm_oss_staging_01_28_2026 2026-01-29 17:39:42 +05:30
Sameer Kankute
8808e4d7ac Add /openai_passthrough route for openai passthrough requests: 2026-01-29 16:07:45 +05:30
Sameer Kankute
4b385e5b32 Add litellm metadata correctly for file create 2026-01-29 15:20:31 +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
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
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
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
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
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
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
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
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
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
yuneng-jiang
1411a227aa bulk update keys endpoint 2026-01-27 13:58:32 -08:00
jayy-77
980ec2afe8 test: cover LITELLM_USER_AGENT override in custom_httpx handlers 2026-01-28 02:09:47 +05:30
jayy-77
bf0670edfd fix: honor LITELLM_USER_AGENT for default User-Agent 2026-01-28 02:09:30 +05:30
michelligabriele
7d5439adda
fix(bedrock): support tool search header translation for Sonnet 4.5 (#19871)
Extend advanced-tool-use header translation to include Claude Sonnet 4.5
in addition to Opus 4.5 on Bedrock Invoke API.

When Claude Code sends the advanced-tool-use-2025-11-20 header, it now
gets correctly translated to Bedrock-specific headers for both:
- Claude Opus 4.5
- Claude Sonnet 4.5

Headers translated:
- tool-search-tool-2025-10-19
- tool-examples-2025-10-29

Fixes defer_loading validation error on Bedrock with Sonnet 4.5.

Ref: https://platform.claude.com/docs/en/agents-and-tools/tool-use/tool-search-tool
2026-01-27 12:17:09 -08:00
jayy-77
b20cf7dfa9 test: add comprehensive tests for User-Agent customization
Add 8 tests covering:
- Default User-Agent behavior
- Disabling default User-Agent
- Custom User-Agent via extra_headers
- Environment variable support
- Async handler support
- Override without disabling
- Claude Code use case
- Backwards compatibility
2026-01-28 00:50:04 +05:30