Commit graph

37495 commits

Author SHA1 Message Date
Yuneng Jiang
9a8aa4fae4
[Feature] UI - Models: add api_base field for Anthropic provider form 2026-04-17 13:32:17 -07:00
Yuneng Jiang
ad48af69aa
[Feature] UI - Models: allow empty api_key for Anthropic provider (BYOK) 2026-04-17 13:32:17 -07:00
Yuneng Jiang
d0f1706479
[Test] pre-call utils: regression coverage for BYOK x-api-key forwarding 2026-04-17 13:32:17 -07:00
Yuneng Jiang
66167f532e
[Feature] UI - Settings: add forward_llm_provider_auth_headers toggle 2026-04-17 13:32:17 -07:00
ishaan-berri
6ed292956e
Merge pull request #25934 from BerriAI/litellm_prometheus_improvements
[WIP][Perf] Litellm prometheus improvements
2026-04-17 13:28:12 -07:00
Ishaan Jaffer
3aa63d524e
style(github_copilot): simplify _get_github_headers return type annotation 2026-04-17 13:27:47 -07:00
Ishaan Jaffer
d369f0a1c1
docs(user_management): add budget_limits param to user_update docstring 2026-04-17 13:13:03 -07:00
Ishaan Jaffer
77767f5787
docs(org_management): add allowed_models param to new_organization docstring 2026-04-17 13:06:34 -07:00
Krrish Dholakia
dd76cc5d9d
docs: add "Copy Page as Markdown" + llms.txt to docs site (#25975)
* docs: add copy-page-as-markdown button + llms.txt generation

Adds the signalwire llms-txt Docusaurus plugin + theme so every
docs page gets:
- A "Copy Page" dropdown in the breadcrumbs (Copy, View Markdown,
  Ask ChatGPT, Ask Claude) — defaults from the theme hook, no
  extra config required.
- A raw `.md` companion at `<page>.md` for LLM consumption.
- Site-wide `/llms.txt` index and `/llms-full.txt` corpus.

The signalwire plugin README documents a `copyPageButton` option
that the v1.2.2 Joi schema actually rejects; the theme's defaults
cover the same feature set, so only `content.enableMarkdownFiles`
and `enableLlmsFullTxt` are set. Theme is pinned to `1.0.0-alpha.9`
because the floating version resolves to a broken canary whose
`main` points at a missing file.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* docs: pin exact versions for signalwire llms-txt deps

Drop the caret ranges on the two packages added in the prior
commit so the docs site pulls byte-identical npm tarballs on
every install. Matches the existing convention in this
package.json (everything else is already exact) and protects
against supply-chain substitution if a malicious patch version
is published under the same minor.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

* docs: upgrade signalwire llms-txt plugin to v2 alpha + enable copy button

The stable v1.2.2 plugin we first pinned does not call setGlobalData
during contentLoaded, so the theme's CopyPageContent component always
returned null (its `!siteConfig` bailout). The theme v1.0.0-alpha.9
is built against the v2-alpha plugin API, which is the version that
actually wires the copy-content JSON and plugin config into the theme
via setGlobalData.

Pins plugin to 2.0.0-alpha.7 (exact, no caret) and switches the
config to the v2 schema:
- top-level `markdown` + `llmsTxt` replace the v1 `content` block
- new `ui.copyPageContent` (off by default in v2) enables the button
  with view-markdown + ChatGPT + Claude actions.

Verified end-to-end: production build serves the dropdown with
"Copy Raw Markdown", "View Markdown", "Reference in ChatGPT", and
"Reference in Claude" on /docs/routing (button mounts at ~x=960 in
the breadcrumbs row).

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: yuneng-jiang <yuneng@berri.ai>
Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>
2026-04-17 13:03:12 -07:00
Ishaan Jaffer
e8461b5b97
style: run black formatter on files from main merge 2026-04-17 13:02:59 -07:00
Ishaan Jaffer
ab44df202b
docs(team_management): add budget_limits and default_team_member_models to update_team docstring 2026-04-17 13:02:39 -07:00
Ishaan Jaffer
375cfb7f95
chore: update uv.lock after merging main 2026-04-17 12:56:23 -07:00
Ishaan Jaffer
2893301a0e
docs(team_management): add budget_limits and default_team_member_models params to new_team docstring 2026-04-17 12:55:33 -07:00
Ishaan Jaffer
09e0137bb2
docs(user_management): add budget_limits param to new_user docstring 2026-04-17 12:51:53 -07:00
harish-berri
8e77f9ee94 resolving code comments to move helper logic to ``prometheus_helper.py`` 2026-04-17 19:50:02 +00:00
Ishaan Jaffer
4423d09845
fix(ui): add missing Accordion imports to TeamInfo.tsx 2026-04-17 12:47:27 -07:00
Ishaan Jaffer
b2aa186d56
docs(key_management): add budget_limits param to update_key_fn docstring 2026-04-17 12:47:26 -07:00
Ishaan Jaffer
665306b4f0
fix(ui): fix TypeScript error - publicPage === true in narrowed false context 2026-04-17 12:41:33 -07:00
Ishaan Jaffer
a508a9665a
docs(key_management): add budget_limits param to generate_key_fn docstring 2026-04-17 12:41:30 -07:00
Ishaan Jaffer
f31d4faa87
Merge origin/main into litellm_ishaan_april6 2026-04-17 12:36:51 -07:00
ishaan-berri
bd5f560f56
Merge pull request #25930 from BerriAI/litellm_xai_grok-4.20-0309-reasoning
Add support for grok-4.20-0309-reasoning model
2026-04-17 12:30:32 -07:00
yuneng-jiang
7c66edbf4a
Merge pull request #25906 from stuxf/fix/ssrf-url-validation
fix(proxy): add URL validation for user-supplied URLs
2026-04-17 12:19:03 -07:00
yuneng-jiang
32714a4dc2
Merge pull request #25905 from stuxf/fix/metadata-security-controls
fix(proxy): read guardrail config from admin metadata, fix tag routing consistency
2026-04-17 12:16:28 -07:00
yuneng-jiang
50a6324d58
Merge pull request #25904 from stuxf/fix/org-boundary-enforcement
fix(proxy): enforce organization boundaries in admin operations
2026-04-17 12:13:57 -07:00
Yuneng Jiang
246a5bd158
Merge remote-tracking branch 'origin/litellm_internal_staging' into litellm_yj_apr16 2026-04-17 12:11:51 -07:00
harish-berri
b3ccbb96ba resolve lint errors 2026-04-17 19:06:23 +00:00
harish-berri
9d10ebf49c fix(prometheus): restore labeled-counter tests; tolerate UserAPIKeyLabelValues kwargs 2026-04-17 18:16:38 +00:00
harish-berri
5df3287016 fixing backwards compatibility for tests 2026-04-17 18:08:48 +00:00
ryan-crabbe-berri
c23ce918cd
Merge pull request #25878 from BerriAI/litellm_refactor-pkce-dedup
Refactor: extract shared PKCE helpers into utils/pkce.ts
2026-04-17 10:26:22 -07:00
ryan-crabbe-berri
2b5bf4cba8
Merge pull request #25882 from BerriAI/litellm_fix-latency-config-empty-defaults
fix: return None for routing_strategy_args when strategy is not latency-based
2026-04-17 10:25:42 -07:00
harish-berri
62a189f57c added comments to disable repr 2026-04-17 17:04:31 +00:00
harish-berri
1eb6be9d44 Removed slots attr which was causing test failures in python 3.9.
Improved sentinel handling flagged by greptile
2026-04-17 17:00:13 +00:00
Sameer Kankute
76c69bb933
fix(proxy): avoid duplicate reasoning capability lookup
Compute supports_reasoning once per non-wildcard health-check resolution path and update the stale default-max-tokens test docstring.

Made-with: Cursor
2026-04-17 12:49:31 +05:30
Sameer Kankute
d86c6a5b2f
fix(proxy): prioritize reasoning health check token defaults
Apply reasoning-first precedence for background health-check max tokens, parse reasoning env as optional, and raise non-wildcard fallback max_tokens from 1 to 5 for better reliability.

Made-with: Cursor
2026-04-17 12:36:58 +05:30
harish-berri
95824ddea6 removing pydantic base model __repr__, __repr_str__ and __repr_args__ function calls from the hotpath and replacing them with lightweight python native dataclasses.
TODO: Override pydantic __repr__ class in all pydantic objects and compare performance.

Improves CPU time perf by 2X in the hotpath
2026-04-17 05:12:51 +00:00
Yuneng Jiang
bcb2ea63f1
fix: add explicit admin bypass to agent access checks for consistency 2026-04-16 21:12:09 -07:00
Stefano Romanò
f69b9d6564
Add capability to override default GitHub Copilot authentication endp… (#25915)
* Add capability to override default GitHub Copilot authentication endpoints

This feature adds support for GitHub Enterprise subsriptions with custom domain/data ownership (which use a different URL compared to standard accounts)

* Update documentation with new parameters

* Move access token URL and Client ID retrieval outside for loop

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

* Fix spurious comment from Greptile review

* Align api_base retrieval behavior across chat and embedding transformations

* Add missing GitHub Copilot client ID parameter in docs

* Update website documentation with newer options for GitHub Enterprise Copilot

* Fix default value for Copilot client ID in docs

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

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-04-16 21:04:38 -07:00
michelligabriele
cd92b04476
fix(ocr): add missing Mistral OCR params to allowlist (#25858) 2026-04-16 21:00:16 -07:00
Sameer Kankute
3ef362289b
Add support for grok-4.20-0309-reasoning model 2026-04-17 08:49:59 +05:30
shivam
a84c27674f
refactor(azure-ocr): move urllib.parse.quote to module imports
Remove inline import in get_complete_url; quote is stdlib with no circular
import risk per project style.

Made-with: Cursor
2026-04-16 19:28:32 -07:00
shivam
089ca5fc0f
fix(azure-ocr): reject mixed bool+int in pages list validation
Use any() instead of all() for bool check so lists like [True, 1, 2]
raise ValueError; bool is a subclass of int so all(int) alone was insufficient.

Made-with: Cursor
2026-04-16 19:27:14 -07:00
shivam
b6d5728134
add support for pages param 2026-04-16 19:07:02 -07:00
yuneng-jiang
850fe595ac
Merge pull request #25924 from BerriAI/litellm_internal_staging
Some checks failed
Read Version from pyproject.toml / read-version (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Unit Tests: Security / security (push) Has been cancelled
GitHub Actions Security Analysis / zizmor (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
CodSpeed Benchmarks / benchmarks (push) Has been cancelled
Helm unit test / unit-test (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-db (auth-checks, tests/proxy_unit_tests/test_auth_checks.py tests/proxy_unit_tests/test_user_api_key_auth.py, 20, 8) (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-db (key-generation, tests/proxy_unit_tests/test_key_generate_prisma.py, 30, 0) (push) Has been cancelled
Unit Tests: Proxy DB Operations / proxy-db (remaining, tests/proxy_unit_tests --ignore=tests/proxy_unit_tests/test_key_generate_prisma.py --ignore=tests/proxy_unit_tests/test_auth_checks.py --ignore=tests/proxy_unit_tests/test_user_api_key_auth.py, 30, 8) (push) Has been cancelled
[Infra] Promote Internal Staging to main
2026-04-16 18:21:51 -07:00
yuneng-jiang
bf7b7f7f60
Merge pull request #25872 from BerriAI/yj_bump_apr16_2
Some checks are pending
Unit Tests: Proxy DB Operations / proxy-db (key-generation, tests/proxy_unit_tests/test_key_generate_prisma.py, 30, 0) (push) Waiting to run
Unit Tests: Proxy DB Operations / proxy-db (auth-checks, tests/proxy_unit_tests/test_auth_checks.py tests/proxy_unit_tests/test_user_api_key_auth.py, 20, 8) (push) Waiting to run
Unit Tests: Proxy DB Operations / proxy-db (remaining, tests/proxy_unit_tests --ignore=tests/proxy_unit_tests/test_key_generate_prisma.py --ignore=tests/proxy_unit_tests/test_auth_checks.py --ignore=tests/proxy_unit_tests/test_user_api_key_auth.py, 30, 8) (push) Waiting to run
Unit Tests: Security / security (push) Waiting to run
bump: version 1.83.8 → 1.83.9
2026-04-16 17:56:44 -07:00
yuneng-jiang
f07aadc3f9
Merge pull request #25873 from BerriAI/yj_extras_bump_apr16
bump: proxy extras version 0.4.65 → 0.4.66
2026-04-16 17:56:33 -07:00
yuneng-jiang
724926fba9
Merge pull request #25920 from BerriAI/litellm_/amazing-almeida
[Test] Mock Bedrock Moonshot tests + [Fix] TogetherAIConfig recursion
2026-04-16 17:55:58 -07:00
user
e3b55794ce
fix(proxy): close /organization member_delete + role-escalation gaps
Audit-B #7 and #8.

1. /organization/member_delete was not in org_admin_only_routes, so it
   fell through to management_routes/self_managed_routes and let any
   caller that reached the route delete arbitrary org memberships
   without the organization_role_based_access_check that member_add
   and member_update trigger. Adding it to org_admin_only_routes
   applies the same ORG_ADMIN-of-target-org gate.

2. /organization/member_update had no validation that the target user
   was not a global PROXY_ADMIN. An org-admin of any org could alter
   a PROXY_ADMIN user's per-org role. Reject this unless the caller
   is PROXY_ADMIN.
2026-04-17 00:44:24 +00:00
Yuneng Jiang
00bac08e01
[Test] Mock remaining live Bedrock Moonshot tests
Extends the prior moonshot mocking to cover every inherited
BaseLLMChatTest test that still made a live AWS Bedrock call. Adds
request-body assertions for each override.

New overrides:

- test_content_list_handling: verifies the outgoing body round-trips
  user content in list-of-text form; asserts response.choices[0].
  message.content parses back from the canned response.
- test_pydantic_model_input: verifies a pydantic Message input does
  not raise and produces a parseable response.
- test_response_format_type_text_with_tool_calls_no_tool_choice:
  verifies tools are forwarded and response_format + drop_params do
  not break the call.
- test_streaming: verifies stream=True routes to the
  invoke-with-response-stream endpoint. Bedrock invoke streaming is
  intercepted at the make_sync_call import site rather than via the
  caller-supplied client, because CustomStreamWrapper.fetch_sync_stream
  invokes the stored make_call partial with
  client=litellm.module_level_client, overriding any client passed by
  the caller.

Extracts a shared _make_moonshot_response helper and a
_invoke_with_mocked_post harness so all the sync mocks share one
canned response body.

After this change TestBedrockMoonshotInvoke runs 23 passed, 29
skipped, 0 live-callers, all in under 1s locally.
2026-04-16 17:43:43 -07:00
user
c7c3df2b02
fix(proxy): extend /key/update admin check to non-budget fields
Audit-B #2. _check_key_admin_access was gated on max_budget/spend
changes only, which meant a non-admin caller could blanket-rewrite
any OTHER field on any key (key_alias, models, tpm_limit, rpm_limit,
metadata, tags, allowed_routes, guardrails, blocked, duration,
permissions, auto_rotate, access_group_ids, object_permission, …)
as long as they avoided budget/spend. Example attack:

  POST /key/update {
    key: sk-victim-in-org-B,
    models: [],
    blocked: true,
    organization_id: org-A,
  }

The caller is org-admin of org-A, which satisfies the route gate;
the handler then wipes models and blocks the victim's key.

Policy after this fix:
- PROXY_ADMIN: always allowed.
- Key OWNER (matching user_id): allowed for non-budget fields;
  budget/spend changes still require team/org admin.
- Everyone else: must pass _check_key_admin_access (PROXY_ADMIN /
  key-owner / team-admin / org-admin of the key).

Regression test confirms a non-owner INTERNAL_USER cannot rewrite
key_alias/blocked on someone else's key; existing test covers the
owner-can-update-alias case; existing test covers
internal-user-cannot-modify-max-budget.
2026-04-17 00:41:00 +00:00
user
662d05531d
fix(proxy): close three more org-boundary escape paths
Continuation of Veria E3NpkuAd / Audit-B hardening. All three are the
same anti-pattern PR #25904 already addressed for _user_is_org_admin
and /user/delete: route-level gate trusts a caller-supplied scope
field, handler operates on a different scope.

1. /user/update no longer silently creates a user when the target
   email doesn't exist. Pre-fix, an org admin could supply a fresh
   email + caller-chosen budget/models/metadata; the INSERT path
   created the user with no org attachment, bypassing /user/new's
   org/team authorization. Now require PROXY_ADMIN for the create
   branch; return 404 otherwise. Also fixes /user/bulk_update because
   it dispatches through the same _update_single_user_helper.

2. /team/bulk_member_add with all_users=true restricted to PROXY_ADMIN.
   The flag pulls every user in the database into the target team,
   ignoring org scope — any team admin could use it to capture every
   user across every org into their team.

3. /team/update now verifies destination-org admin rights. When the
   request carries an organization_id that differs from the team's
   current org, an org admin of the caller's current org could
   previously relocate the team into any other org (draining their
   resources, or capturing a team they once administered). Require
   PROXY_ADMIN or org-admin of the DESTINATION org for the relocation.

Regression tests for #1 and #3; #2 covered by the existing bulk_add
suite after the gate addition.
2026-04-17 00:36:28 +00:00