Commit Graph
37219 Commits
Author SHA1 Message Date
265a960472 fix(noma-v2): fall back to key_alias for application_id in Noma dashboard (#25795)
Noma v1 resolved application_id from user_api_key_alias when no explicit
value was set (PR #16832). Noma v2 (PR #21400) was rewritten from scratch
and this fallback was not ported, causing all requests from shared LiteLLM
instances to appear as a single generic "litellm" application in the Noma
dashboard — breaking per-user traceability.

Fix: after checking dynamic_params and self.application_id, fall back to
user_api_key_alias from litellm_metadata or metadata. This matches the
pattern used by PromptSecurityGuardrail._resolve_key_alias_from_request_data()
and restores the v1 behavior where each API key gets its own application
entry in the Noma dashboard.

Fixes #25794

Co-authored-by: Brendan Smith-Elion <brendan.smith-elion@arcadia.io>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 19:04:24 +05:30
Jared EverettSameer KankuteClaude Sonnet 4.6greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
3cbb36aa13 fix(ollama): propagate done_reason='length' as finish_reason for max_tokens truncation (#25824)
* fix(ollama): propagate done_reason='length' as finish_reason for max_tokens truncation

Ollama returns done_reason='length' when a response is cut off by num_predict
(the max_tokens limit). Previously, non-streaming responses hardcoded
finish_reason='stop', and streaming used chunk.get('done_reason', 'stop')
which also defaulted to 'stop' when done_reason was absent.

This meant callers (e.g. the Anthropic pass-through adapter, which maps
OpenAI 'length' -> Anthropic 'max_tokens') could never detect truncation,
making stop_reason always appear as 'end_turn' even for cut-off responses.

Fix: read done_reason from the response JSON in the non-streaming path and
use `chunk.get('done_reason') or 'stop'` in the streaming path, so Ollama's
actual done_reason passes through to the caller unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Update test_ollama_chat_transformation.py

* Update litellm/llms/ollama/chat/transformation.py

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-04-16 19:03:41 +05:30
6b2973b29a fix(vertex): strip version suffix from model name in count_tokens requests (#25800)
The Vertex AI count-tokens endpoint rejects model names that include
version suffixes (@default, @20251001, etc.) with:
"claude-sonnet-4-6@default is not supported for token counting"

The same model without the suffix ("claude-sonnet-4-6") works correctly.

Strip @suffix from both the model parameter and request_data["model"]
in handle_count_tokens_request before sending to the API.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 19:03:40 +05:30
ryan-crabbe-berriandGitHub ed0138b50e Merge pull request #25812 from BerriAI/litellm_fix-invalidate-orgs-on-team-mutation
fix(ui): invalidate org queries after team mutations
2026-04-15 22:51:20 -07:00
ryan-crabbe-berriandGitHub 18c93e0ccd Merge pull request #25809 from BerriAI/litellm_fix_tool_test_panel_bool_rendering
fix(ui): use antd Select for MCP ToolTestPanel bool inputs
2026-04-15 22:50:57 -07:00
ryan-crabbe-berriandGitHub cf4f0516be Merge pull request #25806 from BerriAI/litellm_fix_guardrail_optional_params_bool_rendering
fix(ui): render guardrail optional_params bool defaults in Select
2026-04-15 22:50:20 -07:00
Ryan Crabbe 96415a5ac2 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_fix-invalidate-orgs-on-team-mutation 2026-04-15 22:41:38 -07:00
Ryan Crabbe 83095c24c6 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_fix_tool_test_panel_bool_rendering 2026-04-15 22:41:09 -07:00
Ryan Crabbe bbf204e602 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_fix_guardrail_optional_params_bool_rendering 2026-04-15 22:40:37 -07:00
ryan-crabbe-berriandGitHub 2dd060b4e4 Merge pull request #25838 from BerriAI/litellm_fix-virtual-key-projected-spend-alert
fix(proxy): fix virtual key projected-spend soft budget alerts
2026-04-15 22:22:33 -07:00
Ryan Crabbe f639769ca9 fix(proxy): use flat soft_budget field for virtual key projected-spend alerts
The projected-spend alert in _update_key_cache read from
existing_spend_obj.litellm_budget_table["soft_budget"], but the nested
dict is never populated for virtual keys (the combined_view SQL maps
budget fields to flat top-level attributes instead). This made the
check dead code — it silently short-circuited on every request, and
when unblocked, crashed update_cache with a Pydantic ValidationError
because _get_projected_spend_over_limit returns a date object but
CallInfo.projected_exceeded_date expects str.

Fixes: read from the flat existing_spend_obj.soft_budget field that IS
populated, and stringify projected_exceeded_date.

Also marks team soft budget email alerts as enterprise in docs.

Closes #20324
2026-04-15 21:38:18 -07:00
ishaan-berriandGitHub 0b7335201b Merge pull request #25699 from BerriAI/litellm_ishaan_april14
Litellm ishaan april14
2026-04-15 19:01:06 -07:00
Ishaan Jaffer def9c4ec47 chore: merge litellm_internal_staging, resolve uv.lock conflict 2026-04-15 18:51:19 -07:00
Ishaan Jaffer 26136708bb chore: trigger CI re-evaluation 2026-04-15 18:48:13 -07:00
ishaan-berriandGitHub ae2aba0e15 Merge pull request #25622 from Sameerlite/litellm_docs_cost_discrepancy_guide
docs(troubleshoot): cost discrepancy debugging guide
2026-04-15 18:43:15 -07:00
a588f76789 Litellm ishaan april15 2 (#25828)
* [Test] Add Azure async chat completion timeout test. WIP

* Capture TTFT for /v1/messages streaming responses

The pass-through streaming path for /v1/messages (Anthropic, Bedrock,
Vertex AI, Azure AI, Minimax) logged completion_start_time only after
the entire stream finished. async_success_handler then fell back to
end_time, making TTFT equal to total duration or null in the UI and
Prometheus.

Record the timestamp of the first chunk in async_sse_wrapper and
propagate it to model_call_details before the logging handler runs,
so gen_ai.response.time_to_first_token reflects the real first-chunk
latency.

Fixes #25598

* [Refactor] Implement timeout resolution logic in completion function

add fetch ``request_timeout`` from litellm_settings

* remove stale test case

* remove extra print statement

* default request timeout value in constants to 600s to match timeout defaults handled in the proxy

* fix request timeout if using default value from constants.py

* update code structure, test cases

* only override if the global timeout sets timeout to 6000s

* update code structure, move hard coded values to const and make the reslve function readable by moving fallback logic to a seperate function

* modify default timeout values, replacing hard coded ones with default values defined

---------

Co-authored-by: harish876 <harishgokul01@gmail.com>
Co-authored-by: Joaquin Hui Gomez <joaquinhuigomez@users.noreply.github.com>
2026-04-15 18:42:23 -07:00
Ishaan Jaffer 9977e63e3c Merge remote-tracking branch 'origin/main' into worktree-foamy-jumping-coral 2026-04-15 18:29:55 -07:00
ishaan-berriandGitHub 10131374ee Merge pull request #25813 from BerriAI/litellm_ishaan_april15
Litellm ishaan april15
2026-04-15 18:29:22 -07:00
ishaan-berriandGitHub 7a6b7ade03 Merge pull request #25807 from BerriAI/litellm_fix_provider_headers_in_logging
fix(logging): preserve provider response headers in StandardLoggingPayload
2026-04-15 18:29:03 -07:00
Ishaan Jaffer 537e72c742 style: black format test_mcp_server.py 2026-04-15 18:19:21 -07:00
Ishaan Jaffer fcd71e0026 style: black format test_mcp_server_manager.py 2026-04-15 18:19:17 -07:00
Ishaan Jaffer f768946549 style: black format test_anthropic_common_utils.py 2026-04-15 18:19:12 -07:00
Ishaan Jaffer 9a154a3be7 style: black format test_mcp_sigv4_auth.py 2026-04-15 18:19:08 -07:00
Ishaan Jaffer c8a0fe193f style: black format test_unit_test_caching.py 2026-04-15 18:19:04 -07:00
Ishaan Jaffer 93a90a53be style: black format test_mcp_client.py 2026-04-15 18:19:01 -07:00
Ishaan Jaffer f2a1dbe7c9 style: black format test_health_check_max_tokens.py 2026-04-15 18:18:56 -07:00
Ishaan Jaffer 3847a59d79 style: black format test_model_param_helper.py 2026-04-15 18:18:52 -07:00
Ishaan Jaffer 13952b0b1b style: black format types/mcp_server/mcp_server_manager.py 2026-04-15 18:18:48 -07:00
Ishaan Jaffer 107003a713 style: black format model_param_helper.py 2026-04-15 18:18:45 -07:00
Ishaan Jaffer e5adafc768 style: black format anthropic_messages transformation.py 2026-04-15 18:18:41 -07:00
Ishaan Jaffer 0acd05207b style: black format health_check.py 2026-04-15 18:18:36 -07:00
Ishaan Jaffer 65061b1e3c style: black format mcp server.py 2026-04-15 18:18:33 -07:00
Ishaan Jaffer d8dbb46dcf style: black format mcp_server_manager.py 2026-04-15 18:18:29 -07:00
Ishaan Jaffer 563e05ebfa style: black format _types.py 2026-04-15 18:18:24 -07:00
Ishaan Jaffer c3dbd782f4 style: black format llm_http_handler.py 2026-04-15 18:18:18 -07:00
Ishaan Jaffer 9114b0da96 fix(ci): sync uv.lock with pyproject.toml 2026-04-15 18:16:22 -07:00
ishaan-berriandGitHub cb8fc480e6 Merge pull request #25732 from harish876/health-check-oom
Optimize database query to prevent OOM errors during health checks
2026-04-15 18:13:11 -07:00
f92490c308 fix: make PodLockManager.release_lock atomic compare-and-delete (re-land #21226) (#24466)
* fix: make PodLockManager.release_lock atomic compare-and-delete

Re-lands #21226 (reverted in #21469).

release_lock() previously did GET + compare + DEL in separate calls,
leaving a window where another pod could reacquire the lock between
the GET and DEL, causing a stale owner to delete a live lock.

Fix: use a Redis Lua script for atomic compare-and-delete. Script
registration is cached per PodLockManager instance. Falls back to
the old GET+DEL path for cache backends that don't expose
async_register_script.

Original revert was due to e2e tests running in CI without Redis.
Those tests now carry @pytest.mark.skip(reason="Requires Redis connection.")
so this re-land is safe.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: add Lua fallback on execution error + test coverage gaps

Address Greptile review feedback on #24466:

1. Wrap Lua script execution in try/except — if Redis clears loaded
   scripts (restart) or scripting is disabled, fall back to GET+DEL
   rather than letting the exception propagate and leave the lock held
   until TTL. Reset cached script handle so the next call re-registers.

2. Add test_release_lock_lua_path_emits_released_event — verifies
   _emit_released_lock_event is called when Lua path returns 1.

3. Add test_release_lock_falls_back_to_get_del_when_lua_execution_fails
   — verifies the fallback path is taken and script handle is reset.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 17:33:21 -07:00
yuneng-jiangandGitHub 3914226ed7 Merge pull request #25796 from BerriAI/litellm_yj_apr14
[Infra] Merge dev branch
2026-04-15 17:01:23 -07:00
yuneng-jiangandGitHub 2f72eb6637 Merge pull request #25821 from BerriAI/litellm_/funny-meninsky
[Infra] Remove unused publish_proxy_extras and prisma_schema_sync jobs from CircleCI config
2026-04-15 16:52:01 -07:00
Yuneng Jiang 55f2a898be [Infra] Remove unused publish_proxy_extras and prisma_schema_sync jobs
publish_proxy_extras is superseded by PyPI trusted publishing (OIDC);
the CircleCI project no longer has PYPI_PUBLISH_* credentials configured.
prisma_schema_sync is a leaf smoke test with no dependents, and db push
against the current schema is already exercised by e2e_ui_testing.
2026-04-15 16:43:30 -07:00
yuneng-jiangandGitHub 814fa20399 Merge pull request #25814 from BerriAI/litellm_/elastic-zhukovsky
[Refactor] UI - Deleted Keys/Teams: Enterprise notice banner
2026-04-15 16:05:21 -07:00
Yuneng Jiang 42ab3f94ce Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_yj_apr14 2026-04-15 15:59:45 -07:00
Yuneng Jiang dabf8eaecb Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_/elastic-zhukovsky 2026-04-15 15:55:52 -07:00
harish876 5f99e52fbc Added concurrent index creation. Added necessary disclaimers to index creation.
Index creation is scoped to a single statements and hence
Validated index creation in local env
2026-04-15 22:52:47 +00:00
yuneng-jiangandGitHub bf1c52862e Merge pull request #25819 from BerriAI/litellm_expandCiBranchFilters
[Infra] Expand CI branch filters for non-main PR targets
2026-04-15 15:51:49 -07:00
Yuneng Jiang aff4717494 [Infra] Expand CI branch filters for non-main PR targets
Required test-unit-* and related workflows only triggered on PRs targeting
main, so feature PRs routed through litellm_internal_staging or
litellm_oss_branch never dispatched the full suite. Branch protection
reported BLOCKED even when CircleCI was green.

Expand pull_request and push branch filters to also match
litellm_internal_staging, litellm_oss_branch, and "litellm_**" (using **
so branch names containing "/" also match).
2026-04-15 15:39:57 -07:00
Yuneng Jiang de7aad9def [Feature] UI - Deleted Keys/Teams: Add Enterprise notice banner
Show an info banner on the Deleted Keys and Deleted Teams pages for
non-premium users indicating that deleted-record auditing is graduating
from beta into the Enterprise audit & compliance suite.
2026-04-15 13:55:13 -07:00
ishaan-berriandGitHub d8ceeb83b7 Merge pull request #25810 from BerriAI/litellm_bedrock_api_response_null_type_handling
bedrock api response null type handling
2026-04-15 13:52:42 -07:00
Ryan Crabbe 18afe6ab64 test(ui): update organization_view tests for useOrganization hook
Replace the organizationInfoCall mock with a vi.mock of the
useOrganizations hook module that stubs useOrganization (and
organizationKeys, which the component still imports for invalidation).
Each test now sets mockUseOrganization.mockReturnValue(...) instead of
mocking the underlying network call, matching the existing pattern in
TeamInfo.test.tsx.

Renders go through the canonical renderWithProviders helper from
tests/test-utils so the component's useQueryClient() call has a
QueryClientProvider in context. This is the standard wrapper used by
~96 other test files in the dashboard.

Fixes "No QueryClient set" failures in the 4 organization_view tests
introduced by the imperative-fetch -> useOrganization migration.
2026-04-15 13:47:13 -07:00