Commit graph

5860 commits

Author SHA1 Message Date
shin-bot-litellm
36ed816684 fix: clean up lint errors in test files (unused imports, print statements, etc.) 2026-01-31 16:47:04 +00:00
shin-bot-litellm
6b02ae5fa5 litellm_fix: resolve all failing mapped tests on CircleCI
Fixes for mapped test failures across multiple test suites:

1. **DataDog Integration** (test_datadog_llm_obs_agent):
   - Fixed DD_API_KEY/DD_SITE requirement check to respect agent mode
   - When LITELLM_DD_AGENT_HOST is set, API key and site are optional

2. **Prometheus Logging** (enterprise callbacks):
   - Updated test assertions to include new model_id label
   - Added client_ip and user_agent labels where expected
   - Fixed label argument ordering to match implementation

3. **Proxy Server Tests** (get_image):
   - Made tests async (get_image is an async function)
   - Fixed os.path.exists mocking to not return True for cache file
   - Removed unnecessary os.getenv mocking

4. **Vector Store Tests**:
   - Fixed prisma_client patch path (use proxy_server.prisma_client)
   - Added missing team_id and user_id attributes to mock UserAPIKeyAuth

5. **Key Management Tests**:
   - Added 5-second buffer for timing comparison in budget_reset test

6. **Vertex AI Passthrough Tests**:
   - Updated test to expect URL preservation when project/location present

7. **Presidio Guardrail Tests**:
   - Removed incorrect assertion about session closure (sessions are cached)

8. **Azure SDK Tests**:
   - Added acancel_batch to skip list (uses cached client)

9. **Cost Calculation Tests**:
   - Fixed expected calculation to account for double-counting detection
2026-01-31 16:17:29 +00:00
shin-bot-litellm
e35e6504fc
litellm_fix(test): fix router silent experiment tests to properly mock async functions (#20140) 2026-01-31 07:39:05 -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
7db4594200
litellm_fix(test): allow comment field in schema and exclude robotics models from tpm check (#20139) 2026-01-31 07:32:33 -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
shin-bot-litellm
ecd0202f70
litellm_fix(e2e): disable bedrock-converse-claude-sonnet-4.5 model in tests (#20131) 2026-01-31 00:32:42 -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
Alexsander Hamir
a11b043f33
fix(proxy): resolve high CPU when router_settings in DB by avoiding REGISTRY.collect() in PrometheusServicesLogger (#20087) 2026-01-30 14:01:45 -08:00
Ishaan Jaff
6897d5f59e
[Feat] Add async_post_call_response_headers_hook to CustomLogger (#20083)
* Add async_post_call_response_headers_hook to CustomLogger (#20070)

Allow CustomLogger callbacks to inject custom HTTP response headers
into streaming, non-streaming, and failure responses via a new
async_post_call_response_headers_hook method.

* async_post_call_response_headers_hook

---------

Co-authored-by: michelligabriele <gabriele.michelli@icloud.com>
2026-01-30 12:44:44 -08:00
Harshit Jain
481bb4b6ce
fixes: ci pipeline router coverage failure (#20065) 2026-01-30 11:55:49 -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
8b9d5018b6
Merge pull request #20052 from BerriAI/litllm_disable_cache_jan_29
Add disable flag for anthropic gemini cache translation
2026-01-30 17:01:34 +05:30
Sameer Kankute
404c33eca6
Merge pull request #20051 from BerriAI/litellm_xai_web_search_routing
Add routing of xai chat completions to responses when web search options is present
2026-01-30 17:01:19 +05:30
Sameer Kankute
8d485f2403
Merge pull request #19986 from BerriAI/litellm_batch_cost_tracking_jan29
[Feat]Add cost tracking and usage object in aretrieve_batch call type
2026-01-30 17:00:42 +05:30
Sameer Kankute
cfc9c77347
Merge pull request #19981 from BerriAI/litellm_fix_batches_permissions
Fix: Batch and File user level permissions
2026-01-30 17:00:10 +05:30
Sameer Kankute
a8054264ae
Merge pull request #19975 from BerriAI/litellm_oss_staging_01_29_2026
Litellm oss staging 01 29 2026
2026-01-30 16:58:28 +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
5ac3f75996 Add disable flahg for anthropic gemini cache translation 2026-01-30 14:58:10 +05:30
Sameer Kankute
11c2160379 Add web search tests 2026-01-30 14:56:11 +05:30
Sameer Kankute
dbc8006190 Add routing of xai chat completions to responses when web search options is present 2026-01-30 14:15:35 +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
c509ffcea8
Merge pull request #20042 from BerriAI/main
merge main in passthrough
2026-01-30 08:44:00 +05:30
Ishaan Jaff
476f0b29d2
[Feat] LiteLLM x Claude Agent SDK Integration (#20035)
* fix: bedrock invoke - does not support prompt-caching-scope

* fix: UNSUPPORTED_BEDROCK_INVOKE_BETA_PATTERNS

* init requirements.txt

* init README for claude Agent SDK

* fix: using converse models with UNSUPPORTED_BEDROCK_CONVERSE_BETA_PATTERNS

* fix main.py

* init: proxy_e2e_anthropic_messages_tests
2026-01-29 17:48:38 -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
fce26352b6 Add cost tacking and usage info in call_type=aretrieve_batch 2026-01-29 15:27:41 +05:30
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