Commit graph

4090 commits

Author SHA1 Message Date
jwang-gif
443bada425
Add Zscaler AI Guard hook (#15691)
* Add Zscaler AI Guard hook

Co-authored-by: Angela Tao <atao@zscaler.com>

* Fix lint error, update document

* Fix lint error, update document

* update document

* fix mypy type error

* fix mypy issue

* fix test

* fix test

* improve document

* remove unuseful code

* use litellm httphandler

* update test cases

* revover guardrail_initializers.py and guardrail_registry.py

* remove unuse import

* app apply_guardrail

* remove functions repleased by apply_guardrail, update test and doc

* remove functions repleased by apply_guardrail, update test and doc

---------

Co-authored-by: Angela Tao <atao@zscaler.com>
2025-11-11 15:34:27 -08:00
Ishaan Jaff
5c9f50d584
[AI Gateway] - End User Budgets - Allow pointing max_end_user budget to an id, so the default ID applies to all end users (#16456)
* add _apply_budget_limits_to_end_user_params

* add _apply_budget_limits_to_end_user_params

* add _apply_budget_limits_to_end_user_params

* test_default_budget_applied_to_end_user_without_budget

* docs fix

* fix config
2025-11-11 08:20:13 -08:00
Ishaan Jaff
e94186629d
[Fix] Bedrock Knowledge bases - ensure users can access search_results for both stream + non stream response to /chat/completions (#16459)
* fix message with provider_specific_fields

* test_provider_specific_fields_in_proxy_http_response

* test_provider_specific_fields_in_proxy_http_response
2025-11-11 08:19:57 -08:00
Daniel Sabanov
0ecc38519e
[Bug] Updated spend would not be sent to CloudZero (#16201)
* Address a bug where cloudzero spend is not sent to cloudzero if a spend
update happens

* revert change unrelated to PR

* use polars for mocking instead of sqlite
2025-11-10 19:43:15 -08:00
yellowsubmarine372
b6dbd4fa28
fix: apply provided timeout value to ClientTimeout.total (#16395) 2025-11-10 19:37:42 -08:00
Alan Ponnachan
5f12e4be1e
fix(langfuse): Handle null usage values to prevent validation errors (#16396)
* langfuse null validation fix

* formatting
2025-11-10 19:34:56 -08:00
Alan Ponnachan
7b292ccdf5
router fallback for unknown models (#16419) 2025-11-10 19:33:01 -08:00
Matt Cowger
e0d6774ec1
fix: update model_cost_map_url to use environment variable (#16429)
* fix: update model_cost_map_url to use environment variable, to match behavior to documentation in docs/my-website/docs/proxy/sync_models_github.md

* Add an appropriate test.
2025-11-10 19:30:44 -08:00
Alan Ponnachan
df33f36c06
Correctly handle date filters in /spend/logs endpoint (#16443) 2025-11-10 19:26:55 -08:00
Val Miscenko
19e6e60d30
fix: remove strict master_key check in add_deployment (#16453)
Allows proxy to save spend logs without requiring master_key.
  Decryption now gracefully handles both encrypted and unencrypted values.
2025-11-10 19:23:13 -08:00
Sameer Kankute
6cab77f53f
Added thinking streaming support for mistral (#16434) 2025-11-10 18:41:45 -08:00
Sameer Kankute
be3c09e6d5
Add GET list of providers endpoint (#16432) 2025-11-10 18:38:09 -08:00
Ishaan Jaff
8140d85d28
[Bug Fix] - LiteLLM Usage shows key_hash- (#16471)
* test_get_logging_payload_api_key_preserved_when_standard_logging_payload_is_none

* fix get_logging_payload

* test_api_key_preserved_through_failure_hook_to_database
2025-11-10 18:15:52 -08:00
Jehandad Kamal
912be308b2
fix: allow internal users to access video generation routes (#16472)
Fixes #16470

Video generation endpoints (/v1/videos, /videos/{video_id}, etc.) were
incorrectly restricted to proxy_admin role only. These routes are now
added to openai_routes list, making them accessible to internal_user
role as they should be - video generation is a legitimate user feature,
not a management/admin operation.

Changes:
- Added 8 video route patterns to LiteLLMRoutes.openai_routes in _types.py
- Added comprehensive tests verifying internal_user and virtual key access
- All existing route permission tests continue to pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-10 17:44:16 -08:00
Ishaan Jaff
dc76b6c76e
[Fix] Management Endpoints - Fixes inconsistent error responses in customer management endpoints. Non-existent user errors now return proper 404 status codes with consistent error schema format across all endpoints. (#16450)
* fix: ensure end user endpoints use "handle_exception_on_proxy" correctly

* test 404 on info and update for non-existent user

* test 404 for no customer found

* fix 404 handling for customer endpoints

* test_error_schema_consistency

* test_customer_endpoints_error_schema_consistency
2025-11-10 17:16:53 -08:00
Ishaan Jaffer
8c1dd78c13 fix imports 2025-11-08 18:01:32 -08:00
Krish Dholakia
06906534b3
feat(audio_transcriptions/): calculate duration of audio file for cost calculation + feat (image_generations): cost tracking accuracy improved with output_format, quality, size values fixed per openai model
* feat(audio_transcriptions/): calculate duration of audio file for cost calculation

Fixes https://github.com/BerriAI/litellm/issues/11846

Closes https://github.com/BerriAI/litellm/issues/14605

* fix(cost_calculator.py): correctly use base model, when set

Fixes issue where azure base model was being ignored

* feat(cost_calculator.py): fix default cost tracking quality param for image generation

* feat(image_generations/): return output_format, quality, size

aligns response to openai spec and improves cost tracking accuracy

* fix(cost_calculator.py): refactor cost calculation for image generation to use image response instead of hidden params

* build: update build

* fix: fix cost calculation

* build: update poetry lock

* fix: fix ruff checks

* fix: fix aembedding

* fix: fix ruff errors

* fix: modify to catch errors

* fix: test

* fix: loosen test to handle openai lib out of sync

* fix: fix base models

* fix: fix usage object
2025-11-08 16:24:31 -08:00
Sameer Kankute
86d73c918c
Adds support for returning Azure Content Policy error information when exceptions from Azure OpenAI occur (#16231)
* add provider_specific_fields to ContentPolicyViolationError

* use provider_specific_fields in ProxyException

* update openai_exception_handler

* fix use exception checker for content policy violation azure

* add AzureOpenAIExceptionMapping

* test_azure_with_content_safety_error

* Accessing Provider-Specific Error Details

* TestExceptionCheckers

* unit test got provider_specific_fields=

* add clear types for error dict

* fix test_azure_with_content_safety_error

---------

Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
2025-11-08 16:04:36 -08:00
Sameer Kankute
e037d9315d
Add Vertex and Gemini Videos API with Cost Tracking + UI support (#16323)
* Use video id for videos api

* remove mock code

* Potential fix for code scanning alert no. 3630: Clear-text logging of sensitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* remove print statements

* Update video prefix for 'video_'

* Add veo with openai videos unified specs

* Add videos testing to UI

* remove mock code

* Remove not need ui changes:

* Fix mypy errors related to gemini

* fix test_transform_video_create_request

* Add vertex ai veo config

* Add vertex ai veo config

* Add cost tracking for gemini and add optional param passing

* fix bugs related to vertex ai veo

* Add Gemini Veo Video Generation in Openai Videos Unified Spec (#16229)

* Add veo with openai videos unified specs

* Add videos testing to UI

* remove mock code

* Remove not need ui changes:

* Fix mypy errors related to gemini

* fix test_transform_video_create_request

* Add contant video duration for gemini and vertex

* Fix litellm_mapped_tests tests

* fix azure videos issue

* Added doc for videos vertex ai

* fix seconds param error

* fix lint errors

* test_transform_video_create_response_cost_tracking_no_duration

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Ishaan Jaffer <ishaanjaffer0324@gmail.com>
2025-11-08 16:03:51 -08:00
Krish Dholakia
202eaeb1a2
Revert "(feat) Audio transcription - cost tracking + (feat) image generation …" (#16409)
This reverts commit c96da44265.
2025-11-08 15:38:16 -08:00
Krish Dholakia
c96da44265
(feat) Audio transcription - cost tracking + (feat) image generation - accurate cost tracking based on output_format/quality/size
* feat(audio_transcriptions/): calculate duration of audio file for cost calculation

Fixes https://github.com/BerriAI/litellm/issues/11846

Closes https://github.com/BerriAI/litellm/issues/14605

* fix(cost_calculator.py): correctly use base model, when set

Fixes issue where azure base model was being ignored

* feat(cost_calculator.py): fix default cost tracking quality param for image generation

* feat(image_generations/): return output_format, quality, size

aligns response to openai spec and improves cost tracking accuracy

* fix(cost_calculator.py): refactor cost calculation for image generation to use image response instead of hidden params

* build: update build

* fix: fix cost calculation

* build: update poetry lock

* fix: fix ruff checks

* fix: fix aembedding

* fix: fix ruff errors

* fix: modify to catch errors

* fix: test

* fix: loosen test to handle openai lib out of sync
2025-11-08 15:30:46 -08:00
Krish Dholakia
bce8a5d6b7
Revert "(feat) audio transcriptions cost tracking (for azure/other non-openai…" (#16402)
This reverts commit 9a88fe0861.
2025-11-08 14:24:51 -08:00
Ishaan Jaffer
e4c31add58 test_dd_llms_obs_redaction 2025-11-08 14:23:42 -08:00
Ishaan Jaffer
1bf284abca test_delete_callbacks_in_db 2025-11-08 14:05:44 -08:00
Ishaan Jaffer
a4c008c433 test_datadog_message_redaction 2025-11-08 14:02:24 -08:00
Krish Dholakia
9a88fe0861
(feat) audio transcriptions cost tracking (for azure/other non-openai models) + (fix) image generations - accurate cost tracking for dalle3/gpt-image-1 - uses the correct max image quality (#16076)
* feat(audio_transcriptions/): calculate duration of audio file for cost calculation

Fixes https://github.com/BerriAI/litellm/issues/11846

Closes https://github.com/BerriAI/litellm/issues/14605

* fix(cost_calculator.py): correctly use base model, when set

Fixes issue where azure base model was being ignored

* feat(cost_calculator.py): fix default cost tracking quality param for image generation

* feat(image_generations/): return output_format, quality, size

aligns response to openai spec and improves cost tracking accuracy

* fix(cost_calculator.py): refactor cost calculation for image generation to use image response instead of hidden params

* build: update build

* fix: fix cost calculation

* build: update poetry lock

* fix: fix ruff checks
2025-11-08 13:54:37 -08:00
Ishaan Jaffer
993c75d10b test_redaction_responses_api 2025-11-08 13:43:22 -08:00
Ishaan Jaffer
c43fcf2ded test_redaction_responses_api 2025-11-08 13:39:40 -08:00
Sameer Kankute
6fb0a8fc58
Added xai responses support (#16391)
* Added xai responses support

* add the xai provider config above

* remove init file

* remove init file

* Fix f string lint error

---------

Co-authored-by: Ishaan Jaffer <ishaanjaffer0324@gmail.com>
2025-11-08 12:30:09 -08:00
Ishaan Jaffer
eef8c01d4e test_redaction_responses_api 2025-11-08 12:29:38 -08:00
Ishaan Jaffer
1d2bdaebb6 test_openai_streaming_logging 2025-11-08 11:49:36 -08:00
Ishaan Jaffer
9b4e32c880 Revert "Added support for desabling thoughts by setting budget to 0 (#16347)"
This reverts commit b6f792f301.
2025-11-08 11:34:05 -08:00
Ishaan Jaffer
4fb521c251 test_basic_openai_responses_api_non_streaming_with_logging 2025-11-08 11:12:35 -08:00
Ishaan Jaffer
c60a13c919 fixes 2025-11-08 11:11:22 -08:00
Ishaan Jaffer
da7ecb3ea9 test_gemini_reasoning_effort_zero_budget_disables_thoughts 2025-11-08 11:10:54 -08:00
Ishaan Jaffer
bbcdf6f996 test_basic_openai_responses_api_non_streaming_with_logging 2025-11-08 10:47:48 -08:00
Ishaan Jaffer
0148b8d2f7 test_basic_openai_responses_api_non_streaming_with_logging 2025-11-08 10:36:47 -08:00
Ishaan Jaffer
89157f4b5c test_basic_openai_responses_api_streaming_with_logging 2025-11-08 10:30:41 -08:00
Ishaan Jaffer
6bb963dca2 test_basic_openai_responses_api_non_streaming_with_logging 2025-11-08 10:13:27 -08:00
Ishaan Jaffer
68d24b40c6 test_gemini_25_implicit_caching_cost 2025-11-08 10:13:04 -08:00
Ishaan Jaffer
f9d95b71bb fix _get_assembled_streaming_response 2025-11-08 10:08:03 -08:00
Ishaan Jaffer
7bf9d69007 test_gemini_reasoning_effort_env_override 2025-11-07 22:09:59 -08:00
Ishaan Jaffer
45323dd537 test_patch_guardrail_endpoint 2025-11-07 22:09:52 -08:00
Alan Ponnachan
2408e09f6a
feat: Add support for Anthropic Memory Tool (#16115)
* add memory tool in anthropic.py

* add memory tool test

* make format

* update transformation

* adding memory to hosted tools

* add test

* make format
2025-11-07 19:27:28 -08:00
YutaSaito
6eb74bd62a
Feat/persist mcp credentials in db (#16308)
* feat: persist mcp credentials in db

* feat: remove Auth Value field from MCP Tool Testing Playground

* fix: test
2025-11-07 19:22:49 -08:00
Sameer Kankute
b6f792f301
Added support for desabling thoughts by setting budget to 0 (#16347) 2025-11-07 19:19:16 -08:00
Jack Cherng
2ab34f9a52
Fix HostedVLLMRerankConfig will not be used (#16352)
* Fix HostedVLLMRerankConfig will not be used

Signed-off-by: Jun-Fei Cherng <jfcherng@realtek.com>

* Fix no usage statistics in rerank with hosted_vllm

Signed-off-by: Jun-Fei Cherng <jfcherng@realtek.com>

* Revise typo in comment

Signed-off-by: Jun-Fei Cherng <jfcherng@realtek.com>

---------

Signed-off-by: Jun-Fei Cherng <jfcherng@realtek.com>
2025-11-07 19:11:59 -08:00
Ishaan Jaffer
a8533dc5c4 Revert "Added xai responses support (#16310)"
This reverts commit ee50f09e73.
2025-11-07 18:39:38 -08:00
Ishaan Jaffer
736b6b3e1e TestVertexAIRerankTransform 2025-11-07 18:18:48 -08:00
Ishaan Jaff
674d4b4cab
[Feat] Guardrails - LiteLLM Content Filter, Allow Viewing/Editing Content Filter Settings (#16383)
* fix safe dumps

* add patterns.json

* add PrebuiltPattern

* add test patterns

* fix edit and view

* fix backend handling

* fix CF ui edit

* fix init
2025-11-07 18:15:09 -08:00