Commit graph

8121 commits

Author SHA1 Message Date
Ishaan Jaff
527c8f59fa
[Feat] Tag Management - Add support for setting tag based budgets (#15433)
* feat: add LiteLLM_TagTable

* fix: use new table for tag management

* fix - allow setting budgets for tags

* working tag creation

* fix schema.prisma

* add tag info

* ui fixes

* ui fix tag info

* TAG_CACHE_IN_MEMORY_TTL_SECONDS

* add Litellm_EntityType

* fix get_aggregated_db_spend_update_transactions

* fix: _update_entity_spend_in_db

* fix _tag_max_budget_check

* add tag budget check

* add tag_list_transactions

* test_get_tag_objects_batch

* test_update_tag_db_without_prisma_client

* fix get_tags_from_request_body

* get_tags_from_request_body

* fix get_tags_from_request_body

* fix spend tracking utils

* get_tags_from_request_body

* test_get_tags_from_request_body_with_metadata_tags

* feat: add _update_tag_cache spend tracking

* fix _PROXY_track_cost_callback

* test_tag_cache_update_multiple_tags

* fix tag info

* docs fix

* docs tag budgets

* doc fix

* docs fix

* fix tag budget

* docs tag budgets

* docs fix

* ruff fix
2025-10-10 19:24:50 -07:00
Krrish Dholakia
f49f540b6d feat(litellm_responses_transformation/transformation.py): parse thinking content in response<-> chat completion bridge
allows gpt-5 to return thinking content when called via responses api
2025-10-10 18:29:37 -07:00
Alexsander Hamir
9d7dea42d0
[Fix] - SensitiveDataMasker converts lists to string (#15420)
* fix: preserve lists in SensitiveDataMasker to prevent string conversion

Added 'list' to allowed primitive types in mask_dict() to prevent lists like
tags from being converted to string representations in API responses.

Before: {"tags": "['East US 2', 'production', 'test']"}
After:  {"tags": ["East US 2", "production", "test"]}

* add: unit test
2025-10-10 17:50:51 -07:00
Copilot
b9eb05ea63
[Feature]: Include server_name in /v1/mcp/server/health endpoint response (#15431)
* Initial plan

* Add server_name to MCP health check response

Co-authored-by: ishaan-jaff <29436595+ishaan-jaff@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ishaan-jaff <29436595+ishaan-jaff@users.noreply.github.com>
2025-10-10 17:37:53 -07:00
Krrish Dholakia
15b5e6f5d9 feat(responses_api/): fix missing streaming events on responses api <-> chat completion bridge
ensure we are passing the required events when streaming non-openai models via responses api
2025-10-10 14:53:15 -07:00
Ishaan Jaff
bf209415da
[Feat] VertexAI Gemma model family streaming support + Added MedGemma (#15427)
* test_acompletion_filters_stream_and_stream_options

* fix: stream_options

* docs medgemma

* lint fix

* docs
2025-10-10 14:22:27 -07:00
Ishaan Jaff
ed62d6c943
[Fix] VertexAI - gemma model family support (custom endpoints) (#15419)
* TestVertexGemmaiCompletion

* test vertex Gemma

* fix file name

* fix file naming

* add VertexAIGemmaModels

* add cost_router for vertexai

* fix main.py

* fix VertexGemmaConfig

* fix Vertex AI Gemma-AI Models Handler

* docs gemma

* fix ids

* test fix

* ruff check fixes

* docs fix

* docs fix

* test_acompletion_basic_request

* Revert "test_acompletion_basic_request"

This reverts commit fdaa5bc49e.

* test_acompletion_basic_request

* fix: async transform

* fix gemma: stream param

* test_acompletion_fake_streaming
2025-10-10 13:30:43 -07:00
Sameer Kankute
513925fd12
Add OCI Cohere support with tool calling and streaming capabilities (#15365)
* Add cohere models for OCI integration

* fix mypy error
2025-10-10 11:20:18 -07:00
Krish Dholakia
611a876889
Merge pull request #15380 from BerriAI/litellm_shared_heatlh_status
Implement Shared Health Check State Across Pods
2025-10-09 22:25:45 -07:00
Ishaan Jaff
52bbabd788
[Feat] Support for Vertex AI Gemma Models on Custom Endpoints (#15397)
* TestVertexGemmaiCompletion

* test vertex Gemma

* fix file name

* fix file naming

* add VertexAIGemmaModels

* add cost_router for vertexai

* fix main.py

* fix VertexGemmaConfig

* fix Vertex AI Gemma-AI Models Handler

* docs gemma

* fix ids

* test fix

* ruff check fixes

* docs fix

* docs fix
2025-10-09 19:20:02 -07:00
Ishaan Jaff
4827e62a21
Fix - OpenRouter cache_control to only apply to last content block (#15395)
* fix: _move_cache_control_to_content

* test_openrouter_transform_request_with_cache_control_list_content

* fix code QA check

* fix: mypy lint

* fix handlers

* fix mypy

* fix - refactor code, fixes for QA checks
2025-10-09 18:01:33 -07:00
Krrish Dholakia
f2d4f03339 feat(pass_through_endpoints.py): only show available pass through endpoints based on what teams has access to
makes it easier to control access
2025-10-09 17:45:14 -07:00
Krish Dholakia
eb0b263532
Merge pull request #15340 from BerriAI/litellm_db_config_accidental_override_fix
fix: Prevents DB from accidentally overriding config file values if they are empty in DB
2025-10-09 17:31:59 -07:00
Krrish Dholakia
5aa5a3b425 fix(route_checks.py): support team metadata 2025-10-09 17:18:38 -07:00
Alexsander Hamir
c7234ba053
[Fix] - Sessions not being shared (#15388)
* fix: share sessions

* fix: remove limit

* clean up

* fix: add missing consts

* add: E2E test

* fix: remove redefinition of unused verbose_logger

* fix: missing const import
2025-10-09 16:57:40 -07:00
Ishaan Jaff
6cf57d85c3
[Feat] Add EnkryptAI Guardrails on LiteLLM (#15390)
* feat: add EnkryptAIGuardrail

* fix types

* fix EnkryptAIGuardrails

* __all__ = ["EnkryptAIGuardrail"]
fix

* fix EnkryptAIGuardrail

* TestEnkryptAIExtraction

* fix mypy linting

* docs enkrypt ai

* add EnkryptAIGuardrailConfigModel

* fix EnkryptAIGuardrailConfigModel

* fix import struct

* fix EnkryptAIGuardrails
2025-10-09 16:27:04 -07:00
Krrish Dholakia
ace862189c test(test_mcp_server_manager.py): add unit testing 2025-10-09 14:52:46 -07:00
Sameer Kankute
dce6cd1051 Add shared healthcheck 2025-10-09 22:18:05 +05:30
Krish Dholakia
e2e0cdde31
Merge pull request #15315 from lcfyi/lcfyi/add-support-for-parallel-tool-calls
Fix parallel tool calls in the Anthropic passthrough adapter
2025-10-08 23:01:55 -07:00
Achintya Rajan
169c1f0f21 moved test to test_proxy_server 2025-10-08 19:24:16 -07:00
Krish Dholakia
d921df1baf
Merge pull request #15343 from BerriAI/litellm_dev_10_08_2025_p1
MCP - support converting OpenAPI specs to MCP servers
2025-10-08 19:10:04 -07:00
Krish Dholakia
12a1d081ee
Merge branch 'main' into litellm_dev_09_11_2025_p1 2025-10-08 19:02:58 -07:00
Ishaan Jaffer
c4022ade49 test mapped tests MCP 2025-10-08 18:34:30 -07:00
Achintya Rajan
4bebb57611 moved test to test_litellm 2025-10-08 18:28:10 -07:00
Ishaan Jaff
97031dc8ee
Fix - (openrouter): move cache_control to content blocks for claude/gemini (#15345)
* test_openrouter_transform_request_with_cache_control

* fix CacheControlSupportedModels

* test_openrouter_transform_request_with_cache_control_gemini
2025-10-08 17:41:04 -07:00
Pierre-Emmanuel MERCIER
861750790b feat: add redis ssl and username support (#11319) 2025-10-08 16:48:07 -07:00
Krrish Dholakia
cd13e533a2 feat(mcp_server_manager.py): expand allowed/disallowed list 2025-10-08 16:06:17 -07:00
Krrish Dholakia
28698933fc feat(mcp_server_manager.py): ensure list tools for openapi servers works as expected 2025-10-08 15:59:42 -07:00
Ishaan Jaff
1c56a0d856
[Fix] Watsonx - Apply correct prompt templates for openai/gpt-oss model family (#15341)
* fix: apply_prompt_template

* Revert "fix: apply_prompt_template"

This reverts commit 3e0e40b497.

* add apply_prompt_template for WatsonX

* feat: add apply_prompt_template

* test_watsonx_gpt_oss_prompt_transformation

* Revert "add apply_prompt_template for WatsonX"

This reverts commit 3e80903796.

* add apply_prompt_template for WatsonX

* fix apply_prompt_template

* fix: add hf template handler

* fix hf_chat_template

* fix _get_tokenizer_config

* fix hf_chat_template

* add WatsonXModelPattern

* fix aapply_prompt_template
2025-10-08 15:39:36 -07:00
Leslie Cheng
f0c9dfbaf8 Add some tests 2025-10-07 20:57:08 -07:00
Krish Dholakia
13703f289b
Merge pull request #15292 from timelfrink/fix/bedrock-prompt-caching-cost-calculation
fix(bedrock): include cacheWriteInputTokens in prompt_tokens calculation
2025-10-07 19:11:45 -07:00
Ishaan Jaffer
e1ab3620ee fix: mapped tests 2025-10-07 17:55:52 -07:00
Ishaan Jaff
36c971a6fd
[MCP Gateway] QA/Fixes - Ensure Team/Key level enforcement works for MCPs (#15305)
* fix: _set_object_permission

* fix: _set_object_permission on teams

* fix: _set_object_permission

* fixes for team/key permissions

* statsh: object permission view

* fix: MCPServerPermissions

* fix: _get_team_object_permission

* test mcp checks for permissions

* fix server checks with prefix names

* test_list_tools_strips_prefix_when_matching_permissions

* ruff fix

* docs - refactor MCP

* docs update MCP docs

* docs allowed tools
2025-10-07 17:34:48 -07:00
Ishaan Jaff
7b56ba240e
[MCP Gateway] Litellm mcp fixes team control (#15304)
* fix: _set_object_permission

* fix: _set_object_permission on teams

* fix: _set_object_permission

* fixes for team/key permissions

* statsh: object permission view

* fix: MCPServerPermissions
2025-10-07 16:48:00 -07:00
Ishaan Jaff
bc26eff98f
Fix: Make PATCH /model/{model_id}/update handle team_id consistently with POST /model/new (#15297)
* fix: _update_team_model_in_db

* test_patch_model_with_team_id_creates_proper_setup
2025-10-07 14:04:08 -07:00
Ishaan Jaff
07a17d6d6b
[Feat] Proxy CLI - dont store existing key in the URL, store it in the state param (#15290)
* Feat: CLI Auth fixes for UI SSO

* fix auth.py

* fix test ui sso.py
2025-10-07 12:36:17 -07:00
Tim Elfrink
c5eb22381d fix(bedrock): include cacheWriteInputTokens in prompt_tokens calculation
Fixes #15263

This PR fixes the cost calculation for Bedrock Anthropic models with prompt caching.

**Root Cause:**
PR #9838 incorrectly removed adding `cacheWriteInputTokens` to `prompt_tokens`
for Bedrock, based on the assumption that it would cause double counting (similar
to an Anthropic API issue). However, Bedrock's token structure is different:

- **Bedrock API**: `inputTokens`, `cacheReadInputTokens`, and `cacheWriteInputTokens`
  are ALL separate values that should be summed for total input tokens
- **Anthropic API**: Same structure - all three token types are separate

The fix in #9838 was later reverted for Anthropic (correctly re-adding
`cache_creation_input_tokens` to `prompt_tokens`), but Bedrock was never fixed.

**Changes:**
1. Re-add `cacheWriteInputTokens` to `input_tokens` in Bedrock transformation
2. Update test assertions to reflect correct behavior
3. Add regression test for prompt caching cost calculation
4. Fix typo in Anthropic transformation where `cache_creation_tokens` was
   incorrectly set to `cache_read_input_tokens`

**Testing:**
- All existing Bedrock transformation tests pass
- New test validates correct cost calculation with prompt caching
- Verified costs are non-negative and accurate
2025-10-07 20:28:46 +02:00
Sameer Kankute
e4892735f0
fix gemini cli by actually streaming the response (#15264)
* fix gemini cli by actually streaming the response

* fix cost tracking

* fix test
2025-10-07 11:26:39 -07:00
Sameer Kankute
73f96712f5
fix the reasoningresponse id (#15265) 2025-10-07 11:24:29 -07:00
Sameer Kankute
c0d0424eb8
Added streaming support for response api streaming image generation (#15269) 2025-10-07 08:15:57 -07:00
Krish Dholakia
94a34dd53a
Merge branch 'main' into litellm_dev_10_06_2025_p1 2025-10-06 20:06:30 -07:00
Krish Dholakia
8b357c24c2
Merge pull request #15226 from otaviofbrito/chore/vertex-ai-context-caching
Chore/vertex ai context caching
2025-10-06 20:05:24 -07:00
Krish Dholakia
6b4415684e
Merge pull request #15253 from BerriAI/litellm_dev_10_06_2025_p2
fix(azure/responses): remove invalid status param from azure call + MCP - support setting CA_BUNDLE_PATH
2025-10-06 20:01:39 -07:00
Sameer Kankute
8d7f39798c
Removed stop param from unsupported azure models (#15229)
* Removed stop param from unsupported model

* Use better handling for stop method

* Use better handling for stop method
2025-10-06 19:56:18 -07:00
Ishaan Jaff
1d468a59f3
[MCP Gateway] Fine-grained Database Object Storage Control (#15255)
* add supported_db_objects

* add _should_load_db_object

* add docs on storing MCP objects in DB

* test_should_load_db_object_with_supported_db_objects

* type fix
2025-10-06 19:31:44 -07:00
Ishaan Jaff
930f88078e
[MCP Gateway] Backend - Allow storing allowed tools by team/key (#15243)
* add mcp_tool_permissions column to LiteLLM_ObjectPermissionTable

* add mcp_tool_permissions

* add LiteLLM_ObjectPermissionTable

* test key/team mgmt

* fix code QA check

* fix check_tool_permission_for_key_team

* test_key_tool_permission_allows_permitted_tool

* test_list_tools_filters_by_key_team_permissions

* fix _get_tools_from_mcp_servers

* fix logger.debug

* fix check_tool_permission_for_key_team

* fix: filter_tools_by_key_team_permissions

* fix _get_team_object_permission

* fix _set_object_permission

* fix handle_update_object_permission_common

* fix add allowed tools to keys

* test add key/team level tool permissions for MCPs
2025-10-06 18:49:32 -07:00
Krrish Dholakia
7f88a3f9c6 fix(mcp/): add ssl certificate settings for mcp clients
respect ca bundle path for mcp calls
2025-10-06 18:36:05 -07:00
Krrish Dholakia
d7aab1d5de test: add unit tests 2025-10-06 13:53:36 -07:00
Sameer Kankute
cd25782359
fix passing headers for gemini (#15231) 2025-10-06 12:59:19 -07:00
Otavio Brito
b2a734c1f8 fix ttl tests 2025-10-06 09:30:23 -03:00