Commit Graph
100 Commits
Author SHA1 Message Date
Yuneng Jiang 000ce70127 Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_migration_projects
# Conflicts:
#	litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py
#	uv.lock
2026-04-24 12:52:10 -07:00
Ryan Crabbe 4d2acafa43 Split MCP routes into inference vs management categories
MCP server CRUD endpoints (/v1/mcp/server*) were bundled with MCP
tool-call / passthrough endpoints under llm_api_routes, so setting
DISABLE_LLM_API_ENDPOINTS=true on admin-only nodes also blocked the
Admin UI from listing, adding, or attaching MCP servers.

Separate mcp_inference_routes (data-plane, gated by
DISABLE_LLM_API_ENDPOINTS) from mcp_management_routes (control-plane,
gated by DISABLE_ADMIN_ENDPOINTS). Keep mcp_routes as a union for
backward compat with allowed_routes=["mcp_routes"] virtual key configs.

Upgrade is_management_route to pattern-aware matching so
/v1/mcp/server/{path:path} resolves for concrete IDs.
2026-04-23 16:52:45 -07:00
harish-berri 5df3287016 fixing backwards compatibility for tests 2026-04-17 18:08:48 +00:00
Sameer Kankute 4b5c86b8a1 Fix code qa 2026-04-16 19:29:08 +05:30
Yuneng Jiang 084dc710b5 [Fix] Proxy: resolve CI fallout from projects migration
- workflow proxy-config matrix: drop test_project*.py glob now that the
  test lives under tests/enterprise/
- update uv.lock to match bumped litellm version
- fix mypy: loosen FieldInfo annotation on register_extra_ui_setting
  (pydantic.Field stubs report the default's type) and silence
  create_model overload resolution when passing **tuple_dict
- fix inline imports in moved test_project_endpoints_prisma.py to
  target litellm_enterprise.proxy.management_endpoints.project_endpoints
2026-04-13 21:49:30 -07:00
Yuneng Jiang d3a1f63af2 [Refactor] Proxy: move projects management to enterprise package
Remove the /project/* management endpoints and the enable_projects_ui
admin-settings flag from the OSS litellm package. Project endpoints now
live under litellm_enterprise and are wired through the existing
enterprise router; OSS builds return 404 for every /project/* route.

The enable_projects_ui UI flag is registered back onto UISettings via a
small extension registry when the enterprise package is imported, so the
admin toggle and downstream key/sidebar gating continue to work in
enterprise builds. On OSS, explicit PATCH attempts with the flag return
403 with a clear enterprise-only message instead of being silently
dropped.

Pydantic request/response types (NewProjectRequest, UpdateProjectRequest,
DeleteProjectRequest, NewProjectResponse) stay in litellm/proxy/_types.py
because management_endpoints/common_utils.py and pydantic-shape tests
import them. LiteLLM_ProjectTable and all FK columns in schema.prisma
are unchanged.
2026-04-13 21:41:12 -07:00
+2 f42ffed2bd Litellm oss staging 04 02 2026 p1 (#25055)
* fix(vertex_ai): support pluggable (executable) credential_source for WIF auth (#24700)

The WIF credential dispatch in load_auth() only handled identity_pool and
aws credential types. When credential_source.executable was present (used
for Azure Managed Identity via Workload Identity Federation), it fell
through to identity_pool.Credentials which rejected it with MalformedError.

Add dispatch to google.auth.pluggable.Credentials for executable-type
credential sources, following the same pattern as the existing identity_pool
and aws helpers.

Fixes authentication for Azure Container Apps → GCP Vertex AI via WIF
with executable credential sources.

* feat(logging): add component and logger fields to JSON logs for 3rd p… (#24447)

* feat(logging): add component and logger fields to JSON logs for 3rd party filtering

* Let user-supplied extra fields win over auto-generated component/logger, tighten test assertions

* Feat - Add organization into the metrics metadata for org_id & org_alias (#24440)

* Add org_id and org_alias label names to Prometheus metric definitions

* Add user_api_key_org_alias to StandardLoggingUserAPIKeyMetadata

* Populate user_api_key_org_alias in pre-call metadata

* Pass org_id and org_alias into per-request Prometheus metric labels

* Add test for org labels on per-request Prometheus metrics

* chore: resolve test mockdata

* Address review: populate org_alias from DB view, add feature flag, use .get() for org metadata

* Add org labels to failure path and verify flag behavior in test

* Fix test: build flag-off enum_values without org fields

* Gate org labels behind feature flag in get_labels() instead of static metric lists

* Scope org label injection to metrics that carry team context, remove orphaned budget label defs, add test teardown

* Use explicit metric allowlist for org label injection instead of team heuristic

* Fix duplicate org label guard, move _org_label_metrics to class constant

* Reset custom_prometheus_metadata_labels after duplicate label assertion

* fix: emit org labels by default, remove flag, fix missing org_alias in all metadata paths

* fix: emit org labels by default, no opt-in flag required

* fix: write org_alias to metadata unconditionally in proxy_server.py

* fix: 429s from batch creation being converted to 500 (#24703)

* add us gov models (#24660)

* add us gov models

* added max tokens

* Litellm dev 04 02 2026 p1 (#25052)

* fix: replace hardcoded url

* fix: Anthropic web search cost not tracked for Chat Completions

The ModelResponse branch in response_object_includes_web_search_call()
only checked url_citation annotations and prompt_tokens_details, missing
Anthropic's server_tool_use.web_search_requests field. This caused
_handle_web_search_cost() to never fire for Anthropic Claude models.

Also routes vertex_ai/claude-* models to the Anthropic cost calculator
instead of the Gemini one, since Claude on Vertex uses the same
server_tool_use billing structure as the direct Anthropic API.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* fix(anthropic): pass logging_obj to client.post for litellm_overhead_time_ms (#24071)

When LITELLM_DETAILED_TIMING=true, litellm_overhead_time_ms was null for
Anthropic because the handler did not pass logging_obj to client.post(),
so track_llm_api_timing could not set llm_api_duration_ms. Pass
logging_obj=logging_obj at all four post() call sites (make_call,
make_sync_call, acompletion, completion). Add test to ensure make_call
passes logging_obj to client.post.

Made-with: Cursor

* sap - add additional parameters for grounding

- additional parameter for grounding added for the sap provider

* sap - fix models

* (sap) add filtering, masking, translation SAP GEN AI Hub modules

* (sap) add tests and docs for new SAP modules

* (sap) add support of multiple modules config

* (sap) code refactoring

* (sap) rename file

* test(): add safeguard tests

* (sap) update tests

* (sap) update docs, solve merge conflict in transformation.py

* (sap) linter fix

* (sap) Align embedding request transformation with current API

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) mock commit

* (sap) run black formater

* (sap) add literals to models, add negative tests, fix test for tool transformation

* (sap) fix formating

* (sap) fix models

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) commit for rerun bot review

* (sap) minor improve

* (sap) fix after bot review

* (sap) lint fix

* docs(sap): update documentation

* fix(sap): change creds priority

* fix(sap): change creds priority

* fix(sap): fix sap creds unit test

* fix(sap): linter fix

* fix(sap): linter fix

* linter fix

* (sap) update logic of fetching creds, add additional tests

* (sap) clean up code

* (sap) fix after review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) add a possibility to put the service key by both variants

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) update test

* (sap) update service key resolve function

* (sap) run black formater

* (sap) fix validate credentials, add negative tests for credential fetching

* (sap) fix validate credentials, add negative tests for credential fetching

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) fix after bot review

* (sap) lint fix

* (sap) lint fix

* feat: support service_tier in gemini

* chore: add a service_tier field mapping from openai to gemini

* fix: use x-gemini-service-tier header in response

* docs: add service_tier to gemini docs

* chore: add defaut/standard mapping, and some tests

* chore: tidying up some case insensitivity

* chore: remove unnecessary guard

* fix: remove redundant test file

* fix: handle 'auto' case-insensitively

* fix: return service_tier on final steamed chunk

* chore: black

* feat: enable supports_service_tier to gemini models

* Fix get_standard_logging_metadata tests

* Fix test_get_model_info_bedrock_models

* Fix test_get_model_info_bedrock_models

* Fix remaining tests

* Fix mypy issues

* Fix tests

* Fix merge conflicts

* Fix code qa

* Fix code qa

* Fix code qa

* Fix greptile review

---------

Co-authored-by: michelligabriele <gabriele.michelli@icloud.com>
Co-authored-by: Josh <36064836+J-Byron@users.noreply.github.com>
Co-authored-by: mubashir1osmani <mubashir.osmani777@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: milan-berri <milan@berri.ai>
Co-authored-by: Alperen Kömürcü <alperen.koemuercue@sap.com>
Co-authored-by: Vasilisa Parshikova <vasilisa.parshikova@sap.com>
Co-authored-by: Lin Xu <lin.xu03@sap.com>
Co-authored-by: Mark McDonald <macd@google.com>
Co-authored-by: Sameer Kankute <sameer@berri.ai>
2026-04-08 21:37:10 -07:00
Ishaan Jaffer 83dc158a2a test fix 2026-03-30 18:08:57 -07:00
Ishaan Jaffer 6c3de43fcf test_enterprise_custom_auth_returns_string 2026-03-30 17:43:58 -07:00
Krrish Dholakia bc829d51f2 test: test 2026-03-28 19:17:38 -07:00
Sameer Kankute 22b333cae6 Fix downloading vertex ai files 2026-03-16 12:08:06 +05:30
Harshit28j f18f4e3bbd feat: allow multiple calls from tags 2026-03-07 11:24:18 +05:30
Harshit28j d661419109 fix: support list of modes in Mode.default for tag-based guardrails 2026-03-04 01:50:28 +05:30
Ephrim Stanley b16397ae1a Managed batches fixes for Gemini/Vertex 2026-02-28 20:45:16 -05:00
yuneng-jiangandClaude Haiku 4.5 0e1428b59d remove orphan comment from test file
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-02-26 16:51:18 -08:00
Shivam RawatGitHubgreptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
d448682291 fix: prevent double-counting of litellm_proxy_total_requests_metric (#21159)
* fixed double counting

* Update litellm/proxy/utils.py

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

* reverse prev commit

* Update litellm/proxy/utils.py

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

* removed else branch

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-16 09:10:49 -08:00
Shivam RawatandSameer Kankute 1321cd276b removed /models and v1/models from llm api routes (#20988) 2026-02-13 18:32:41 +05:30
Sameer KankuteandGitHub cdab87dec0 Merge pull request #20838 from BerriAI/litellm_managed_error_file
Add support managed error file
2026-02-10 18:20:26 +05:30
Sameer Kankute 63eedc26b0 Fix test_async_post_call_success_hook_for_unified_finetuning_job 2026-02-10 18:08:23 +05:30
Shivam RawatandSameer Kankute 90cd6538d4 added functionality to propagate bedrock guardrail errors down to litellm (#20395) 2026-02-10 16:12:13 +05:30
Sameer Kankute 45c8edbe25 Fix: Bug: Batch Rate Limiter Cannot Access User Files 2026-02-10 12:25:26 +05:30
Sameer Kankute 9bdb163269 Add error file ids as managed files 2026-02-10 12:06:40 +05:30
Harshit JainandGitHub 37aee120a0 fixes content blocked by bedrock (#20606) 2026-02-07 11:02:12 -08:00
Sameer KankuteandGitHub 8b563a7641 Merge pull request #20402 from BerriAI/litellm_responses_tools_file_ids
Add mapping for responses tools in file ids
2026-02-04 18:09:39 +05:30
Sameer Kankute 8b3213ce5c Add mapping for responses tools in file ids 2026-02-04 13:12:45 +05:30
04c348e7bb fixes failure metrics labels (#20152)
Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
2026-02-02 19:20:14 -08:00
Ishaan Jaffer 3759ea2de8 test_increment_top_level_request_and_spend_metrics 2026-01-31 11:10:28 -08:00
shin-bot-litellmandGitHub 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
Sameer Kankute fa2b065238 Add tests for user level permissions on file and batch access 2026-01-29 12:29:10 +05:30
Sameer Kankute 70684ca86f Fix File access permissions for .retreive and .delete 2026-01-29 11:19:24 +05:30
Sameer KankuteandGitHub 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 KankuteandGitHub 42a0d576f3 Merge pull request #19910 from BerriAI/main
merge 01 27
2026-01-28 08:30:47 +05:30
michelligabrieleandGitHub fc7a9b4cb0 fix(enterprise): correct error message for DISABLE_ADMIN_ENDPOINTS (#19861)
The error message for DISABLE_ADMIN_ENDPOINTS incorrectly said
"DISABLING LLM API ENDPOINTS is an Enterprise feature" instead of
"DISABLING ADMIN ENDPOINTS is an Enterprise feature".

This was a copy-paste bug from the is_llm_api_route_disabled() function.

Added regression tests to verify both error messages are correct.
2026-01-27 09:34:30 -08:00
Sameer KankuteandGitHub f98eba24d4 Merge pull request #19040 from Point72/ephrimstanley/batch-list
Fix /batches to return encoded ids (from managed objects table)
2026-01-27 13:02:05 +05:30
6a54dcfa93 feat: Add model_id label to Prometheus metrics (#18048) (#19678)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-01-26 20:32:08 -08:00
Ephrim Stanley 88280d9cca Fix batch creation to return the input file's expires_at attribute 2026-01-26 12:02:35 -05:00
Ephrim Stanley caa2c57619 Fix /batches to return encoded ids (from managed objects table) 2026-01-26 10:36:43 -05:00
Sameer Kankute 2820a51950 Add otel providers and langfuse for litellm_callback_logging_failures_metric_total 2026-01-23 19:40:15 +05:30
yuneng-jiang dbe6f66baf updating promethus tests 2026-01-22 11:01:01 -08:00
yuneng-jiang f92f231954 Merge remote-tracking branch 'origin' into litellm_user_promethus_metrics 2026-01-13 16:27:08 -08:00
Sameer KankuteandGitHub a727aa9980 Merge pull request #18340 from Point72/ephrimstanley/fix-batch
Fix batch deletion and retrieve
2026-01-13 08:13:43 +05:30
Ishaan Jaffer 69aaad5e69 Revert "added extraction of top level metadata for custom lables in prometheus callbacks (#18087)"
This reverts commit 14a4a9c031.
2026-01-10 14:00:54 -08:00
yuneng-jiang 1d06cb90e2 Fixing test 2026-01-09 11:51:07 -08:00
Sameer Kankute 386ea1354a fix: async def test_bedrock_apply_guardrail_blocked() 2026-01-06 14:15:06 +05:30
Ephrim Stanley 103633c794 Fix linter errors: remove unused imports and variables 2025-12-23 12:59:22 -05:00
Ephrim Stanley 479e40672e Add end to end integration tests for batches 2025-12-23 12:55:09 -05:00
Shivam RawatandGitHub 14a4a9c031 added extraction of top level metadata for custom lables in prometheus callbacks (#18087) 2025-12-17 11:17:12 +05:30
Vinnie GiarrussoandGitHub 78012ad9a9 fix(prometheus): add 'exception_status' to prometheus logger (#17847)
* fix(prometheus): add 'exception_status' to prometheus logger

* use existing prometheuslogger

* remove unneeded test
2025-12-12 03:57:46 -08:00
Alexsander HamirandGitHub 655e04f16c Fix: apply_guardrail method and improve test isolation (#17555)
* Fix Bedrock guardrail apply_guardrail method and test mocks

Fixed 4 failing tests in the guardrail test suite:

1. BedrockGuardrail.apply_guardrail now returns original texts when guardrail
   allows content but doesn't provide output/outputs fields. Previously returned
   empty list, causing test_bedrock_apply_guardrail_success to fail.

2. Updated test mocks to use correct Bedrock API response format:
   - Changed from 'content' field to 'output' field
   - Fixed nested structure from {'text': {'text': '...'}} to {'text': '...'}
   - Added missing 'output' field in filter test

3. Fixed endpoint test mocks to return GenericGuardrailAPIInputs format:
   - Changed from tuple (List[str], Optional[List[str]]) to dict {'texts': [...]}
   - Updated method call assertions to use 'inputs' parameter correctly

All 12 guardrail tests now pass successfully.

* fix: remove python3-dev from Dockerfile.build_from_pip to avoid Python version conflict

The base image cgr.dev/chainguard/python:latest-dev already includes Python 3.14
and its development tools. Installing python3-dev pulls Python 3.13 packages
which conflict with the existing Python 3.14 installation, causing file
ownership errors during apk install.

* fix: disable callbacks in vertex fine-tuning tests to prevent Datadog logging interference

The test was failing because Datadog logging was making an HTTP POST request
that was being caught by the mock, causing assert_called_once() to fail.
By disabling callbacks during the test, we prevent Datadog from making any
HTTP calls, allowing the mock to only see the Vertex AI API call.

* fix: ensure test isolation in test_logging_non_streaming_request

Add proper cleanup to restore original litellm.callbacks after test execution.
This prevents test interference when running as part of a larger test suite,
where global state pollution was causing async_log_success_event to be
called multiple times instead of once.

Fixes test failure where the test expected async_log_success_event to be
called once but was being called twice due to callbacks from previous tests
not being cleaned up.
2025-12-05 12:59:35 -08:00
Krish DholakiaandGitHub 32013f63a0 Guardrail API - support tool call checks on OpenAI /chat/completions, OpenAI /responses, Anthropic /v1/messages (#17459)
* fix(unified_guardrail.py): correctly map a v1/messages call to the anthropic unified guardrail

* fix: add more rigorous call type checks

* fix(anthropic_endpoints/endpoints.py): initialize logging object at the beginning of endpoint

ensures call id + trace id are emitted to guardrail api

* feat(anthropic/chat/guardrail_translation): support streaming guardrails

sample on every 5 chunks

* fix(openai/chat/guardrail_translation): support openai streaming guardrails

* fix: initial commit fixing output guardrails for responses api

* feat(openai/responses/guardrail_translation): handler.py - fix output checks on responses api

* fix(openai/responses/guardrail_translation/handler.py): ensure responses api guardrails work on streaming

* test: update tests

* test: update tests

* fix: support multiple kinds of input to the guardrail api

* feat(guardrail_translation/handler.py): support extracting tool calls from openai chat completions for guardrail api's

* feat(generic_guardrail_api.py): support extracting + returning modified tool calls on generic_guardrails_api

allows guardrail api to analyze tool call being sent to provider - to run any analysis on it

* fix(guardrails.py): support anthropic /v1/messages tool calls

* feat(responses_api/): extract tool calls for guardrail processing

* docs(generic_guardrail_api.md): document tools param support

* docs: generic_guardrail_api.md

improve documentation
2025-12-03 21:20:39 -08:00