Commit Graph
36424 Commits
Author SHA1 Message Date
Sameer Kankute 1284e4ebe5 Fix cicd fialing tests 2026-03-19 16:32:35 +05:30
Sameer Kankute b9564834e6 Fix mypy errors 2026-03-19 16:18:06 +05:30
Sameer Kankute 067dab42e6 refactor: reduce statement count in langsmith and anthropic methods
- Extract helper methods in langsmith._prepare_log_data to reduce from 51 to <50 statements
- Extract helper methods in anthropic.transform_parsed_response to reduce from 57 to <50 statements
- Fixes PLR0915 linter errors
- All existing tests pass (10 langsmith tests, 126 anthropic tests)

Made-with: Cursor
2026-03-19 16:16:23 +05:30
Sameer Kankute 532e0d13df feat(proxy): use AZURE_DEFAULT_API_VERSION for proxy --api_version default
Aligns proxy default with litellm.AZURE_DEFAULT_API_VERSION (2025-02-01-preview)
so Azure response_format + json_schema works without tools fallback.

Made-with: Cursor
2026-03-19 15:57:03 +05:30
Sameer KankuteandGitHub ecfcf241c6 Merge pull request #24119 from BerriAI/main
merge main
2026-03-19 15:53:32 +05:30
Sameer KankuteandGitHub e2e4f9ed33 Merge branch 'main' into litellm_oss_staging_03_17_2026 2026-03-19 15:53:06 +05:30
Sameer KankuteandClaude Haiku 4.5 a14122c28e docs: add per-model-group affinity configuration docs
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 15:50:43 +05:30
Sameer KankuteandClaude Haiku 4.5 6af74f6594 fix(router): restore debug log for missing deployment_model_name; warn on unknown affinity flags
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 15:39:35 +05:30
Sameer KankuteandClaude Haiku 4.5 528daa8cf4 feat(router): add per-model-group deployment affinity configuration
Enable deployment_affinity, responses_api_deployment_check, and session_affinity to be configured per model group via router_settings.model_group_affinity_config, falling back to global settings for unconfigured groups.

- Add model_group_affinity_config parameter to Router and DeploymentAffinityCheck
- Add _get_effective_flags helper to resolve flags per model group
- Update async_filter_deployments and async_pre_call_deployment_hook to use per-group config
- Add 4 comprehensive tests covering per-group config, fallback, and override scenarios

This allows fine-grained control of affinity behavior across model groups, e.g., enabling stickiness only for cross-provider deployments while leaving other groups free to load-balance.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-19 14:44:01 +05:30
Sameer KankuteandClaude Sonnet 4.6 66f97a00a4 fix(test): rewrite polling pre-call guard test to call responses_api() directly
Previously the test called common_processing_pre_call_logic in isolation,
making generate_polling_id.assert_not_called() vacuously true. Now the test
calls responses_api() end-to-end so it actually verifies that a rate-limited
request never receives a polling ID.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 14:30:29 +05:30
Sameer Kankute c12717f494 fix: address Greptile review comments
- Guard logging_obj for None when skip_pre_call_logic=True: raise ValueError
  if litellm_logging_obj not in data, preventing AttributeError downstream
- Add model=None to common_processing_pre_call_logic call in endpoints.py
  to match style of other call sites
- Add test verifying rate-limited request never receives polling ID
2026-03-19 14:10:58 +05:30
Sameer Kankute 4dc645fc33 feat(polling): check rate limits before creating polling ID
Move pre-call checks (rate limits, guardrails, budget) to run BEFORE
polling ID creation in the background streaming flow. This prevents the
edge case where a rate-limited request receives a polling ID that
immediately fails.

Changes:
- Add skip_pre_call_logic parameter to base_process_llm_request to allow
  skipping pre-call checks (avoiding double-counting of RPM/parallel requests)
- Run common_processing_pre_call_logic before generating polling ID in the
  responses API endpoint. If rate limits/guardrails fail, return error
  immediately without creating a polling ID
- Background streaming task passes skip_pre_call_logic=True to avoid re-running
  pre-call checks that were already done before polling ID creation
- Add tests verifying skip_pre_call_logic parameter works correctly

Fixes the edge case where polling_via_cache would return a polling ID
for a request that immediately fails due to rate limiting.
2026-03-19 13:59:59 +05:30
superpoussin22andGitHub e19a717b53 Add IF NOT EXISTS to index creation in migration 2026-03-19 09:22:10 +01:00
chengyongruandGitHub b20c448188 fix(openai): handle missing 'id' field in streaming chunks for MiniMax (#23931)
- Change chunk["id"] to chunk.get("id") for compatibility with MiniMax
- ModelResponseStream auto-generates id when None is passed
- Add regression test test_chunk_parser_without_id_field
2026-03-19 13:04:47 +05:30
joereynaandClaude Sonnet 4.6 d5ef754950 docs(release-notes): align v1.82.3 notes with release notes guide
- Add MCP Gateway section (moved from Management per guide rule §11)
- Rename Spend Tracking → Spend Tracking, Budgets and Rate Limiting
- Fix Hashicorp Vault doc link: docs/secret → docs/secret_managers
- Fix LLM API section: #### Bug Fixes → #### Bugs (matches guide)
- Add Documentation Updates section (required by guide §11)
- Update Diff Summary: correct section names, add MCP Gateway and
  Documentation Updates counts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 23:35:40 -07:00
joereynaandClaude Sonnet 4.6 61df7471ba docs(release-notes): complete v1.82.3 changelog with 30+ missing features
Full audit of 371 PRs in v1.82.0-stable...v1.82.3-stable range.
Adds previously undocumented user-facing changes:

- Key Highlights: Hashicorp Vault, Responses WebSocket, Org Admin RBAC,
  guardrail mode defaults
- New Providers: Google Search API, Bedrock Mantle (7 total, was 5)
- LLM API: Anthropic Files API, Mistral Voxtral transcription, WebRTC,
  Responses WebSocket, litellm.acount_tokens() public API, OpenRouter
  image edit, Vertex AI VIDEO token tracking, input_fidelity image edit,
  model cost aliases, per-request json schema validation, 15+ bug fixes
- Management: RBAC expansion for Org Admins, Vector Store CRUD, MCP
  token auth + team scoping, BYOK key precedence, virtual key spend reset,
  batch expiry for teams, Admin Viewer audit log access, 12+ bug fixes
- Guardrails: mode default list, tag-based modes, presidio fix, OTEL fix
- Secret Managers: Hashicorp Vault (was "no changes")
- Spend Tracking: new section — budget-linked reset fix, flex pricing,
  spend log cleanup, WebSearch dedup fix
- Performance: 4 additional reliability fixes
- Diff summary counts updated to reflect actual scope

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 23:30:42 -07:00
Ephrim StanleyandClaude 477c54184b perf: avoid unconditional router lookups in success handler
Replace bare _get_deployment_default_tpm/rpm_limit calls in the
async_log_success_event condition with get_key_model_tpm/rpm_limit
(model_name=model_group). The higher-level getters short-circuit on
key/team metadata hits before ever reaching the router, so requests
that don't use deployment defaults incur no extra router lookup. Remove
the now-unused bare helper imports.

Also fix invalid `int = None` type hints in test helper signatures
to `Optional[int] = None`.

Co-Authored-By: Claude (claude-sonnet-4-6) <noreply@anthropic.com>
2026-03-19 02:07:50 -04:00
Ephrim StanleyandClaude 48cb4a8343 fix: update success-event handler to track tokens for deployment-default limits
async_log_success_event only updated the per-model cache counter when
model_rpm_limit / model_tpm_limit were present in key metadata or
model_max_budget was set. For the new deployment-default path
(default_api_key_tpm_limit / default_api_key_rpm_limit), none of those
conditions held, so current_tpm stayed at zero and tpm enforcement was
never applied across multiple requests.

Extend the guard condition to also trigger when the model group has a
deployment-default tpm or rpm limit, and import the two helpers at
module level.

Co-Authored-By: Claude (claude-sonnet-4-6) <noreply@anthropic.com>
2026-03-19 01:59:41 -04:00
joereyna dab8721ba3 chore: apply black formatting to fix lint CI 2026-03-18 22:57:38 -07:00
Ephrim StanleyandClaude b90f520748 perf: eliminate redundant router lookups in v1 parallel request limiter
Compute get_key_model_tpm/rpm_limit once before the guard condition
instead of calling each function twice (once to check non-None, once to
retrieve). Removes 2 extra llm_router.get_model_list() calls per request
when deployment defaults are active.

Co-Authored-By: Claude (claude-sonnet-4-6) <noreply@anthropic.com>
2026-03-19 01:57:09 -04:00
Ephrim StanleyandClaude 36dc893770 fix: address review feedback on default tpm/rpm limits
- Use min() across all matching deployments instead of first-wins when
  resolving default_api_key_tpm/rpm_limit for a model group, so
  load-balanced setups with different per-deployment limits always apply
  the most conservative value
- Replace the global SensitiveDataMasker non_sensitive_overrides change
  with a targeted excluded_keys set at the remove_sensitive_info_from_deployment
  call site, avoiding unintended suppression of other fields
- Update the v1 parallel request limiter to pass model_name to
  get_key_model_tpm/rpm_limit so deployment defaults apply there too
- Add 4 tests covering multi-deployment min semantics

Co-Authored-By: Claude (claude-sonnet-4-6) <noreply@anthropic.com>
2026-03-19 01:43:27 -04:00
joereynaandClaude Sonnet 4.6 bba3b1fe4c docs(release-notes): add missing Helicone and Langfuse entries to v1.82.3 changelog
Helicone (PRs #19288, #22603) and Langfuse (#22390) were present in the
v1.82.0-stable...v1.82.3-stable diff but omitted from the AI Integrations
logging section. Also updates the AI Integrations diff summary count from 2 to 4.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 22:42:25 -07:00
Ephrim StanleyandClaude cac685014f feat: add proxy-wide default tpm/rpm limits per deployment
Adds `default_api_key_tpm_limit` and `default_api_key_rpm_limit` to
`GenericLiteLLMParams` so operators can set per-deployment rate limit
defaults in config.yaml. When a key has no model-specific tpm/rpm limit
configured, the proxy falls back to these deployment defaults (Case 2 in
spec). Key-level limits always take priority (Case 1).

- Extends `get_key_model_tpm_limit` / `get_key_model_rpm_limit` with a
  `model_name` param and a priority-4 deployment-default fallback
- Passes `model_name=requested_model` in the parallel request limiter so
  the fallback is triggered at enforcement time
- Adds `"limit"` to `SensitiveDataMasker` non-sensitive overrides so
  `*_limit` fields are not masked in `/model/info` responses
- Adds 17 unit tests covering both spec cases and the `/model/info` path

Co-Authored-By: Claude (claude-sonnet-4-6) <noreply@anthropic.com>
2026-03-19 01:30:18 -04:00
Krish DholakiaandGitHub e5baa2232f Merge pull request #24082 from joereyna/fix/poetry-lock-content-hash 2026-03-18 22:04:08 -07:00
Krish DholakiaandGitHub 547a73120e Merge pull request #24083 from BerriAI/cursor/missing-guardrails-docs-143b
docs: add Contributing to Guardrails section to Guardrail Providers sidebar
2026-03-18 21:54:24 -07:00
Cursor AgentandKrish Dholakia df38fbcc97 docs: add Contributing to Guardrails section to Guardrail Providers sidebar
- Add 'Contributing to Guardrails' category with links to:
  - Generic Guardrail API (integrate without PR)
  - Adding a New Guardrail Integration tutorial
  - Adding Guardrail Support to Endpoints

- Add 'Team Bring-Your-Own Guardrails' link for team BYOG workflow

These docs existed but were only accessible from the 'LiteLLM AI Gateway'
sidebar. Now they're also accessible when browsing the 'Guardrail Providers'
section.

Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
2026-03-19 04:47:30 +00:00
Krish DholakiaandGitHub 49443cc08c Merge pull request #24080 from BerriAI/litellm_dev_03_18_2026_p1
fix: fix logging for response incomplete streaming + custom pricing on /v1/messages and /v1/responses
2026-03-18 21:45:17 -07:00
Krish DholakiaandGitHub 11f0f061bc Merge pull request #18120 from hytromo/improve-llm-repeated-message-detection-performance
Fix model repetition detection performance
2026-03-18 21:43:03 -07:00
Krrish Dholakia 08f0cbc2e9 fix: address greptile feedback 2026-03-18 21:36:39 -07:00
Krish DholakiaandGitHub 5c93c107d9 Merge pull request #24043 from themavik/fix/24001-langsmith-usage-metadata
fix(langsmith): populate usage_metadata in outputs for Cost column
2026-03-18 21:30:23 -07:00
Krish DholakiaandGitHub 379ed72336 Merge pull request #24050 from alilxxey/fix/proxy-only-failure-call-type
Fix/proxy only failure call type
2026-03-18 21:29:14 -07:00
Krish DholakiaandGitHub 3a878b8b6b Merge branch 'litellm_oss_staging_03_18_2026' into fix/proxy-only-failure-call-type 2026-03-18 21:29:07 -07:00
Sameer Kankute ab1744f9fe fix(proxy): scope wildcard cleanup to subpath entries and restore registry in test
- Only remove wildcard path from openai_routes when the route entry has
  type="subpath", avoiding accidental removal when two endpoints share
  the same base path but differ in include_subpath
- Clean up _registered_pass_through_routes in the test finally block to
  prevent stale entries from polluting subsequent tests on failure
2026-03-19 09:53:22 +05:30
Krish DholakiaandGitHub 6ef440c2f5 Merge pull request #24044 from emerzon/fix-generic-api-model-group-logging
Preserve router model_group in generic API logs
2026-03-18 21:23:22 -07:00
Krish DholakiaandGitHub 8b4ed363e4 Merge pull request #24070 from xr843/fix/24026-thinking-blocks-null
Fix thinking blocks dropped when thinking field is null
2026-03-18 21:22:37 -07:00
yuneng-jiangandGitHub e8e4d9fa0f Merge pull request #24069 from BerriAI/litellm_leftnav_external_icon
[Feature] UI - Leftnav: Add external link icon to Learning Resources
2026-03-18 21:22:33 -07:00
joereyna f7803d2d6d chore: regenerate poetry.lock to unblock CI (pyproject.toml content hash drift) 2026-03-18 21:21:07 -07:00
Sameer Kankute 97b7358791 fix(proxy): dedup openai_routes on reload and clean up on endpoint removal
- Add dedup guard for base path registration (prevents unbounded list
  growth on config reload)
- Clean up base path and wildcard path from openai_routes when an
  endpoint is removed via remove_endpoint_routes
- Rewrite test to exercise initialize_pass_through_endpoints directly,
  covering registration, dedup on reload, and cleanup on removal
2026-03-19 09:44:30 +05:30
Sameer Kankute 4829de6102 fix(proxy): allow non-admin users to access pass-through subpath routes with auth
When a pass-through endpoint has both auth=true and include_subpath=true,
non-admin users got 401 errors on subpath requests because only the base
path was registered in openai_routes. Now the wildcard path is also
registered so the auth check recognizes subpath requests as LLM API routes.

Also fixes pre-existing pyright error where logging_obj was possibly
unbound in the except block.
2026-03-19 09:28:55 +05:30
Krrish Dholakia bd0c3bfdc4 fix: fix logging for response incomplete streaming 2026-03-18 20:58:41 -07:00
Krrish Dholakia 0ecced9780 fix: fix responses cost calc 2026-03-18 19:52:59 -07:00
Chesars 60c234270a feat(bedrock): support cache_control_injection_points for tool_config location
Add support for {"location": "tool_config"} in cache_control_injection_points,
which appends a cachePoint block to the Bedrock Converse toolConfig.tools array.
This enables prompt caching of tool definitions on Bedrock Claude models.

Also update the cache control hook to pass through non-message injection points
to provider-specific handling instead of silently dropping them.

Fixes #21969
2026-03-18 23:07:56 -03:00
Chesars 286b8d1460 fix: also populate required for all properties in strict mode
OpenAI strict mode requires both additionalProperties:false AND all
property keys in required. Without required, OpenAI rejects the schema
even with additionalProperties:false set.
2026-03-18 23:03:20 -03:00
Chesars 6f4b4d3c42 feat(gemini): support context circulation for server-side tool combination
Enables Gemini 3+ models to combine built-in tools (Google Search, etc.)
with custom functions via `include_server_side_tool_invocations=True`.
Server-side invocations are surfaced in provider_specific_fields and
automatically re-injected on subsequent turns for multi-turn coherence.

Closes #24047
2026-03-18 22:33:01 -03:00
Chesars 4bd7bdcf43 fix: add additionalProperties: false for OpenAI strict mode in Anthropic adapter
When translating Anthropic output_format to OpenAI response_format,
the adapter sets strict: true but didn't add additionalProperties: false,
which OpenAI requires at every object nesting level. This caused
BadRequestError for structured output requests routed to OpenAI models.

Fixes #20997
2026-03-18 22:32:23 -03:00
xianrenandClaude Opus 4.6 8969a3d176 Fixed thinking blocks dropped when thinking field is null (#24026)
The check `content.get("thinking", None) is not None` incorrectly
drops thinking blocks when the `thinking` key is explicitly null or
absent. Changed to `content.get("type") == "thinking"` to match
the fix already applied in the experimental pass-through path (PR #15501).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 09:10:21 +08:00
Cesar GarciaandGitHub ef3b05b8c7 Merge pull request #23784 from andrzej-pomirski-yohana/fix/surface-anthropic-tool-results-responses-api
fix: surface Anthropic code execution results as code_interpreter_call in Responses API
2026-03-18 22:07:51 -03:00
Chesars 4770b657e1 refactor: extract duplicated stdout/stderr → logs logic to shared helper 2026-03-18 22:05:27 -03:00
yuneng-jiangandClaude Opus 4.6 d984b293de [Feature] UI - Leftnav: Add external link icon to Learning Resources
Add ExportOutlined icon next to nav items that link to external pages,
making it clear to users when a link opens in a new tab.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 17:56:25 -07:00
yuneng-jiangandGitHub 71cdd91668 Merge pull request #24063 from BerriAI/litellm_fix_key_update_404
[Fix] Key Update Endpoint Returns 401 Instead of 404 for Nonexistent Keys
2026-03-18 17:17:36 -07:00