Commit graph

31381 commits

Author SHA1 Message Date
Yuneng Jiang
418dec5600
chore: fixes 2026-04-04 23:44:22 -07:00
shin-bot-litellm
559cb675a6 fix(test): accept both AuthenticationError and InternalServerError in batch_completion test
The test uses an invalid API key to verify that batch_completion returns
exceptions rather than raising them. However, depending on network conditions,
the error may be:
- AuthenticationError: API properly rejected the invalid key
- InternalServerError: Connection error occurred before API could respond

Both are valid outcomes for this test case.
2026-01-31 21:35:08 +00:00
shin-bot-litellm
d0383412e8 fix: make cache updates synchronous for budget enforcement
The budget enforcement was failing in tests because cache updates were
fire-and-forget (asyncio.create_task), causing race conditions where
subsequent requests would read stale spend data.

Changes:
1. proxy_track_cost_callback.py: await update_cache() instead of create_task
2. proxy_server.py: await async_set_cache_pipeline() instead of create_task
3. auth_checks.py: prefer valid_token.team_member_spend (from fresh cache)
   over team_membership.spend (which may be stale)

This ensures budget checks see the most recent spend values and properly
enforce budget limits when requests come in quick succession.

Fixes: test_users_in_team_budget, test_chat_completion_low_budget
2026-01-31 21:31:44 +00:00
shin-bot-litellm
d9da49bc35 fix(mypy): add type: ignore for conditional function variants in MCP modules
The mypy error 'All conditional function variants have identical signatures'
occurs when defining fallback functions in try/except ImportError blocks.
Adding '# type: ignore[misc]' suppresses this false positive.

Fixes:
- mcp_server_manager.py:80 - validate_tool_name fallback
- mcp_management_endpoints.py:72 - validate_tool_name fallback
2026-01-31 21:31:11 +00:00
shin-bot-litellm
f9fbffa7cf ci(security): allowlist GHSA-34x7-hfp2-rc4v (node-tar hardlink)
Not applicable - tar CLI not exposed in application code
2026-01-31 21:27:58 +00:00
shin-bot-litellm
dff7f83e7c fix(proxy): resolve 'multiple values for keyword argument' in batch cancel and file retrieve
- batch_endpoints.py: Pop batch_id from data before creating CancelBatchRequest
  to avoid duplicate batch_id when data already contains it from earlier cast

- files_endpoints.py: Pop file_id from data before calling afile_retrieve
  to avoid duplicate file_id when data was initialized with {"file_id": file_id}

- test_claude_agent_sdk.py: Disable bedrock-nova-premier test as it requires
  an inference profile for on-demand throughput (AWS limitation)

Fixes: e2e_openai_endpoints tests (test_batches_operations, test_file_operations)
Fixes: proxy_e2e_anthropic_messages_tests (nova-premier model skip)
2026-01-31 21:26:29 +00:00
Shin
586b041837 fix(test): update test_chat_completion to handle metadata in body
The proxy now adds metadata to the request body during processing.
Updated test to compare fields individually and strip metadata from
body comparison.

Fixes litellm_proxy_unit_testing_part2 CI failure.
2026-01-31 21:25:39 +00:00
shin-bot-litellm
65fb18b568
fix(mypy): fix validate_tool_name return type signatures (#20184)
Move ToolNameValidationResult class definition outside the fallback function
and use consistent return type annotation to satisfy mypy.

Files fixed:
- proxy/_experimental/mcp_server/mcp_server_manager.py
- proxy/management_endpoints/mcp_management_endpoints.py
2026-01-31 12:45:21 -08:00
shin-bot-litellm
5bd5df3ca6
fix(test): add router.acancel_batch coverage (#20183)
- Add test_router_acancel_batch.py with mock test for router.acancel_batch()
- Add _acancel_batch to ignored list (internal helper tested via public API)

Fixes CI failure in check_code_and_doc_quality job
2026-01-31 12:39:19 -08:00
Ishaan Jaffer
38f5ae8f05 test_budget_reset_and_expires_at_first_of_month 2026-01-31 12:36:53 -08:00
Ishaan Jaffer
852ea7d73d _prepare_vertex_auth_headers 2026-01-31 12:36:53 -08:00
yuneng-jiang
ac1459e150
Merge pull request #20182 from BerriAI/litellm_ui_health_checks
[Fix] Health Endpoints when Callback Objects Defined
2026-01-31 12:30:18 -08:00
yuneng-jiang
b7c45991d8 Fix health endpoints 2026-01-31 12:25:04 -08:00
Ishaan Jaffer
66c7233f61 test_get_session_iterator_thread_safety 2026-01-31 12:05:09 -08:00
Ishaan Jaffer
f1b16d240e test_delete_vector_store_checks_access 2026-01-31 12:05:09 -08:00
Ishaan Jaffer
280e8a9cd7 test_get_image_non_root_uses_var_lib_assets_dir 2026-01-31 12:05:09 -08:00
yuneng-jiang
a81af9a875
Merge pull request #20177 from BerriAI/litellm_global_fallback_fix
[Fix] Model Name During Fallback
2026-01-31 11:59:54 -08:00
yuneng-jiang
c9261c9f37 fix model name during fallback 2026-01-31 11:46:58 -08:00
Ishaan Jaffer
a002907389 fix tar security issue with TAR 2026-01-31 11:46:53 -08:00
shin-bot-litellm
bcc05a67b2
litellm_fix(azure): Fix acancel_batch not using Azure SDK client initialization (#20168)
- Fixed model parameter being overwritten to None in acancel_batch function
- Added dedicated acancel_batch/\_acancel_batch methods in Router
- Properly extracts custom_llm_provider from deployment like acreate_batch

This fixes test_ensure_initialize_azure_sdk_client_always_used[acancel_batch]
which expected azure_batches_instance.initialize_azure_sdk_client to be called.

Co-authored-by: shin-bot-litellm <shin-bot-litellm@users.noreply.github.com>
2026-01-31 11:45:25 -08:00
shin-bot-litellm
14f31a0df9
litellm_fix(lint): remove unused ToolNameValidationResult imports (#20176)
Fixes ruff F401 errors in check_code_and_doc_quality CI job.

**Regression introduced in:** 41ec820 (fix files) - added files with unused imports

## Problem
ToolNameValidationResult is imported but never used in:
- litellm/proxy/_experimental/mcp_server/mcp_server_manager.py
- litellm/proxy/management_endpoints/mcp_management_endpoints.py

## Fix
```diff
-        ToolNameValidationResult,
```

Removed from both import statements.

## Changes
- mcp_server_manager.py: -1 line (removed unused import)
- mcp_management_endpoints.py: -1 line (removed unused import)
2026-01-31 11:33:36 -08:00
Ishaan Jaffer
41ec820562 fix files 2026-01-31 11:25:30 -08:00
Ishaan Jaffer
36dfa0f2ee fix MCP client 2026-01-31 11:25:21 -08:00
Ishaan Jaffer
e6c1a656f4 add _is_bedrock_tool_block 2026-01-31 11:25:10 -08:00
Ishaan Jaffer
8b575f4656 test_bedrock_nova_grounding_web_search_options_non_streaming 2026-01-31 11:23:48 -08:00
Ishaan Jaffer
9fe0819e77 _add_web_search_tool 2026-01-31 11:21:40 -08:00
Ishaan Jaffer
54a383879c fix mcp linting 2026-01-31 11:21:03 -08:00
Ishaan Jaffer
f508a998d4 fix linting 2026-01-31 11:19:59 -08:00
Ishaan Jaffer
08271a8b28 fix transform_retrieve_file_response 2026-01-31 11:16:22 -08:00
Ishaan Jaffer
05552b5194 fix typing 2026-01-31 11:10:53 -08:00
Ishaan Jaffer
3759ea2de8 test_increment_top_level_request_and_spend_metrics 2026-01-31 11:10:28 -08:00
Ishaan Jaffer
d53ef30f75 fix EventDrivenCacheCoordinator 2026-01-31 11:10:17 -08:00
Ishaan Jaffer
4bf4e7954e fix gemini files 2026-01-31 11:06:22 -08:00
Ishaan Jaffer
df7ea193f4 fix proxy extras pip 2026-01-31 10:52:35 -08:00
Cesar Garcia
3fa7ab1012
docs(embeddings): add supported input formats section (#20073)
Document valid input formats for /v1/embeddings endpoint per OpenAI spec.
Clarifies that array of string arrays is not a valid format.
2026-01-31 10:45:56 -08:00
shin-bot-litellm
244c80a7de
litellm_fix(router): use safe_deep_copy in _get_silent_experiment_kwargs (#20170)
**Regression introduced in:** PR #19544 (feat: add feature to make silent calls)

Fixes check_code_and_doc_quality CI failure.

Line 1332 used copy.deepcopy(kwargs) which violates ban_copy_deepcopy_kwargs
check. kwargs can contain non-serializable objects like OTEL spans.

Changed to safe_deep_copy(kwargs) which handles these correctly.
2026-01-31 10:38:47 -08:00
shin-bot-litellm
df042f7545
litellm_fix(security): allowlist Next.js CVEs for 7 days (#20169)
Temporarily allowlist Next.js vulnerabilities in UI dashboard:
- GHSA-h25m-26qc-wcjf (HIGH: DoS via request deserialization)
- CVE-2025-59471 (MEDIUM: Image Optimizer DoS)

Fix: Upgrade to Next.js 15.5.10+ or 16.1.5+ (7-day timeline)

Changes:
- Added .trivyignore with Next.js CVEs
- Updated security_scans.sh to use --ignorefile flag
2026-01-31 10:25:57 -08:00
shin-bot-litellm
5434b66b9c
litellm_fix(mypy): fix remaining type errors (#20164)
- route_llm_request.py: add acancel_batch and afile_delete to route_type Literal
- router.py: add SearchToolInfoTypedDict and search_tool_info to SearchToolTypedDict
- gemini/files/transformation.py: fix validate_environment signature to match base class
- responses transformation.py: fix Dict type annotations to use int instead of Optional[int]
- vector_stores/endpoints.py: add team_id and user_id to LiteLLM_ManagedVectorStoresTable constructor

Co-authored-by: shin-bot-litellm <shin-bot-litellm@users.noreply.github.com>
2026-01-31 10:25:23 -08:00
shin-bot-litellm
ea011633d7
litellm_fix: bump litellm-proxy-extras version to 0.4.28 (#20166)
Changes were made to litellm_proxy_extras (schema.prisma, utils.py, migrations)
but version was not bumped, causing CI publish job to fail.

This commit bumps the version from 0.4.27 to 0.4.28 in all required files:
- litellm-proxy-extras/pyproject.toml
- requirements.txt
- pyproject.toml

Co-authored-by: shin-bot-litellm <shin-bot-litellm@users.noreply.github.com>
2026-01-31 10:23:17 -08:00
shin-bot-litellm
fea40925cf
test: remove hosted_vllm from OpenAI client tests (#20163)
hosted_vllm no longer uses the OpenAI client, so these tests
that mock the OpenAI client are not applicable to hosted_vllm.

Removes hosted_vllm from:
- test_openai_compatible_custom_api_base
- test_openai_compatible_custom_api_video
2026-01-31 10:10:45 -08:00
shin-bot-litellm
2780e2f81e
litellm_fix(test): update Prometheus metric test assertions with new labels (#20162)
This fixes the failing litellm_mapped_enterprise_tests (metrics/logging) job.

Recent commits added new labels to several Prometheus metrics (model_id, client_ip, user_agent)
but the test assertions weren't fully updated to expect these new labels.

Tests fixed:
- test_async_post_call_failure_hook
- test_async_log_failure_event
- test_increment_token_metrics
- test_log_failure_fallback_event
- test_set_latency_metrics
- test_set_llm_deployment_success_metrics

Labels added to test assertions:
- model_id for token metrics (litellm_tokens_metric, litellm_input_tokens_metric, litellm_output_tokens_metric)
- model_id for latency metrics (litellm_llm_api_latency_metric)
- model_id for remaining requests/tokens metrics
- model_id for fallback metrics
- model_id for overhead latency metric
- client_ip and user_agent for deployment failure/total/success responses
- client_ip and user_agent for proxy failed/total requests metrics
2026-01-31 10:09:35 -08:00
shin-bot-litellm
6c497d2990
fix(mypy): fix type errors in files, opentelemetry, gemini transformation, and key management (#20161)
- files/main.py: rename uuid import to uuid_module to avoid conflict with router import
- integrations/opentelemetry.py: add fallback for callback_name to ensure str type
- llms/gemini/files/transformation.py: add type annotation for params dict
- proxy/management_endpoints/key_management_endpoints.py: add null check for prisma_client
2026-01-31 10:09:07 -08:00
shin-bot-litellm
1b438144dd
litellm_fix: handle empty dict for web_search_options in Nova grounding (#20159)
The condition `value and isinstance(value, dict)` fails for empty dicts
because `{}` is falsy in Python. Users commonly pass `web_search_options={}`
to enable Nova grounding without specifying additional options.

Changed the condition to `isinstance(value, dict)` which correctly handles
both empty and non-empty dicts.

Fixes failing tests:
- test_bedrock_nova_grounding_async
- test_bedrock_nova_grounding_request_transformation
- test_bedrock_nova_grounding_web_search_options_non_streaming
- test_bedrock_nova_grounding_with_function_tools
2026-01-31 10:05:30 -08:00
shin-bot-litellm
d5bc80bca9
fix(datadog): check for agent mode before requiring DD_API_KEY/DD_SITE (#20156)
The DataDog LLM Obs logger was checking for DD_API_KEY and DD_SITE
before checking if agent mode (LITELLM_DD_AGENT_HOST) was configured.
In agent mode, the DataDog agent handles authentication, so these
environment variables are not required.

This fix moves the agent mode check first, and only validates
DD_API_KEY and DD_SITE when using direct API mode.

Fixes test_datadog_llm_obs_agent_configuration and
test_datadog_llm_obs_agent_no_api_key_ok
2026-01-31 09:53:16 -08:00
shin-bot-litellm
2f6d18e6bc
fix(proxy): use get_async_httpx_client for logo download (#20155)
Replace direct AsyncHTTPHandler instantiation with get_async_httpx_client
to avoid +500ms latency per request from creating new async clients.

Added httpxSpecialProvider.UI for UI-related HTTP requests like logo downloads.
2026-01-31 09:51:16 -08:00
yuneng-jiang
f2cb31a45e
Merge pull request #20154 from BerriAI/ui_build_yj_jan_31
[Infa] UI Build
2026-01-31 09:21:13 -08:00
yuneng-jiang
87b4da4ae5 chore: update Next.js build artifacts (2026-01-31 17:20 UTC, node v22.16.0) 2026-01-31 09:20:08 -08:00
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
yuneng-jiang
c4a2745983
Merge pull request #20031 from BerriAI/litellm_new_badge_dot
[Fix] UI - Vector Store: Allow Config Defined Models to Be Selected
2026-01-31 09:13:29 -08:00
yuneng-jiang
b366335f2f
Merge pull request #20098 from BerriAI/litellm_ui_dark_mode_2
[Feature] UI - Dark Mode: Delete Resource Modal
2026-01-31 09:03:11 -08:00