Commit graph

34616 commits

Author SHA1 Message Date
Harshit28j
a56541ba26 fix(docker): purge apt-tracked npm in Dockerfile.dev to remove stale SBOM metadata
Matches the pattern already applied in Dockerfile.custom_ui and the
apk del in the wolfi-based Dockerfiles. Without this, scanners can
still report the old npm-bundled tar/minimatch versions from dpkg
metadata.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 02:28:13 +05:30
Harshit Jain
96d390d423
Update Dockerfile
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-07 19:15:57 +05:30
Harshit Jain
576d653beb
Update docker/Dockerfile.non_root
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-07 19:15:48 +05:30
Harshit Jain
ecc0efe809
Update Dockerfile
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-07 15:24:42 +05:30
Harshit Jain
dedba01cb8
Update docker/Dockerfile.dev
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-07 15:24:32 +05:30
Harshit Jain
b226975ed2
Update docker/Dockerfile.non_root
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-07 15:24:20 +05:30
Harshit Jain
3d3d1bcf79
Update Dockerfile
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-07 15:24:09 +05:30
Harshit Jain
0bccded2f0
Update docker/Dockerfile.custom_ui
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-07 15:17:50 +05:30
Harshit Jain
53efef0f4c
Update docker/Dockerfile.non_root
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-07 15:17:38 +05:30
Harshit Jain
a1c333414b
Update docker/Dockerfile.dev
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-07 15:17:29 +05:30
Harshit Jain
0923d1857c
Update docker/Dockerfile.database
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-07 15:17:18 +05:30
Harshit Jain
f8364ae5ab
Update Dockerfile
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-07 15:16:46 +05:30
Harshit Jain
81bdaa5784
Update Dockerfile
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-07 15:16:37 +05:30
Harshit Jain
96b76c808d
Update docker/Dockerfile.custom_ui
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-07 15:08:29 +05:30
Harshit28j
54597c1c62 Fix || true operator precedence in apk del npm
Wrap `apk del npm || true` in braces so only that command is
allowed to fail.  Without braces, shell precedence causes
`A && B && C || true` to swallow failures from earlier steps
(e.g. npm install -g tar@7.5.10), silently producing a build
with vulnerable packages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 15:03:47 +05:30
Harshit28j
c6c85e1140 Fix CVEs: bump tar to 7.5.10, minimatch to 10.2.4, pypdf to 6.7.3
Addresses 3 recent npm & Python CVEs:
- CVE-2026-27903/27904 (minimatch regex DoS)
- GHSA-qffp-2rhf-9h96 (tar path traversal)
- CVE-2026-27888 (pypdf regex DoS)

Changes:
- Bump tar from 7.5.8 to 7.5.10 in all 5 Dockerfiles + package.json overrides
- Bump minimatch from 10.2.1 to 10.2.4 in all Dockerfiles + package.json overrides
- Bump pypdf from 6.6.2 to 6.7.3 in requirements.txt
- Remove apk npm after global install to eliminate stale SBOM metadata

Docker Scout verification: both litellm and litellm-non_root now report 0 CVEs.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-07 14:57:51 +05:30
yuneng-jiang
e5edbc629b
Merge pull request #23029 from BerriAI/litellm_config_overrides_table
[Infra] Sync Schema, Migration, Publish Proxy Extras
2026-03-06 23:41:00 -08:00
yuneng-jiang
5b0c963977 adding builds 2026-03-06 23:39:53 -08:00
yuneng-jiang
55f448abb8 bump: version 0.4.51 → 0.4.52 2026-03-06 23:39:08 -08:00
yuneng-jiang
315d04e92c
Merge pull request #23021 from BerriAI/litellm_fix_chat_root_path
[Fix] UI Chat - SERVER_ROOT_PATH not respected for chat and back-to-console links
2026-03-06 23:31:27 -08:00
yuneng-jiang
cb0d01ff26
Merge pull request #23028 from BerriAI/revert-22938-litellm_fix_team_usage_spend
Revert "[Fix] Team Usage Spend Truncated Due to Pagination"
2026-03-06 23:23:30 -08:00
yuneng-jiang
034e83e716
Revert "[Fix] Team Usage Spend Truncated Due to Pagination" 2026-03-06 23:23:20 -08:00
Harshit Jain
edf96886da
Merge pull request #23027 from BerriAI/litellm_validate_key_alias_format
feat: feature flag on validate key alias
2026-03-07 12:52:43 +05:30
Harshit28j
1452237ec6 fix req changes 2026-03-07 12:45:49 +05:30
Harshit28j
e33b26a45a doc: add about flag feature 2026-03-07 12:42:04 +05:30
Harshit28j
d78752b85b feat: feature flag on validate key alias 2026-03-07 12:32:21 +05:30
Harshit Jain
4f4225fdbf
Merge pull request #23020 from Harshit28j/litellm_feat_guardrails_tags
feat: support list of modes in tag-based guardrails
2026-03-07 12:15:18 +05:30
yuneng-jiang
be379b7b1e
Merge pull request #22722 from atapia27/feat/org-exclusive-add-member
org-exclusive-add-member
2026-03-06 22:24:05 -08:00
yuneng-jiang
aae0c81cd1 [Fix] UI Chat - respect SERVER_ROOT_PATH for chat and back-to-console links
The Chat button in the navbar and the "back to Developer Console" link
in ChatPage used the `serverRootPath` module variable directly, which is
initialized to "/" and only updated after `getUiConfig` resolves. Since
React does not re-render on module variable changes, the links computed
their hrefs with the stale default, ignoring any configured
SERVER_ROOT_PATH.

Both components now call `useUIConfig()` (React Query, cached) to
reactively read `server_root_path`, matching the pattern used elsewhere
in the UI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 22:07:45 -08:00
yuneng-jiang
39c5adcff1
Merge pull request #23019 from BerriAI/litellm_redis_txn_buffer_check
[Fix] Block proxy startup when use_redis_transaction_buffer has no Redis
2026-03-06 22:01:37 -08:00
yuneng-jiang
b70ba3e6ed Update error message for missing Redis config
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 21:59:44 -08:00
Harshit28j
f18f4e3bbd feat: allow multiple calls from tags 2026-03-07 11:24:18 +05:30
Harshit Jain
497be5fb11
Merge pull request #23001 from Harshit28j/litellm_fix3458
Fix OTEL span redundancy, orphaned guardrail traces, and missing response IDs
2026-03-07 11:14:06 +05:30
yuneng-jiang
9d9a59190c Use passed general_settings parameter instead of global import
The validation method now reads use_redis_transaction_buffer directly
from the passed general_settings dict rather than delegating to
RedisUpdateBuffer._should_commit_spend_updates_to_redis() which
imports the global. Tests simplified to remove unnecessary patching.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 21:30:52 -08:00
yuneng-jiang
3a15e1cc2e [Fix] Block proxy startup when use_redis_transaction_buffer is enabled without Redis cache
When `use_redis_transaction_buffer: true` is set in general_settings but no
Redis cache is configured in litellm_settings, the proxy starts successfully
but silently drops all spend tracking data. This adds a startup validation
that raises a clear error, preventing the proxy from running in a broken state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 21:24:49 -08:00
yuneng-jiang
4eee2b752d
Merge pull request #23011 from BerriAI/litellm_key-aliases-internal-user
[Fix] Internal Users Cannot Access Key Aliases on Request Logs Page
2026-03-06 21:23:22 -08:00
yuneng-jiang
b314e8d20a
Merge pull request #20688 from BerriAI/litellm_budget_tier_enforcement_for_keys
[Fix] Budget-linked keys never had spend reset
2026-03-06 20:44:58 -08:00
Harshit Jain
6e09a52456
Merge pull request #23017 from BerriAI/revert-23008-litellm_bump-proxy-extras-0.4.51
Revert "bump litellm-proxy-extras 0.4.50 → 0.4.51"
2026-03-07 09:45:34 +05:30
Harshit Jain
fd4347533f
Revert "bump litellm-proxy-extras 0.4.50 → 0.4.51" 2026-03-07 09:40:00 +05:30
Harshit Jain
8e9fa6e993
Merge pull request #23008 from Harshit28j/litellm_bump-proxy-extras-0.4.51
bump litellm-proxy-extras 0.4.50 → 0.4.51
2026-03-07 09:12:14 +05:30
Harshit28j
de8d0f467a bump: version 0.4.50 → 0.4.51 2026-03-07 08:40:06 +05:30
Krish Dholakia
ff8e01d20b
feat: Add Canadian PII protection (PIPEDA) (#22951)
* feat: Add Canadian PII protection patterns and PIPEDA-compliant policy template

Adds 6 new Canadian PII regex pattern detectors to patterns.json:
- ca_sin: Social Insurance Number (PIPEDA Privacy Act, Income Tax Act)
- ca_ohip: Ontario Health Insurance Plan Number (PHIPA)
- ca_on_drivers_licence: Ontario driver's licence (HTA, PIPEDA)
- ca_immigration_doc: IRCC immigration docs (UCI, work/study permits, IMM refs)
- ca_bank_account: Canadian bank account routing (transit-institution-account)
- ca_postal_code: Canadian postal code (Canada Post spec)

Adds comprehensive policy template 'canadian-pii-protection' (id: canadian-pii-protection)
with 5 sub-guardrails grouping patterns by data type. All patterns include contextual
keyword matching (English + French keywords where applicable) to reduce false positives.
Complements existing passport_canada pattern.

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

* feat: Add Canadian PII compliance dataset and tests (57 tests)

Adds:
- test_ca_patterns.py: 30 unit tests for regex pattern matching (SIN, OHIP,
  driver's licence, immigration docs, bank account, postal code)
- test_ca_policy_e2e.py: 27 end-to-end tests running the full
  ContentFilterGuardrail pipeline with MASK action — validates detection
  of real PII and pass-through of clean prompts
- canadianPiiCompliancePrompts.ts: 21-prompt compliance dataset for UI
  evaluation, wired into the main compliancePrompts framework

Fixes keyword_pattern alternation ordering in patterns.json — longer
alternatives (e.g. "social insurance number") now precede shorter ones
("social insurance") to avoid excessive gap-word count when the regex
engine selects the shorter match first.

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

* feat: Add University of Toronto FIPPA identifier patterns and tests (36 tests)

Add 3 UofT institutional identifiers (student/employee number, UTORid, TCard)
covered under Ontario FIPPA. Includes pattern definitions, policy template
sub-guardrail, compliance prompts, unit tests, and e2e tests.

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

* fix: Correct test assertion bug and inaccurate docstring

Fix test_utorid_masked checking `result` (dict) instead of `output` (string).
Update test_ca_policy_e2e.py docstring to clarify scope vs UofT tests.

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

* fix: Address Greptile review feedback

- Tighten ca_postal_code keyword_pattern: replace broad "address" with
  specific compound terms (mailing/street/shipping/home address)
- Add missing "PIPEDA" tag to policy_templates.json for discoverability
- Add us_phone pattern to test_ca_policy_e2e.py setup to match deployed template
- Add phone number e2e test for complete coverage

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

* fix: Tighten patterns to reduce false positives and add missing test coverage

- ca_sin: reject leading-zero SINs ([1-9]\d{2}), set allow_word_numbers to false
- ca_immigration_doc: require separators in UCI pattern (prevent bare \d{10} match)
- uoft_utorid: qualify generic keywords (acorn -> acorn login, quercus -> quercus login)
- uoft_tcard: remove generic keywords (student card, id card, library card) that
  overlap with credit card contexts; keep only UofT-specific terms (tcard, campus card)
- Add visa/mastercard/amex/iban patterns to test_ca_policy_e2e.py setup to match
  deployed template; add Visa card masking test
- Add test verifying "student card" no longer triggers TCard redaction

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

---------

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-06 18:27:31 -08:00
yuneng-jiang
12005c4a02 Fix /key/aliases auth for internal users and scope results by role
Internal users were blocked from accessing /key/aliases because the route
was missing from key_management_routes. Added the route and scoped query
results so non-admin users only see aliases for their own keys and their
teams' keys, matching /key/list behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 18:20:10 -08:00
Yangqian Yan
7f5d5c5c6e
fix: use DeepSeekChatConfig instead of OpenAIConfig for deepseek provider (#22971)
* fix: use DeepSeekChatConfig instead of OpenAIConfig for deepseek provider

The deepseek provider was incorrectly using OpenAIConfig().map_openai_params()
instead of DeepSeekChatConfig().map_openai_params(), which meant DeepSeek-specific
parameter mappings were not being applied.

* test: add unit tests for deepseek DeepSeekChatConfig param mapping

Verify that get_optional_params uses DeepSeekChatConfig (not OpenAIConfig)
for the deepseek provider by testing thinking, reasoning_effort, and
budget_tokens stripping behavior.
2026-03-06 18:16:27 -08:00
yuneng-jiang
a323d37a5d
Merge pull request #23009 from BerriAI/feature/vkey-modal-squashed
[Infra] Resolve Merge Conflicts for #21065
2026-03-06 18:14:18 -08:00
Emerson Gomes
0e78aa4cf1
feat: add Azure AI grok-4-1-fast model support (#22587)
Add support for Grok 4.1 Fast models in Azure AI Foundry:
- azure_ai/grok-4-1-fast-non-reasoning
- azure_ai/grok-4-1-fast-reasoning

Pricing: $0.2/M input tokens, $0.5/M output tokens
Context window: 131k tokens

Source: https://techcommunity.microsoft.com/t5/Azure-AI-Foundry-Blog/Grok-4-0-Goes-GA-in-Microsoft-Foundry-and-Grok-4-1-Fast-Arrives/ba-p/4497964

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-06 18:10:40 -08:00
Ishaan Jaff
b7b20664c1
Gflags worker parameters (#22931)
* feat: add LITELLM_WORKER_STARTUP_HOOKS for per-worker initialization (gflags support)

Add support for running user-defined startup hooks in each worker process
during proxy_startup_event. This enables re-initialization of in-process
state (like gflags.FLAGS) that doesn't survive uvicorn worker spawning.

Usage:
  export LITELLM_WORKER_STARTUP_HOOKS=mymodule:init_fn,other:setup_fn

Hooks run early in proxy_startup_event (before config/DB loading).
Supports both sync and async callables. Errors propagate to prevent
broken workers from serving traffic. No-op when env var is unset.

Includes 5 tests covering sync/async hooks, multiple hooks, error
propagation, and no-hooks-set scenarios.

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

* docs: add Worker Startup Hooks page with gflags usage example

- New docs page: docs/proxy/worker_startup_hooks.md
  - Explains the problem (per-process state lost in multi-worker deployments)
  - Full gflags example with wrapper module and startup script
  - Covers multiple hooks, async hooks, error behavior
  - Architecture diagram showing master→worker flow
- Added LITELLM_WORKER_STARTUP_HOOKS to config_settings.md env var table
- Added to sidebar under Setup & Deployment

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>

* Update litellm/proxy/proxy_server.py

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

* Apply suggestion from @greptile-apps[bot]

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

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-06 18:09:57 -08:00
Ishaan Jaff
bb52b0b6b0
fix(mcp): resolve $ref params and path-level params in OpenAPI spec parsing (#22952)
* fix(mcp): resolve \$ref params and merge path-level params in OpenAPI tool registration

Real-world OpenAPI specs (e.g. GitHub's 11.8 MB official spec) use two
patterns that crashed tool registration:

1. \$ref parameters: params defined as {"$ref": "#/components/parameters/foo"}
   instead of inline objects. Accessing param["name"] on a $ref raises KeyError.
   Fix: resolve each param against components/parameters before processing.

2. Path-level parameters: params defined on the path object apply to all
   HTTP methods on that path, but the operation object doesn't include them.
   GitHub's spec uses this for owner/repo/etc. path params.
   Fix: merge path-level params with operation-level params (op-level wins
   when the same name+in combination appears in both).

With this fix the full GitHub REST API spec loads successfully:
720 paths → 1079 tools, all with correct parameter schemas.

* fix(mcp): resolve \$ref params in OpenAPI preview endpoint (test/tools/list)

The _preview_openapi_tools function (called by the UI add-server form to show
connection status and available tools) had the same bug as _register_openapi_tools:
it accessed param["name"] directly without resolving \$ref parameters or merging
path-level parameters from the path item.

This caused "Failed to load OpenAPI spec: 'name'" for any spec that uses
component-level parameter references (e.g. GitHub's official REST API spec).

Apply the same fix: resolve \$ref against components/parameters and merge
path-level params (with operation-level taking priority) before building schemas.

* refactor(openapi-mcp): extract resolve_operation_params, add tests

- Hoist _resolve_ref and _resolve_param_list to module level in
  openapi_to_mcp_generator.py (were being redefined on every loop iteration)
- _resolve_ref now returns None for unresolvable $refs instead of
  the stub dict, preventing (None, None) from poisoning deduplication
- Add resolve_operation_params() as a shared helper that handles both
  $ref resolution and path-level param merging
- Replace duplicated inline logic in mcp_server_manager.py and
  rest_endpoints.py with calls to resolve_operation_params()
- Add TestResolveRef, TestResolveParamList, TestResolveOperationParams
  test classes covering $ref resolution, path-level merging, collision
  semantics, unresolvable ref filtering, and a GitHub-style spec fixture
2026-03-06 18:02:48 -08:00
yuneng-jiang
c2b03c15b9
Merge pull request #22939 from BerriAI/litellm_hashicorp_vault_backend
feat: Hashicorp Vault config override backend endpoints
2026-03-06 17:59:46 -08:00
Ryan Crabbe
6091621bec Build artifacts 2026-03-06 17:58:49 -08:00