Commit graph

36998 commits

Author SHA1 Message Date
Sameer Kankute
c03488c661
docs(advisor): revamp advisor tool docs for cross-provider support
- Clearly separate the two tool formats: advisor_20260301 (native/proxy)
  vs litellm_advisor function tool (chat completions with callback)
- Answer "how do I configure the stronger model?" inline where the user
  first encounters each format
- Add supported providers table with native vs orchestration distinction
- Show AdvisorInterceptionLogger setup is required for litellm_advisor
  function format in SDK usage
- Update proxy config example to use model_list deployment names
- Document provider_specific_fields.advisor_tool_results for chat completions
- Document server_tool_use + advisor_tool_result response blocks for messages
- Add max_uses, cost, and streaming behavior notes
- Remove tool_choice="required" from all examples (causes forced loops)

Made-with: Cursor
2026-04-15 17:38:25 +05:30
Sameer Kankute
1f3fc7b5bb
test(advisor): add tests for cross-provider orchestration and streaming
- Test Anthropic executor + OpenAI advisor via orchestration loop
- Test native Anthropic path preserved for claude-opus-4-6 advisor
- Test tool_choice is stripped from follow-up executor turns
- Test provider_specific_fields contains advisor_tool_results blocks
- Test _advisor_interception_converted_stream stays in litellm_params
- Test wildcard router deployment lookup for order fallback

Made-with: Cursor
2026-04-15 17:38:13 +05:30
Sameer Kankute
79ee78ece0
fix(router): wildcard-aware deployment lookup for order-based fallback
Use get_model_list() instead of _get_all_deployments() so pattern-routed
model groups (e.g. openai/* -> openai/gpt-4.1-mini) are included when
computing the deployment order set for fallback logic.

Made-with: Cursor
2026-04-15 17:38:06 +05:30
Sameer Kankute
28b5e2e450
feat(proxy): initialize AdvisorInterceptionLogger from proxy config
Initialize AdvisorInterceptionLogger via initialize_from_proxy_config()
so default_advisor_model and enabled_providers from
litellm_settings.advisor_interception_params are picked up automatically
when using the proxy.

Add advisor_interception_config.yaml example showing the minimal config
needed to wire an advisor model to the proxy.

Made-with: Cursor
2026-04-15 17:38:01 +05:30
Sameer Kankute
2ca1070694
fix(streaming): propagate advisor interception stream flag in http handler
Propagate _advisor_interception_converted_stream from litellm_params into
model_call_details and convert the agentic non-streaming response back to a
fake stream when the flag is set, mirroring the existing websearch path.

Made-with: Cursor
2026-04-15 17:37:55 +05:30
Sameer Kankute
b7e24e7af4
feat(advisor): cross-provider orchestration loop for chat/completions
- Skip agentic loop for Anthropic executor only when advisor is the
  native-compatible claude-opus-4-6; all other advisor models use the
  LiteLLM orchestration loop regardless of executor provider
- Convert litellm_advisor function tools to provider-native format only
  when executor is Anthropic and advisor is claude-opus-4-6; otherwise
  keep as OpenAI-compatible function tool for the orchestration loop
- Add _is_native_anthropic_advisor_model() to resolve proxy aliases
  before checking native compatibility
- Inject server_tool_use + advisor_tool_result into provider_specific_fields
  of the final ModelResponse to match Anthropic native response structure
- Move _advisor_interception_converted_stream flag into litellm_params
  so it is never forwarded to the upstream LLM provider
- Strip tool_choice from optional_params on follow-up executor turns to
  prevent forced advisor re-invocation loops
- Initialize AdvisorInterceptionLogger with default_advisor_model and
  enabled_providers from proxy config via initialize_from_proxy_config()

Made-with: Cursor
2026-04-15 17:37:47 +05:30
Sameer Kankute
1e72e22ebf
feat(messages-api): cross-provider advisor orchestration for /v1/messages
- Run MessagesInterceptor checks before pre-request hooks so the
  synthetic advisor tool is registered before any tool conversion pass
- AdvisorOrchestrationHandler resolves default_advisor_model from
  litellm.advisor_interception_params when the tool definition omits it
- Sub-calls route through llm_router.acompletion() for proper credential
  resolution across any provider
- Native Anthropic path preserved: if executor is Anthropic and advisor
  is claude-opus-4-6 the request passes through unchanged
- Any other combination (Anthropic executor + non-Opus advisor, or
  non-Anthropic executor) uses the LiteLLM orchestration loop
- Final response always includes server_tool_use and advisor_tool_result
  content blocks matching Anthropic native format
- FakeAnthropicMessagesStreamIterator emits correct SSE events for those
  new block types in streaming responses
- Normalize proxy aliases → canonical Anthropic model IDs before
  native passthrough so tools.0.model is never a proxy alias

Made-with: Cursor
2026-04-15 17:37:23 +05:30
Sameer Kankute
ee60f48a45
feat(advisor): add AdvisorInterceptionConfig type definition
Introduces a typed config class for advisor_interception_params used
under litellm_settings in proxy config.

Made-with: Cursor
2026-04-15 17:37:11 +05:30
Sameer Kankute
4f31a0cd6b
fix advisor interception mixed-call handling and call id propagation
Ensure mixed advisor/non-advisor tool-call batches are detected and skipped safely, and prevent follow-up executor calls from reusing the parent litellm_call_id.

Made-with: Cursor
2026-04-14 19:33:44 +05:30
Sameer Kankute
abf1510dec
Fix greptile review 2026-04-14 18:58:22 +05:30
Sameer Kankute
9316d63325
Add blog 2026-04-14 18:47:23 +05:30
Sameer Kankute
fdef44a58b
chore: update docs 2026-04-14 18:33:51 +05:30
Sameer Kankute
7f23230f90
Fix cost tracking 2026-04-14 18:33:31 +05:30
Sameer Kankute
dd3fd5a339
Add support for advisor tool for chat completion 2026-04-14 18:01:49 +05:30
Sameer Kankute
23278aeda0
Add test 2026-04-14 16:50:49 +05:30
Sameer Kankute
b8dadefe24
Fix cost calculation crash for advisor/passthrough responses 2026-04-14 14:31:38 +05:30
yuneng-jiang
e64d98f725
Merge pull request #25590 from BerriAI/litellm_add_model_e2e_tests
[Test] UI - Models: Add E2E tests for Add Model flow
2026-04-13 19:03:39 -07:00
Yuneng Jiang
9b74ff3ef7
remove unnecessary cleanup helper
The database is freshly seeded on every test run via seed.sql,
so per-test cleanup is not needed.
2026-04-13 17:29:49 -07:00
Yuneng Jiang
cce7163348
fix CI: replace data-testid selectors with text/role-based selectors
The data-testid attributes added to React components are not present
in the CI-built UI output. Switch to using getByRole and getByText
selectors which work with the rendered DOM regardless of build cache.
2026-04-13 17:29:49 -07:00
Yuneng Jiang
5e07c1cbc9
address greptile review feedback (greploop iteration 1)
Add cleanup helper to delete models created during tests, preventing
stale data accumulation across repeated test runs.
2026-04-13 17:29:49 -07:00
Yuneng Jiang
4f364a8138
[Test] UI - Models: Add E2E tests for Add Model flow
Add E2E tests covering:
- Test connection with bad credentials shows failure modal
- Adding a specific model and verifying it appears in All Models table
- Adding a wildcard route and verifying it appears in All Models table
- Verifying model dropdown shows provider-specific models (existing test updated)

Added data-testid attributes to UI components to support stable test selectors.

Tests verified passing 3/3 consecutive runs with zero flakiness.
2026-04-13 17:29:49 -07:00
yuneng-jiang
8427534f13
Merge pull request #25647 from BerriAI/litellm_yj_apr_11
Some checks are pending
CodeQL / Analyze (actions) (push) Waiting to run
CodeQL / Analyze (javascript-typescript) (push) Waiting to run
CodeQL / Analyze (python) (push) Waiting to run
CodSpeed Benchmarks / benchmarks (push) Waiting to run
Helm unit test / unit-test (push) Waiting to run
Read Version from pyproject.toml / read-version (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (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 (key-generation, tests/proxy_unit_tests/test_key_generate_prisma.py, 30, 0) (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
GitHub Actions Security Analysis / zizmor (push) Waiting to run
[Infra] Merge dev branch with main
2026-04-13 17:28:38 -07:00
yuneng-jiang
c25b4b2ce8
Merge pull request #25398 from BerriAI/litellm_team_settings_router
[Feature] UI - Teams: Allow Editing Router Settings After Team Creation
2026-04-13 17:27:15 -07:00
yuneng-jiang
a306092d47
Merge pull request #25463 from BerriAI/litellm_oss_staging_04_09_2026
Litellm oss staging 04 09 2026
2026-04-13 17:25:53 -07:00
ryan-crabbe-berri
87b6b5145f
Merge pull request #25658 from BerriAI/litellm_e2e-edit-team-model-test
test(e2e): add edit team model TPM/RPM limits test
2026-04-13 17:15:56 -07:00
Ryan Crabbe
152d6898ab
test(e2e): drop cleanup from edit team model test
Reviewer flagged that cleanup failures were silently swallowed and
suggested asserting `delete.ok()`. While thinking through the fix, the
actual question turned out to be "does the cleanup matter at all?" —
and the answer is no.

The e2e runner (`run_e2e.sh`) spins up a fresh postgres container per
invocation and tears it down at the end, so every local and CI run
starts with an empty DB. Playwright retries share the same DB but each
attempt creates a new model with a unique `Date.now()` name and only
queries its own model, so orphans from failed attempts never collide
with later attempts or other tests. Nothing else in the suite reads
the all-models table.

Keeping the cleanup would also turn every write test into an implicit
delete test, coupling responsibilities and inflating runtime — which
is probably why `teams.spec.ts` (create a team), `keys.spec.ts`
(update key limits), etc. all leave their entities in place. Matching
that convention, drop the try/finally block and the `createdModelId`
tracking. 12 lines removed, no behavior change.
2026-04-13 17:05:42 -07:00
ryan-crabbe-berri
c08fb82cae
Merge pull request #25657 from BerriAI/litellm_chore-e2e-tests
chore: remove deprecated tests/ui_e2e_tests/ suite
2026-04-13 16:51:22 -07:00
Ryan Crabbe
44614c43c6
test(e2e): add edit team model TPM/RPM limits test
Covers the full write-path flow for team-scoped models on the Models +
Endpoints page: create via /model/new, click the row to open the detail
view, click Edit Settings, change TPM/RPM, click Save Changes, assert
the new values render back. Cleans up via /model/delete in finally so
reruns stay deterministic.

Requires store_model_in_db: true in the fixture general_settings so the
proxy accepts /model/new and /model/delete. No existing test in the
dashboard e2e suite reads the all-models table or hits the model CRUD
endpoints, so enabling the flag has no cross-test impact.
2026-04-13 16:27:39 -07:00
Ryan Crabbe
004964f421
chore: remove deprecated tests/ui_e2e_tests/ suite
The suite was superseded by ui/litellm-dashboard/e2e_tests/ on 2026-04-08
and is no longer referenced by CircleCI, docs, or Makefile targets. Drop
the directory wholesale and remove the orphaned e2e:psql npm script that
pointed at its runner.
2026-04-13 15:40:34 -07:00
ishaan-berri
548225ef31
Merge pull request #25586 from BerriAI/litellm_ishaan_april11
Litellm ishaan april11
2026-04-13 14:55:50 -07:00
ryan-crabbe-berri
65d9fadf45
Merge pull request #25575 from BerriAI/litellm_feat-per-guardrail-opt-out-for-global-guardrails
feat(guardrails): per-team opt-out for specific global guardrails
2026-04-13 13:31:23 -07:00
ishaan-berri
6e6ed4fa66
Merge pull request #25452 from mubashir1osmani/readme
docs: week 2 checklist
2026-04-13 13:23:48 -07:00
Ryan Crabbe
2d14e4a4ed
test(ui/team): fix guardrails overview test for new component
Updates the expected header text to "Guardrails Settings" to match
GuardrailSettingsView's rendering, and moves the mock guardrails
from team_info.guardrails (legacy top-level path that nothing
reads) to team_info.metadata.guardrails where the component
actually looks. Also tightens the assertion to verify the
individual guardrail names appear, not just the section header.
2026-04-13 12:20:30 -07:00
Yuneng Jiang
df75e79615
raise ValueError on os.environ/ references in request-supplied callback params
Previously these were silently dropped with a verbose warning, which
could break observability integrations without surfacing a clear error.
Now raises ValueError with remediation steps (configure server-side
or pass the resolved value) so callers get immediate, actionable feedback.
2026-04-13 12:00:25 -07:00
Ryan Crabbe
842523a918
chore(ui): use antd in GuardrailSettingsView and document the rule
Converts GuardrailSettingsView from @tremor/react (Badge, Text) to
antd (Tag, plain spans) as part of the Tremor migration. Also
captures the "no new Tremor imports" rule in CLAUDE.md and expands
the existing note in AGENTS.md with the specific antd equivalents
and the yellow→gold gotcha.
2026-04-13 11:49:39 -07:00
Ryan Crabbe
84d7816bc9
refactor(ui/team): extract GuardrailSettingsView and reuse across team views
Pulls the Global / Team-specific subsection rendering out of
TeamInfo.tsx into a shared GuardrailSettingsView component with
card and inline variants, used on both the team Overview tab
(inside the existing Tremor Card) and the Team Settings tab read
view. The Global subsection header now carries a GlobalOutlined
icon, and since the icon is load-bearing the edit-form chip
coloring is simplified to a single blue instead of green/blue.
2026-04-13 11:38:23 -07:00
yuneng-jiang
26c35aa8eb
Merge pull request #25594 from BerriAI/litellm_spend_logs_user_scoping
[Fix] /spend/logs: align filter handling with user scoping
2026-04-13 11:31:27 -07:00
Ryan Crabbe
1dcccfc1d1
feat(ui/team): show guardrails in team settings read view
The Team Settings tab's read view listed every team field except
guardrails. Adds a Guardrails entry after Status with the same
Global / Team-specific subsections used on the Overview tab, so
the kill switch state and per-section membership are visible
without entering edit mode.
2026-04-13 11:08:39 -07:00
Ryan Crabbe
6ae693b85c
refactor(ui/team): split team read view guardrails into Global and Team-specific sections
Replaces the flat guardrails list with two subsections under the
Guardrails card, so the global vs. team-specific distinction is
carried by the section headers instead of per-badge markers. The
kill-switch state now renders in place of the Global subsection as
"Bypassed for this team", and the separate "Disable Global
Guardrails" field with its confusing "Disabled - Global guardrails
active" badge is removed.
2026-04-13 10:57:10 -07:00
Ryan Crabbe
1f57292363
fix(ui/team): add GlobalOutlined icon to global guardrail markers
Addresses a11y feedback — global vs. non-global guardrails were
distinguished only by color (green vs. blue). Adds GlobalOutlined
next to global guardrails in (1) the selected-chip tagRender, (2)
the dropdown OptGroup label, and (3) the team info read view badge.
2026-04-13 10:55:09 -07:00
Krrish Dholakia
d319cd8cc6
fix: blog dark mode - text invisible on dark background (#25620)
The blog CSS selectors for dark mode used descendant selectors like
[data-theme='dark'] .blog-wrapper which never matched because both
data-theme and .blog-wrapper are applied to the same <html> element
by Docusaurus. Fixed by using compound selectors (no space):
[data-theme='dark'].blog-wrapper.

Also added missing dark-mode overrides for:
- pre/code blocks in blog posts
- link colors in blog posts
- marquee items, separators, and labels on blog list page
- pagination links on blog list page
- meta text and author separators on blog list page

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Krrish Dholakia <krrish-berri-2@users.noreply.github.com>
2026-04-13 09:08:57 -07:00
michelligabriele
0eae9f101e
fix(auth): gate post-custom-auth DB lookups behind opt-in flag (#25634) 2026-04-13 08:02:16 -07:00
Sameer Kankute
5e80e075c7
Merge pull request #25397 from BerriAI/litellm_oss_staging_04_08_2026
Litellm oss staging 04 08 2026
2026-04-13 09:12:40 +05:30
Sameer Kankute
fa605d85c0
Merge pull request #25616 from BerriAI/main
merge main
2026-04-13 08:43:43 +05:30
Yuneng Jiang
d3331f855b
refactor: rename filter var to satisfy mypy 2026-04-11 23:40:59 -07:00
Yuneng Jiang
4617d230f8
fix: hash sk- api_key in /spend/logs date-range path and add filter tests
Brings the date-range branch in line with the non-date-range branch which
already hashes sk- prefixed tokens before querying. Adds coverage for
filter-combination behavior in view_spend_logs.
2026-04-11 23:33:15 -07:00
Yuneng Jiang
f5ce6cdd3b
fix: align /spend/logs filter handling with user scoping 2026-04-11 23:22:05 -07:00
yuneng-jiang
fee4e71905
Merge pull request #25592 from BerriAI/litellm_tightenEnvReferenceHandling
[Fix] tighten handling of environment references in request parameters
2026-04-11 22:47:39 -07:00
Yuneng Jiang
41849a540d
document new env var and fix type hint
- Add LITELLM_OIDC_ALLOWED_CREDENTIAL_DIRS to the environment variables
  reference so the documentation test passes.
- Annotate the values variable in _reject_os_environ_references so it
  accepts both dict.values() and list iterables.
2026-04-11 22:17:32 -07:00
Yuneng Jiang
6baee0dfcb
address review feedback
- Log a warning when dropping callback params that carry os.environ/
  references so operators notice the misconfiguration.
- Require absolute paths in oidc/file/ and correct the documented
  example to use the leading-slash form.
- Drop the unused return value from _reject_os_environ_references.
2026-04-11 21:52:39 -07:00