Commit Graph

1027 Commits

Author SHA1 Message Date
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
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 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 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 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
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
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 cb8ead6013 Add error_message search in spend logs endpoint 2026-01-28 15:06:31 -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
yuneng-jiang 28ca991296 Allow dynamic setting of store_prompts_in_spend_logs 2026-01-27 20:52:07 -08:00
Harshit Jain d0939075bc fix: guardrails issues streaming-response regex (#19901) 2026-01-27 17:36:18 -08:00
yuneng-jiang 1581bcf985 add sortBy and sortOrder params for /v2/model/info 2026-01-27 16:54:52 -08:00
yuneng-jiang 1411a227aa bulk update keys endpoint 2026-01-27 13:58:32 -08:00
yuneng-jiang 45954155d7 Merge pull request #19799 from BerriAI/litellm_sso_email_casing
[Fix] SSO Email Case Sensitivity
2026-01-27 09:52:03 -08:00
yuneng-jiang 50612715a5 Merge pull request #19814 from BerriAI/litellm_team_member_add_fix
[Fix] /team/member_add User Email and ID Verifications
2026-01-27 09:49:01 -08:00
michelligabriele 388b4c90b6 fix(proxy): handle agent parameter in /interactions endpoint (#19866) 2026-01-27 09:34:58 -08:00
Sameer Kankute 0214cb04cd Merge branch 'main' into litellm_oss_staging_01_26_2026 2026-01-27 17:00:58 +05:30
Sameer Kankute adf6d7e1db Merge pull request #19692 from BerriAI/litellm_oss_staging_01_24_2026
Litellm oss staging 01 24 2026
2026-01-27 16:59:28 +05:30
yuneng-jiang b10f71d583 fixing breaking change: just user_id provided should upsert still 2026-01-26 18:10:51 -08:00
Alexsander Hamir c442fcd922 CI/CD: Increase retries and stabilize litellm_mapped_tests_core (#19826)
* Fix PLR0915: Extract system message handling to reduce statement count

* fix mypy

* fix: add host_progress_callback parameter to mock_call_tool in test

The test_call_tool_without_broken_pipe_error was failing because the mock function did not accept the host_progress_callback keyword argument that the actual implementation passes to client.call_tool(). Updated the mock to accept this parameter to match the real implementation signature.

* fixing flaky tests around oidc and email

* Add documentation comment to test file

* add retry

* add dependency

* increase retry

---------

Co-authored-by: yuneng-jiang <yuneng.jiang@gmail.com>
2026-01-26 17:00:18 -08:00
mubashir1osmani 8908eff7b1 Fix(#19781): Unable to reset user max budget to unlimited
Fix(#19781): Unable to reset user max budget to unlimited
2026-01-26 18:37:49 -05:00
Ishaan Jaff cec1a3c858 [Feat] CLI Auth - Add configurable CLI JWT expiration via environment variable (#19780)
* fix: add CLI_JWT_EXPIRATION_HOURS

* docs: CLI_JWT_EXPIRATION_HOURS

* fix: get_cli_jwt_auth_token

* test_get_cli_jwt_auth_token_custom_expiration
2026-01-26 14:56:17 -08:00
yuneng-jiang f879b8b1cb fixing team member add 2026-01-26 14:35:35 -08:00
yuneng-jiang 4ee00cfda5 fix sso email case sensitivity 2026-01-26 10:33:57 -08:00
yogeshwaran10 228aff9b9f Fix user max budget reset to unlimited
- Added a Pydantic validator to convert empty string inputs for max_budget to None, preventing float parsing errors from the frontend.
- Modified the internal user update logic to explicitly allow max_budget to be None, ensuring the value isn't filtered out and can be reset to unlimited in the database.
- Added unit tests for validation and logic.

 Closes #19781
2026-01-26 23:30:36 +05:30
michelligabriele 558f01e848 fix(proxy): use return value from CustomLogger.async_post_call_success_hook (#19670)
* fix(proxy): use return value from CustomLogger.async_post_call_success_hook

Previously the return value was ignored for CustomLogger callbacks,
preventing users from modifying responses. Now the return value is
captured and used to replace the response (if not None), consistent
with CustomGuardrail and streaming iterator hook behavior.

Fixes issue with custom_callbacks not being able to inject data into
LLM responses.

* fix(proxy): also fix async_post_call_streaming_hook to use return value

Previously the streaming hook only used return values that started with
"data: " (SSE format). Now any non-None return value is used, consistent
with async_post_call_success_hook and streaming iterator hook behavior.

Added tests for streaming hook transformation.

---------

Co-authored-by: Gabriele Michelli <michelligabriele0@gmail.com>
2026-01-26 08:48:22 -08:00
Tamir Kiviti aa8134fee9 add timeout to onyx guardrail (#19731)
* add timeout to onyx guardrail

* add tests
2026-01-25 23:13:46 -08:00
Jay Prajapati 582d324a76 fix(proxy): support slashes in google generateContent model names (#19737)
* fix(proxy): support slashes in google route params

* fix(proxy): extract google model ids with slashes

* test(proxy): cover google model ids with slashes
2026-01-25 22:59:50 -08:00
Harshit Jain 6df0406cf6 fix: args issue & refactor into helper function to reduce bloat for both(#19441) 2026-01-25 10:21:20 +05:30
Harshit Jain 05fdd099ba fix(presidio): resolve runtime error by handling asyncio loops in bac… (#19714)
* fix(presidio): resolve runtime error by handling asyncio loops in background threads

* add test case for thread safety
2026-01-24 15:36:49 -08:00
yuneng-jiang 99e9462ec9 Merge pull request #19713 from BerriAI/litellm_model_search_id_team
[Feature] UI - Model Page: Filter by Model ID and Team ID
2026-01-24 15:04:20 -08:00
yuneng-jiang 47810f1523 Model and Team filtering 2026-01-24 14:45:14 -08:00
Ishaan Jaffer 31a4cb65bf test_get_default_unvicorn_init_args 2026-01-24 12:59:51 -08:00
yuneng-jiang 5e395db1dc Merge pull request #19604 from BerriAI/litellm_team_update_org
[Fix] Team Update with Organization having All Proxy Models
2026-01-24 09:09:55 -08:00
yuneng-jiang f88a32de05 Merge pull request #19622 from BerriAI/litellm_ui_model_backend
[Feature] UI - Models Page: Model Search
2026-01-24 09:09:03 -08:00
yuneng-jiang b44ac6c682 Fixing ruff check 2026-01-24 09:08:29 -08:00
Harshit Jain 09b07df587 fix: propagate JWT auth metadata to OTEL spans (#19627) 2026-01-23 21:21:23 -08:00
jquinter f43757f71b Feature/guardrail model argument (#19619)
* [Feat] Add model parameter to Generic Guardrail API

Add model information to guardrail requests, allowing guardrails to make
model-specific security decisions.

Changes:
- Add `model` field to GenericGuardrailAPIInputs TypedDict
- Add `model` field to GenericGuardrailAPIRequest Pydantic model
- Update OpenAI and Anthropic handlers to pass model from request/response
- Add unit tests for model parameter handling

* [Feat] Add model parameter to all guardrail_translation handlers

Extend model parameter support to all guardrail handlers for consistent
implementation across all endpoint types:
- OpenAI Responses API (input/output + streaming)
- OpenAI Image Generation (input only)
- OpenAI Text Completion (input/output)
- OpenAI Text-to-Speech (input only)
- OpenAI Audio Transcription (output only)
- Cohere Rerank (input only)
- Pass-through Endpoints (input/output)
- MCP Server (input only)

This addresses the review feedback requesting consistent model parameter
handling across all guardrail_translation/handler.py files.

---------

Co-authored-by: Igal Boxerman <igal@pillar.security>
2026-01-23 20:48:42 -08:00
John Greek 4c5351f43b [Fix] Password comparison with non-ASCII characters (#19559) (#19568) 2026-01-23 20:27:42 -08:00
Misha de538456e3 feat: support role_mappings from environment variables (#19498)
* feat: support role_mappings from environment variables

* fix linter
2026-01-23 19:54:23 -08:00
Ishaan Jaff a870722f65 [Feat] UI + Backend - Allow adding policies on Keys/Teams + Viewing on Info panels (#19688)
* ui for policy mgmt

* test_add_guardrails_from_policy_engine_accepts_dynamic_policies_and_pops_from_data
2026-01-23 19:03:44 -08:00