Commit Graph

23230 Commits

Author SHA1 Message Date
Jugal D. Bhatt 7b44576216 Validation to mcp server name (#12515)
* added validation

* add helper util
2025-07-11 11:24:42 -07:00
Andres Carrillo 9f7847feb1 feat: non-root docker hub push (#12413) 2025-07-11 08:34:32 -07:00
Krrish Dholakia 68fe7d245d docs(index.md): update doc 2025-07-11 08:08:47 -07:00
Jugal D. Bhatt 1b10dda2f4 Litellm mcp access group (#12514)
* added mcp tools on internal user and divide it by teams

* add support for server api call

* Added frontend for test key

* added tools used output

* fix ui for servers

* All servers to personal

* change columns format

* revert ui logic

* Added vertical align

* fix mapped tests

* fix lint

* fix lint

* remove extra file

* fix ui test

* comments fixes

* change query type

* change query type

* mcp acces group init

* add ability to change server display on ui through access groups

* Mcp access group names UI (#12486)

* Added ui changes to reflect mcp_access_groups

* fix edit mcp page

* change to string array (#12491)

* change to string array

* Remove print

* add ability to change server display on ui through access groups

* Litellm mcp access groups accesses (#12498)

* added mcp access groups for keys and teams

* added access groups above servers

* fixed ruff

* fixed mypy

* revert couple changes

* fix test

* fixed double asterisks
2025-07-11 07:50:18 -07:00
Krish Dholakia 569ddde9fe [Enterprise] Support tag based mode for guardrails (#12508)
* feat(custom_guardrail.py): allow admin to run guardrails on specific modes based on request tags

Enables pre-call checks for openwebui but logging for claude code guardrails

* refactor(custom_guardrail.py): move tag based mode to enterprise

* test(test_custom_guardrail.py): update test

* feat(quick_start.md): add doc on tag-based guardrail mode

* docs(quick_start.md): cleanup doc

* docs: cleanup

* docs(openweb_ui.md): add tutorial to doc

* fix(custom_guardrail.py): ensure user is premium user

* test: update test
2025-07-10 22:27:30 -07:00
Krrish Dholakia 0c8cbbe91b build(model_prices_and_context_window.json): add pixtral model support
Closes https://github.com/BerriAI/litellm/pull/12478
2025-07-10 22:25:20 -07:00
Jugal D. Bhatt e3437795bb Litellm mcp access group on UI (#12470)
* added mcp tools on internal user and divide it by teams

* add support for server api call

* Added frontend for test key

* added tools used output

* fix ui for servers

* All servers to personal

* change columns format

* revert ui logic

* Added vertical align

* fix mapped tests

* fix lint

* fix lint

* remove extra file

* fix ui test

* comments fixes

* change query type

* change query type

* mcp acces group init

* add ability to change server display on ui through access groups

* Mcp access group names UI (#12486)

* Added ui changes to reflect mcp_access_groups

* fix edit mcp page

* change to string array (#12491)

* change to string array

* Remove print

* add ability to change server display on ui through access groups

* Litellm mcp access groups accesses (#12498)

* added mcp access groups for keys and teams

* added access groups above servers

* fixed ruff

* fixed mypy

* revert couple changes
2025-07-11 10:29:25 +05:30
Krish Dholakia 9d9562d0e8 Guardrails AI - pre-call + logging only guardrail (pii detection/competitor names) support (#12506)
* fix(guardrails_ai.py): initial commit adding pre-call hook support for guardrails ai

enables running user input through guardrails ai - if set

* feat(guardrails_ai.py): working pre call guardrail

enables pii detection to work via guardrails ai

* feat(guardrails_ai.py): support logging hook

enables masking input via guardrails ai on logging integrations

* test(test_guardrails_ai.py): add unit test for new input processing function
2025-07-10 21:41:02 -07:00
Limbo Peng 7c373140a8 Fix tool call handling in Anthropic pass-through adapter (#12473)
* Add unit tests

* Fix tool call handling in Anthropic pass-through adapter

- Move tool message placement before user messages to maintain proper order
- Add safety check for empty function arguments in tool calls

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

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-10 21:30:37 -07:00
jdietzsch91 2ff301ee21 fix bedrock cost calculation for cached tokens (#12488)
* Add cost calcualtor for bedrock, Add test for bedrock caching cost calculation

* update test
2025-07-10 21:29:22 -07:00
Ishaan Jaff 225e9f3d55 ci/cd new release v1.74.2-nightly 2025-07-10 18:45:56 -07:00
Ishaan Jaff 47ba271d58 test_http_parsing_utils.py 2025-07-10 18:20:41 -07:00
Ishaan Jaff a2232686f7 bump: version 1.74.1 → 1.74.2 2025-07-10 18:17:15 -07:00
Ishaan Jaff feb6cd8732 ui new build 2025-07-10 18:17:03 -07:00
Cole McIntosh 28a6cec77c feat: improve user dropdown UI with premium badge and cleaner layout (#12502)
- Add premium/standard badge with crown icon next to user ID
- Remove colons and improve visual hierarchy with icons
- Add tooltips for user status (Premium User / Upgrade message)
- Enhance spacing and typography for better readability
- Update dropdown styling with proper hover states
2025-07-10 18:14:00 -07:00
minghao bee63a1ae7 Added dashscope (alibaba's cloud - qwen) as a provider (#12361)
* Added dashscope as a provider

* Fix some leftover references on nebius

* Porting the dashscope api endpoit international version

* explicit tool_choice = True in config
2025-07-10 18:09:26 -07:00
Adam Holmberg 6ff06bb96f fix: handle reasoning parameters and response in responses bridge (#12433)
* fix: handle reasoning parameters and response in responses bridge

Updates the OpenAI completions/responses bridge to map
reasoning_effort to reasoning parameters, and the chunk parser
to return reasoning_content.

ref: 12432

* fix: using type checked objects in responses bridge transform

ref: 12432
2025-07-10 18:06:45 -07:00
Rayshard Thompson 8aa616698e Fix typo and import required types (#12487) 2025-07-10 18:03:42 -07:00
Ishaan Jaff 52e4cc9a04 [Feat] Add support for editing MCP cost per tool (#12501)
* fix - allow editing cost per tool

* add MCPServerCostDisplay

* fix MCP tool call

* update_mcp_server

* ui fix MCP

* fix for viewing MCPs
2025-07-10 17:58:51 -07:00
Ishaan Jaff 5fdbb218a8 [MCP Gateway] - Add custom cost configuration for each MCP tool (#12499)
* add endpoints to test MCP connection

* fix route names

* add testMCPToolsListRequest

* fix MCP connection test

* add tool_name_to_cost_per_query

* fixes tool_name_to_cost_per_query

* fix networking

* fix test MCP connection

* use POST for test tools endpoints

* ui fixes

* fix config

* fixes for cost config

* fixes

* decent connection status

* fix Created At

* fix MCP table

* Potential fix for code scanning alert no. 2928: Information exposure through an exception

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

* MCPServerCostConfig

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-07-10 17:00:39 -07:00
Jugal D. Bhatt 0691ff8d13 Added validate payload error (#12494)
* Added validate payload error

* added logger

* added test case
2025-07-10 15:54:48 -07:00
Ishaan Jaff b0003bd03c Feat(bedrock): support api key authentication for AWS Bedrock API (#12426) (#12495)
* add support of bearer token for bedrock integration

* fix linting issue

* fix type checking issue

* reoder arguments to address type checking issue

* switch to use get_secret_str to fetch env variable

Co-authored-by: 0x-fang <fanggong@amazon.com>
2025-07-10 15:12:17 -07:00
Ishaan Jaff 610d56ae5d docs stable release 2025-07-10 14:53:29 -07:00
Graham Neubig 6fa0da6ae2 Add Azure OpenAI o3-deep-research model pricing support (#12493)
- Add azure/o3-deep-research model to pricing configuration
- Input cost: 0 per million tokens (1e-05 per token)
- Output cost: 0 per million tokens (4e-05 per token)
- Supports reasoning, web search, function calling, vision, and other advanced features
- Based on Azure AI Foundry Deep Research pricing documentation

Resolves #12318

Co-authored-by: openhands <openhands@all-hands.dev>
2025-07-10 12:06:32 -07:00
Ishaan Jaff 6f22dab4b6 dont emit warning for Max in memory queue flush count (#12489) 2025-07-10 10:36:16 -07:00
Ishaan Jaff a0d6900223 [Bug Fix] fix parsing environment_variables from config.yaml (arize logger integration fix) (#12482)
* fix parsing environment_variables from config.yaml

* add tests
2025-07-10 09:15:07 -07:00
Xingyao Wang 01c76229f2 Add devstral-small-2507 and devstral-medium-2507 models (#12484)
- devstral-small-2507: bash.1/M input, bash.3/M output (same as Mistral Small 3.1)
- devstral-medium-2507: bash.4/M input, /M output (same as Mistral Medium 3)

Co-authored-by: openhands <openhands@all-hands.dev>
2025-07-10 09:14:07 -07:00
Jugal D. Bhatt aa14d26da4 fix slack alerts (#12464)
* fix slack alerts

* remvoe print

* add unit test
2025-07-10 08:58:47 -07:00
fatih akyon 9d3cb11dc6 add grok-4 configs to table (#12476)
* add grok-4 configs to table

* add missing fields

* fix a typo
2025-07-10 06:32:32 -07:00
Krish Dholakia 07e8609edb Resolve model group alias on Auth + /v1/messages Fallback support (#12440)
* fix(auth_checks.py): resolve a model group alias when key has access to underlying model

Fixes LIT-293

* feat(anthropic/): add mock_response to anthropic /v1/messages

makes it easy to test fallback logic

* fix(router.py): support fallbacks on /v1/messages

adds working fallbacks on generic api route

* refactor(router.py): point _ageneric_api_call_with_fallbacks to updated function

* test: add unit test for new helper on router

* fix(router.py): use correct metadata variable name

* fix(router.py): use correct metadata field

* docs(config_settings.md): document new param
v1.74.1-nightly
2025-07-09 22:27:55 -07:00
Krish Dholakia 0730f61127 OTEL - OTEL_RESOURCE_ATTRIBUTES support + Model Hub - new model hub table view, new /public/model_hub endpoint, fix duplicates in /model_group/info (#12468)
* fix(opentelemetry.py): initial commit adding support for OTEL_RESOURCE_ATTRIBUTES

* test: update unit tests

* feat(ui/): initial commit with revamped model hub

* fix(model_hub_table.tsx): generic 'supports_' rendering as capabilities

* feat(model_hub_table.tsx): indicate if a model is publicly available

* refactor(model_hub_table.tsx): refactor to use common model data table component

* fix(model_hub_table.tsx): fix box sizes

* fix(model_hub_table.tsx): enable selecting / deselecting models in columns

* feat(public_endpoints.py): initial commit adding `/public/model_hub` endpoint

enables sharing public models

* feat(public_endpoints/): instrumentation for public model hub route

* feat(proxy_server.py): support request access form for model groups

allows user to request access to a model

* refactor: use a dictionary of text + link instead of 1 hardcoded request access form

* fix(proxy_server.py): prevent duplicates in model_group info

* fix: fix linting error

* fix(__init__.py): fix linting error
2025-07-09 22:00:57 -07:00
Krish Dholakia 635367b020 Litellm dev 07 09 2025 p1 (#12462)
* fix(db_spend_update_writer.py): fix db query

* fix(litellm_pre_call_utils.py): support passing anthropic-beta headers when 'forward_client_headers_to_llm_api' is True

allows user to pass along extra headers to vertex ai anthropic models

* docs(config_settings.md): update docs
2025-07-09 21:46:15 -07:00
Ishaan Jaff 5bf9c97094 ci/cd new release 2025-07-09 19:10:31 -07:00
Ishaan Jaff 474f4469fa use mock tests for mcp management tests 2025-07-09 19:09:29 -07:00
Ishaan Jaff 35bfa7c9ee [MCP Gateway] - Allow using custom post call MCP hook for cost tracking (#12469)
* add async_post_mcp_tool_call_hook to custom logger

* instrument call_mcp_tool

* add async_post_mcp_tool_call_hook

* fixes for MCP tests

* test fix MCP tests

* allow adding custom cost for MCP response

* fix LiteLLM_MCPTextContent

* add MCPPostCallResponseObject

* fix _handle_local_mcp_tool

* async_post_mcp_tool_call_hook

* fix typing loc

* fix call_mcp_tool

* fix server.py

* fix MCPPostCallResponseObject

* async_post_mcp_tool_call_hook

* docs mcp cost hook

* fix import path
2025-07-09 18:41:08 -07:00
Ishaan Jaff 95eaa98b9d bump litellm_proxy_extras-0.2.9 2025-07-09 18:40:00 -07:00
Ishaan Jaff a37dacb770 bump to litellm-enterprise==0.1.12 2025-07-09 18:35:28 -07:00
Ishaan Jaff 6055da09d0 [Bug Fix] DataDogLLMObsLogger push total_cost (#12467)
* push total cost

* fixes dd llm obs

* TestDataDogLLMObsLogger

* fix _get_time_to_first_token_seconds

* test_get_time_to_first_token_seconds

* fix linting
2025-07-09 18:23:01 -07:00
Ishaan Jaff adeffda681 test_bedrock_guardrail_triggered 2025-07-09 17:05:06 -07:00
Ishaan Jaff 965dfbbdf4 test_bedrock_guardrail_blocked_action_shows_output_text_with_multiple_outputs 2025-07-09 17:03:56 -07:00
Ishaan Jaff 17ea770ab5 [Feat] SSO - Allow users to run a custom sso login handler (#12465)
* fix return_ui_sso_redirect_response_after_sign_in

* add CustomSSOLoginHandler

* add handle_custom_ui_sso_sign_in

* fix handle_custom_ui_sso_sign_in

* fixes for /sso/key/generate

* add test_handle_custom_ui_sso_sign_in_success

* fixed for loading config

* add example custom handler

* test_custom_ui_sso_sign_in_handler_config_loading

* docs - custom sso

* move to enterprise folder

* EnterpriseCustomSSOHandler

* handle_custom_ui_sso_sign_in

* docs custom sso

* docs sso

* docs custom sso

* get_redirect_response_from_openid

* fix mock tests
2025-07-09 16:36:30 -07:00
Jugal D. Bhatt a12bbe7da4 Litellm mcp internal users (#12458)
* added mcp tools on internal user and divide it by teams

* add support for server api call

* Added frontend for test key

* added tools used output

* fix ui for servers

* All servers to personal

* change columns format

* revert ui logic

* Added vertical align

* fix mapped tests

* fix lint

* fix lint

* remove extra file

* fix ui test

* comments fixes

* change query type

* change query type

* change query type

* Update model_checks.py
2025-07-09 16:30:51 -07:00
Ishaan Jaff f62b0ca52b [Bug Fix] Ensure supported bedrock/converse/ params = bedrock/ params (#12466)
* fix bedrock converse

* fix supports reasoning checks

* test_get_supported_openai_params_bedrock_converse

* fix
2025-07-09 16:14:07 -07:00
Ishaan Jaff afd382d09f [Feat] MCP Gateway - Allow customizing what client side header to use (#12460)
* add _get_mcp_auth_header_from_headers

* test_process_mcp_request_with_custom_auth_header

* Using a different Authentication Header

* fix customize MCP Auth header name
2025-07-09 12:30:20 -07:00
Krish Dholakia 66d8c653fd (Router) don't add invalid deployment to router pattern match (#12459)
* fix security - mcp

* fix(router.py): validate model provider before adding deployment to pattern

prevents routing on pattern match to invalid deployment

---------

Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
2025-07-09 11:42:11 -07:00
Cole McIntosh 19fa8f672e Merge pull request #12442 from colesmcintosh/fix/remove-test-files
Remove temporary test files
2025-07-09 11:18:44 -06:00
Cole McIntosh 4db25169d2 Fix: Properly close aiohttp client sessions to prevent resource leaks (#12251)
* Fix: Properly close aiohttp client sessions to prevent resource leaks (#12107)

- Add close() method to BaseLLMAIOHTTPHandler to properly close aiohttp ClientSession
- Create async_client_cleanup module with utility functions to close all cached async clients
- Register automatic cleanup at exit via atexit hook
- Export close_litellm_async_clients() function for manual cleanup
- Add comprehensive tests to verify resource cleanup

This fixes the "Unclosed client session" and "Unclosed connector" warnings when using acompletion with Gemini and other models that use aiohttp.

Fixes #12107

* Fix: Remove unused import to satisfy linter

* Fix: Extend cleanup to handle AsyncHTTPHandler instances used by Gemini

The original implementation only cleaned up BaseLLMAIOHTTPHandler instances,
but Gemini/Vertex AI providers use AsyncHTTPHandler objects which contain
httpx clients with aiohttp transports.

This commit extends the cleanup function to:
- Handle AsyncHTTPHandler instances by accessing their internal client
- Close both the aiohttp transport and httpx client
- Add generic fallback for any objects with aclose method

This properly fixes the resource leak warnings for all provider types.
2025-07-09 09:25:17 -07:00
Krish Dholakia c42880d771 fix(utils.py): rollback faulty security check on files (#12441)
* fix(utils.py): rollback faulty security check on files

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

* fix(route_checks.py): add unit tests
2025-07-08 22:11:06 -07:00
Krish Dholakia c4af2eb5e2 MCP - usage tracking (#12397)
* fix(common_daily_activity.py): initial commit with working mock BE endpoint for mcp usage

* feat(ui/): show mcp server activity on UI

allows admin to know which mcp's are being used

* feat(common_daily_activity.py): return activity by key

* feat(ui/): show top api keys for a given model / mcp server

allow user to know which key is driving spend

* fix(common_daily_activity.py): use known mcp server names

* feat(server.py): log the namespaced tool name (includes server prefix)

allow accurate cost tracking

* feat(db_spend_update_writer.py): log by mcp_namespaced_tool_name

store aggregate daily activity by mcp_namespaced_tool_name

Enables cost / usage tracking by mcp tool name

* fix(server.py): add key/user metadata to mcp calls

* refactor(common_daily_activity.py): update to return mcp activity in API

* fix(common_daily_activity.py): handle empty key

* fix(common_daily_activity.py): track when api key is empty

* test(test_spend_management_endpoints.py): update tests

* fix: fix ui linting error

* fix: fix linting errors

* test: add missing key

* build(schema.prisma): add mcp tool tracking

* fix(migration.sql): add schema migration file

* feat(server.py): add request logging for mcp calls

enables storing the mcp calls

* fix(new_usage.tsx): fix linting errors

* fix: fix code qa errors

* fix(activity_metrics.tsx): fix ui linting errors post-merge

* fix(types/utils.py): fix linting error

* fix(server.py): always have name
2025-07-08 22:08:16 -07:00
Ishaan Jaff e46a23db53 [Feat] Bedrock Guardrails - Raise Bedrock output text on 'BLOCKED' actions from guardrail (#12435)
* _get_http_exception_for_blocked_guardrail

* add _get_http_exception_for_blocked_guardrail

* test bedrock guard block action

* fix _get_http_exception_for_blocked_guardrail
2025-07-08 21:17:50 -07:00