Commit Graph
207 Commits
Author SHA1 Message Date
yuneng-jiang 2eded1dda6 bump: version 0.4.43 → 0.4.44 2026-02-19 10:50:23 -08:00
yuneng-jiang c911cfbabf Merge remote-tracking branch 'origin' into litellm_key_last_active_tracking 2026-02-19 10:27:48 -08:00
yuneng-jiangandClaude Opus 4.6 6097905e55 [Feature] Track key last active timestamp
Virtual keys only track created_at and updated_at, which don't indicate
when a key was last used. This adds a last_active field that gets updated
during the async batch spend update, giving admins visibility into which
keys are actively being used.

Changes:
- Add last_active DateTime? to VerificationToken and
  DeletedVerificationToken in all 3 schema files and Python types
- Set last_active in the batch key spend update alongside spend increment
- Add Last Active column to virtual keys UI table with info popover
  and hover tooltip showing full date/time with timezone

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-18 23:11:58 -08:00
Harshit JainandGitHub 66ce7513f6 Merge branch 'main' into litellm_project_management_apis 2026-02-19 08:40:12 +05:30
e00c181f0c Mcp user permissions (#21462)
* feat(schema.prisma): add object permissions for end users

allows controlling if end user can call specific mcp servers

* feat: cleanup for customer_endpoints support of object permission id

* fix: cleanup str

* feat(customers/): enforce end user can only call allowed mcps - if configured

* docs: document customer/end user object permission usage

* feat: enforce end user permissions on MCP tool calls

This commit implements end user permission enforcement for MCP servers:

1. Always add server prefixes to MCP tool names
   - Removed conditional logic that only added prefixes when multiple servers existed
   - Now always adds server prefix for consistent tool naming across all scenarios
   - Updated 5 locations in server.py (list_tools, get_prompts, get_resources,
     get_resource_templates, get_prompt)

2. Created MCP End User Permission Guardrail Hook
   - New guardrail hook: litellm/proxy/guardrails/guardrail_hooks/mcp_end_user_permission.py
   - Runs on post_call to validate tool calls in LLM responses
   - Extracts MCP server name from tool names (splits on first '-')
   - Checks if end_user_id has permissions for the MCP server
   - Raises GuardrailRaisedException if end user lacks permission
   - Supports both streaming and non-streaming responses

3. Added comprehensive tests
   - Test file: tests/test_litellm/proxy/guardrails/guardrail_hooks/test_mcp_end_user_permission.py
   - Tests cover: authorized/unauthorized tools, non-MCP tools, no end_user scenarios
   - Tests permission checking logic and exception raising

The hook integrates with the existing MCPRequestHandler._get_allowed_mcp_servers_for_end_user
to fetch end user permissions and enforce access control at the response level.

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

* refactor: remove redundant add_prefix variable assignments

Simplified the code by removing intermediate `add_prefix` variable
assignments and passing `True` directly to function calls since
we now always add server prefixes.

Changes:
- Removed `add_prefix = True` variable assignments in 5 locations
- Changed `add_prefix=add_prefix` to `add_prefix=True` in function calls
- Added inline comments to clarify the behavior

This makes the code more concise and clearer in intent.

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

* feat(auth_utils.py): support safety_identifier as a valid way of passing the end user id for responses api

* feat(llms): ensure 'tools' is correctly updated for responses api

* fix: fix greptile feedback

* feat: transformation.py

proper responses api tool handling for guardrail translation layer

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-18 18:53:59 -08:00
Krish DholakiaandGitHub 14a35a12cb Revert "End users - Allow giving end users access to specific mcp servers (#…" (#21461)
This reverts commit 1f521be0f2.
2026-02-17 22:49:57 -08:00
Krish DholakiaandGitHub 1f521be0f2 End users - Allow giving end users access to specific mcp servers (#21411)
* feat(schema.prisma): add object permissions for end users

allows controlling if end user can call specific mcp servers

* feat: cleanup for customer_endpoints support of object permission id

* fix: cleanup str

* feat(customers/): enforce end user can only call allowed mcps - if configured

* docs: document customer/end user object permission usage

* feat: address greptile comments
2026-02-17 22:45:49 -08:00
Harshit JainandGitHub 56b53cb502 Merge branch 'main' into litellm_fix-virtual-key-grace-period 2026-02-15 08:09:13 +05:30
Ishaan JaffandGitHub eb432bf911 Litellm notes 181 12 (#21231)
* docs

* docs

* docs

* docs

* fix SCHEMA

* LiteLLM_PolicyTable

* litellm-proxy-extras = {version = "0.4.39",
2026-02-14 16:39:22 -08:00
Ishaan Jaffer 54bd5632d1 new schema 2026-02-14 09:56:45 -08:00
yuneng-jiang 72848f4c08 change to model name for backwards compat 2026-02-13 16:44:49 -08:00
Harshit JainandGitHub 673b7d1fea Merge branch 'main' into litellm_fix-virtual-key-grace-period 2026-02-13 18:14:47 +05:30
Harshit Jain f77fbefc22 fix: resolve conflicts with verification e2e 2026-02-13 06:11:03 +05:30
yuneng-jiang fbfaa6c8af rename unified access group to access group 2026-02-12 12:30:22 -08:00
yuneng-jiang 658a283be3 unified access groups v0 2026-02-11 20:44:30 -08:00
Ishaan JaffGitHubClaude Opus 4.6greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
f83620157e [Feat] Policies - Allow connecting Policies to Tags, Simulating Policies, Viewing how many keys, teams it applies on (#20904)
* init schema with TAGS

* ui: add policy test

* resolvePoliciesCall

* add_policy_sources_to_metadata + headers

* types Policy

* preview Impact

* def _describe_match_reason(

* match based on TAGs

* TestTagBasedAttachments

* test fixes

* add policy_resolve_router

* add_guardrails_from_policy_engine

* TestMatchAttribution

* refactor

* fix

* fix: address Greptile review feedback on policy resolve endpoints

- Track unnamed keys/teams as separate counts instead of inflating
  affected_keys_count with duplicate "(unnamed key)" placeholders.
  Added unnamed_keys_count and unnamed_teams_count to response.
- Push alias pattern matching to DB via _build_alias_where() which
  converts exact patterns to Prisma "in" and suffix wildcards to
  "startsWith" filters.
- Gate sync_policies_from_db/sync_attachments_from_db behind
  force_sync query param (default false) to avoid 2 DB round-trips
  on every /policies/resolve request.
- Remove worktree-only conftest.py that cleared sys.modules at import
  time — no longer needed since code moved to main repo.
- Rename MAX_ESTIMATE_IMPACT_ROWS → MAX_POLICY_ESTIMATE_IMPACT_ROWS.

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

* fix: eliminate duplicate DB queries and fix header delimiter ambiguity

- Fetch teams table once in estimate_attachment_impact and reuse for
  both tag-based and alias-based lookups (was querying teams twice when
  both tag_patterns and team_patterns were provided).
- Convert tag/team filter functions from async DB queries to sync
  filters that operate on pre-fetched data (_filter_keys_by_tags,
  _filter_teams_by_tags).
- Fix comma ambiguity in x-litellm-policy-sources header: use '; '
  as entry delimiter since matched_via values can contain commas.
- Use '+' as the within-value separator in matched_via reason strings
  (e.g. "tag:healthcare+team:health-team") to avoid conflict with
  header delimiters.

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

* Update litellm/proxy/policy_engine/policy_resolve_endpoints.py

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-02-10 17:50:37 -08:00
Carlo Alberto Ferraris 248fe65736 add missing indexes on VerificationToken table 2026-02-09 16:59:28 +09:00
yuneng-jiang 87a75900a1 adding soft_budget to deleted teams table 2026-02-07 11:05:42 -08:00
Ishaan JaffandGitHub 9b1ccc0608 [Feat] IP-Based Access Control for MCP Servers (#20620)
* update MCPAuthenticatedUser

* add available_on_public_internet for MCPs

* update claude.md

* init IPAddressUtils

* init available_on_public_internet

* add on REST endpoints

* filter with IP

* TestIsInternalIp

* _extract_mcp_headers_from_request

* init get_mcp_client_ip

* _get_general_settings

* allowed_server_ids

* address PR comments

* get_mcp_server_by_name fix

* fix server

* fix review comments

* get_public_mcp_servers

* address _get_allowed_mcp_servers

* test fix

* fix linting

* inint ui types

* add ui for managing MCP private/public

* add ui

* fixes

* add to schema

* add types

* fix endpoint

* add endpoint

* update manager

* test mcp

* dont use external party for ip address
2026-02-06 17:58:24 -08:00
yuneng-jiang a17efa1c8e Add soft_budget to team table and create update endpoints 2026-02-05 14:43:48 -08:00
Sameer Kankute 3c12dda856 bump: litellm-proxy-extras 0.4.29 → 0.4.30
- Add allow_team_guardrail_config field to TeamTable and DeletedTeamTable
- Add migration 20260205091235_allow_team_guardrail_config
2026-02-05 09:21:20 +05:30
Sameer Kankute fae0554fdc Revert "add missing indexes on VerificationToken table (#20040)"
This reverts commit 1e8848ca97.
2026-02-03 15:01:28 +05:30
Harshit Jain 768f9a44b2 fix: virutal key grace period from env/UI 2026-02-03 09:50:10 +05:30
Carlo Alberto FerrarisandSameer Kankute 1e8848ca97 add missing indexes on VerificationToken table (#20040) 2026-02-02 18:22:15 +05:30
Ishaan Jaffer 47efa33f0b sync: generator client 2026-01-31 15:07:28 -08:00
Ishaan JaffandGitHub 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
Ishaan Jaffer 9e02a38002 add schema.prisma 2026-01-23 13:16:58 -08:00
yuneng-jiangandGitHub 809b4cb310 Revert "Revert "[Feature] Deleted Keys and Deleted Teams Table"" 2026-01-16 14:25:23 -08:00
YutaSaitoandGitHub 034e3a6d44 Revert "[Feature] Deleted Keys and Deleted Teams Table" 2026-01-17 06:46:41 +09:00
yuneng-jiang 830f2deb0d ensuring this still works PENDING PROXY EXTRAS 2026-01-15 17:24:31 -08:00
yuneng-jiang 5ff768e5e0 Merge remote-tracking branch 'origin' into litellm_deleted_keys_team 2026-01-15 15:55:18 -08:00
yuneng-jiang 140ce5fce2 Merge remote-tracking branch 'origin' into litellm_key_team_routing_config 2026-01-07 11:08:01 -08:00
yuneng-jiang ccfffc5de9 Add endpoint to aggregate activity tables 2026-01-06 15:54:03 -08:00
yuneng-jiang 1b7b42628d Add/update for router_settings in keys / teams 2026-01-05 16:19:42 -08:00
Yuta Saito f1d77ae14d feat: allow_all_keys to mcp server 2026-01-05 15:49:09 +09:00
Yuta Saito 35f9a75d55 feat: add UI support for configuring meta URLs 2026-01-02 15:07:37 +09:00
yuneng-jiang 2a4f883e78 Merge remote-tracking branch 'origin' into litellm_deleted_keys_team 2025-12-19 11:36:27 -08:00
Ishaan JaffandGitHub 09b5ee9428 [Feat] Unified Skills API - works across Anthropic, Vertex, Azure, Bedrock (#18232)
* init LiteLLM_SkillsTable

* init LiteLLMSkillsTransformationHandler

* init LiteLLMSkillsTransformationHandler

* init skills

* init SkillsInjectionHook

* init litellm skills handler

* _fetch_skill_from_db

* LiteLLMSkillsTransformationHandler

* add _prisma_skill_to_litellm

* use SkillPromptInjectionHandler

* refactor skills handler

* add slack GIF

* test_skill_code_execution_via_deployment_hook

* init readme

* test_get_skill_sdk

* test skills in DB

* fix code qa

* init with containers param

* SkillsInjectionHook

* fix type

* convert_skill_to_anthropic_tool, get_litellm_code_execution_tool_anthropic

* fix messages skills handler

* test_slack_gif_skill_creates_gif

* init SkillsInjectionHook

* clean async_pre_call_hook

* fixes

* working unified skills API! yeet

* fix mypy linting

* LiteLLM_SkillsTable

* llm-sandbox==0.3.31

* fix
2025-12-19 18:55:59 +05:30
yuneng-jiang 305a177135 Schema changes 2025-12-18 15:39:33 -08:00
Sameer KankuteandGitHub da81ab6d97 Merge pull request #17758 from BerriAI/litellm_managed_files_target_storage
Add v0 support for target storage
2025-12-12 22:26:34 +05:30
Sameer Kankute 7b1cef86a7 Add support for target_storage param 2025-12-11 15:08:17 +05:30
yuneng-jiang 91056c1d7e Merge remote-tracking branch 'origin' into litellm_daily_agent_table 2025-12-10 20:47:58 -08:00
Ishaan JaffandGitHub 059fedbed5 [Feat] Agent Gateway - Track agent_id in SpendLogs (#17795)
* add agent_id in metadata in spend logs

* add agent_id in SpendLogsPayload

* add agent_id in SpendLogsPayload

* add _set_agent_id_on_logging_obj

* add agent id tracking in SpendLogs

* add agent id in spend logs

* fix create_a2a_client

* test_asend_message_passes_agent_id_to_callback

* test_get_logging_payload_includes_agent_id_from_kwargs

* test_asend_message_streaming_triggers_callbacks

* fix asend_message_streaming

* asend_message_streaming

* A2AStreamingIterator

* _handle_stream_message

* test_asend_message_streaming_propagates_metadata
2025-12-10 16:09:56 -08:00
yuneng-jiang 1cad479297 Daily Agent Usage Table WIP 2025-12-10 11:50:52 -08:00
yuneng-jiang e4442c2946 Change UI Settings to a dedicated table 2025-12-09 11:19:53 -08:00
yuneng-jiangandGitHub cb18af542e Merge pull request #17498 from BerriAI/litellm_customer_usage_backend
[Feature] Customer (end user) Usage
2025-12-05 15:31:08 -08:00
Ishaan JaffandGitHub 8f592088ed [Feat] Agent Access Control - Enforce Allowed agents by key, team + add agent access groups on backend (#17502)
* init schema.prisma

* init LiteLLM_ObjectPermissionTable with agents and agent_access_groups

* TestAgentRequestHandler

* refatctor agent list

* add AgentRequestHandler

* fix agent access controls by key/team

* feat - new migration for LiteLLM_AgentsTable

* fix add LiteLLM_ObjectPermissionBase with agent and agent groups

* add agent routes to llm api routes

* add agent routes as llm route
2025-12-04 16:31:00 -08:00
yuneng-jiang 562afb208d v0 customer usage, pending tests + extras version bump 2025-12-04 12:30:08 -08:00
yuneng-jiang dd72ff3abf Add organization_id to spend logs table 2025-11-22 12:54:49 -08:00
yuneng-jiang 6029a24baa Merge remote-tracking branch 'origin' into litellm_org_usage 2025-11-20 20:19:16 -08:00