Commit graph

35825 commits

Author SHA1 Message Date
Sameer Kankute
09919a81b2
Merge pull request #23234 from BerriAI/revert-23224-cursor/get-optional-params-behavior-ed4a
Revert "Get optional params behavior"
2026-03-10 10:22:10 +05:30
Sameer Kankute
504e66ccd4
Revert "fix: forward recognized OpenAI params from kwargs in completion() (#2…"
This reverts commit dd6f0d6c55.
2026-03-10 10:22:00 +05:30
Carlo Alberto Ferraris
9d2b0117d9
docs: add DB performance guidelines to CLAUDE.md
Extend the "Proxy database access" section with guidelines to prevent
common DB performance issues, tailored to actual Prisma usage patterns
in the litellm codebase: N+1 queries, client-side processing, batching
writes, bounding result sets, select on wide tables, index coverage,
and schema file sync.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 13:40:13 +09:00
Sameer Kankute
32e7b22f05
Merge pull request #23233 from BerriAI/revert-23231-litellm_cicd_100326
Revert "Fix logging tests"
2026-03-10 10:00:04 +05:30
Sameer Kankute
3f30f6a49c
Revert "Fix logging tests" 2026-03-10 09:59:53 +05:30
Sameer Kankute
9402a8b57e
Merge pull request #23231 from BerriAI/litellm_cicd_100326
Fix logging tests
2026-03-10 09:59:00 +05:30
Sameer Kankute
7542845e8d Revert "fix: strip empty text content blocks in /v1/messages endpoint (#23097)"
This reverts commit 2c738cc939.
2026-03-10 09:56:39 +05:30
Krish Dholakia
2cb47727b6 fix: forward recognized OpenAI params from kwargs in completion() (#23224)
Any param in DEFAULT_CHAT_COMPLETION_PARAM_VALUES that arrives via
completion(**kwargs) is now automatically forwarded to
get_optional_params(), even if it's not a named parameter of
completion().

Previously, get_non_default_completion_params() excluded params in
OPENAI_CHAT_COMPLETION_PARAMS (assuming they'd be forwarded via the
named-param path), while optional_param_args only contained explicitly
named params. Params like 'store' that were in the known-params list
but not named params fell through both paths and were silently dropped.

The fix adds a 7-line loop after building optional_param_args that
forwards any kwargs present in DEFAULT_CHAT_COMPLETION_PARAM_VALUES.
This means new OpenAI params only need to be added to the constants
dict — no boilerplate changes to 3+ function signatures required.

Fixes #23087

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-03-10 09:56:39 +05:30
Sameer Kankute
1ec9d984a0
Merge pull request #23232 from BerriAI/revert-23097-fix/sanitize-empty-text-blocks-v1-messages
Revert "fix: strip empty text content blocks in /v1/messages endpoint"
2026-03-10 09:53:49 +05:30
Sameer Kankute
c1b860b3c1
Revert "fix: strip empty text content blocks in /v1/messages endpoint (#23097)"
This reverts commit 2c738cc939.
2026-03-10 09:53:19 +05:30
Sameer Kankute
56be0a651f fix: add charity_engine to provider_endpoints_support.json
Made-with: Cursor
2026-03-10 09:50:37 +05:30
Sameer Kankute
325df8d62a Fix logging tests 2026-03-10 09:45:28 +05:30
Yong woo Song
6bb9f9ceb6 chore: fix 2026-03-10 04:05:59 +00:00
jymmi
33d4b93bee
fix(sagemaker): Add role assumption support for embedding endpoint (#20435)
The SageMaker embedding handler was not using _load_credentials(),
which meant aws_role_name and aws_session_name parameters were
ignored. This prevented cross-account role assumption for embeddings
while it worked for completions.

Changes:
- Replace direct boto3 client creation with _load_credentials() call
- Create boto3.Session with assumed credentials
- Add comprehensive unit tests for role assumption

This aligns the embedding handler behavior with the completion handler,
which already supports role assumption via the BaseAWSLLM.get_credentials()
method.

Fixes cross-account SageMaker embedding access where users need to
assume a role in another account to invoke endpoints.
2026-03-09 20:58:14 -07:00
Krish Dholakia
dd6f0d6c55
fix: forward recognized OpenAI params from kwargs in completion() (#23224)
Any param in DEFAULT_CHAT_COMPLETION_PARAM_VALUES that arrives via
completion(**kwargs) is now automatically forwarded to
get_optional_params(), even if it's not a named parameter of
completion().

Previously, get_non_default_completion_params() excluded params in
OPENAI_CHAT_COMPLETION_PARAMS (assuming they'd be forwarded via the
named-param path), while optional_param_args only contained explicitly
named params. Params like 'store' that were in the known-params list
but not named params fell through both paths and were silently dropped.

The fix adds a 7-line loop after building optional_param_args that
forwards any kwargs present in DEFAULT_CHAT_COMPLETION_PARAM_VALUES.
This means new OpenAI params only need to be added to the constants
dict — no boilerplate changes to 3+ function signatures required.

Fixes #23087

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-03-09 20:56:27 -07:00
mubashir1osmani
23cf360be7 fix: explicit type conversion for prompt caching 2026-03-09 23:53:55 -04:00
tristanolive
30b82c3a0c
feat(charity_engine): add Charity Engine provider (#23223)
* feat(charity_engine): add Charity Engine provider

Charity Engine is a crowdsourced distributed computing platform that
donates processing power to charitable causes. Its inference API
provides OpenAI-compatible chat, completions, and embeddings endpoints.

* test(charity_engine): add provider config and resolution tests

Verify JSONProviderRegistry config, provider list membership,
model routing for charity_engine/<model>, and Router compatibility.

* feat(charity_engine): add Charity Engine to LlmProviders enum

Enables provider_list membership and LlmProviders.CHARITY_ENGINE
resolution required by the provider and test suite.

* fix(charity_engine): remove api_base_env to fix non-deterministic test

The CHARITY_ENGINE_API_BASE env var could override the base_url in CI,
causing test_charity_engine_provider_resolution to fail intermittently.

* fix(charity_engine): remove trailing slash from base_url
2026-03-09 20:46:43 -07:00
Maxwell Calkin
2c738cc939
fix: strip empty text content blocks in /v1/messages endpoint (#23097)
Claude's API returns assistant messages with empty text blocks
({"type": "text", "text": ""}) alongside tool_use blocks during
multi-turn tool-use conversations. These blocks are rejected when
sent back to the API with "text content blocks must be non-empty".

Sanitization already exists for other code paths (/v1/chat/completions
for both Anthropic and Bedrock), but NOT for the /v1/messages native
path. This adds the same treatment by stripping empty text blocks
from messages in async_anthropic_messages_handler before they are
forwarded to the provider.

Fixes #22930
2026-03-09 19:51:25 -07:00
zxshen
9314963697
fix(fireworks): strip duplicate /v1 from models endpoint URL (#23113)
_get_openai_compatible_provider_info already returns an api_base
ending in /v1, but get_models prepended another /v1, producing
.../inference/v1/v1/accounts/... which 404s.

Strip the trailing /v1 from api_base before re-adding it so that
both the default and any user-supplied base work correctly.

Add parametrized tests covering the default URL, trailing-slash,
custom base with /v1, and custom base without /v1.

Fixes #23106
2026-03-09 19:49:58 -07:00
JiangNan
3ce37e6c35
fix: use correct list length when averaging TTFT latency for streaming requests (#23100)
In _get_available_deployments, when streaming mode is active the code
sums time-to-first-token values from item_ttft_latency but divides by
len(item_latency) instead of len(item_ttft_latency). These lists can
have different lengths, producing an incorrect average that skews
lowest-latency routing decisions for streaming requests.

Signed-off-by: JiangNan <1394485448@qq.com>
2026-03-09 19:49:31 -07:00
Krish Dholakia
992510154c
Merge branch 'main' into litellm_oss_staging_02_18_2026 2026-03-09 19:48:46 -07:00
JiangNan
0d3735f9c0
fix: handle month overflow in duration_in_seconds for multi-month durations (#23099)
When value > 1 (e.g., "2mo") and current_month + value > 12,
target_month exceeds valid range (1-12), causing ValueError in
datetime constructor. For example, calling duration_in_seconds("2mo")
in November produces target_month=13.

Use modular arithmetic to correctly wrap months and increment year.

Signed-off-by: JiangNan <1394485448@qq.com>
2026-03-09 19:46:26 -07:00
Marty Sullivan
f44e67b0f1
2026-03-09-azure-updates (#23159)
* add new azure gpt models

* add versionless azure/gpt-5.4 models

* Undated azure/gpt-5.4 alias missing supports_service_tier

* indicate service tier support for azure/gpt-5.3-chat

* fix priority tier pricing for new azure/gpt models
2026-03-09 19:43:53 -07:00
Krish Dholakia
9500fc18d1
Fix TypeError: LiteLLM_Params.__init__() got multiple values for argument 'self' (#23220)
The bug occurred when user data inadvertently contained reserved Python
keywords like 'self', 'params', or '__class__' as keys. When such a dict
was unpacked via **kwargs to LiteLLM_Params() or GenericLiteLLMParams(),
Python raised TypeError because 'self' was passed both implicitly and
as a keyword argument.

The fix:
- Add a Pydantic model_validator(mode='before') to GenericLiteLLMParams
  that filters out reserved keys ('self', 'params', '__class__') before
  validation
- Move the max_retries str-to-int conversion into the same validator
- Remove the custom __init__ methods from both GenericLiteLLMParams and
  LiteLLM_Params, since the validator now handles the preprocessing
- Clean up unused VERTEX_CREDENTIALS_TYPES import

This fix applies to all classes that inherit from GenericLiteLLMParams,
including LiteLLM_Params and updateLiteLLMParams.

Added comprehensive tests in tests/test_litellm/test_litellm_params_reserved_keys.py

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-03-09 19:33:52 -07:00
yuneng-jiang
0e2aa7a5b2
Merge pull request #23213 from BerriAI/litellm_fix_flaky_audio_stream_test
[Fix] Flaky test_stream_chunk_builder_openai_audio_output_usage
2026-03-09 17:32:17 -07:00
Ryan Crabbe
976a2afede Migrate user management buttons from Tremor to Ant Design
Replace Tremor Button components with antd Button in the user
management flow (Invite User, Bulk Invite Users, Select Users,
Bulk Edit, and onboarding modal copy link button).
2026-03-09 17:20:48 -07:00
Harshit28j
3127d79da8 feat: add strategy to deployment for helmchart 2026-03-10 05:49:46 +05:30
yuneng-jiang
c1d042c2a3 Fix flaky test_stream_chunk_builder_openai_audio_output_usage
The test calls OpenAI's gpt-4o-audio-preview model which sometimes
doesn't return usage data in the streaming response. Fixed by:
- Adding @pytest.mark.flaky(retries=5, delay=2) for retry handling
- Fixing usage_obj loop to check chunk.usage is not None
- Skipping gracefully when OpenAI doesn't return usage data

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 17:18:00 -07:00
yuneng-jiang
6fe82d3886
Merge pull request #23211 from BerriAI/litellm_/sharp-keller
[Fix] Skills API test failing with duplicate skill name 500
2026-03-09 17:13:29 -07:00
yuneng-jiang
af8f91ef66 [Fix] Use unique skill names in Skills API test to avoid duplicate-name 500s
The test_create_skill test was consistently failing in CI with a 500 from
Anthropic because the SKILL.md frontmatter always used the same hardcoded
name (test-skill-litellm). Since test_delete_skill is permanently skipped,
skills accumulate in the CI account, and re-creating with a duplicate name
triggers an Internal Server Error on Anthropic's side.

Fix: pass a timestamp-based unique_suffix to create_skill_zip so each run
produces a distinct skill name in the zip's SKILL.md frontmatter.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 17:09:15 -07:00
yuneng-jiang
4c3f873bde
Merge pull request #23198 from BerriAI/litellm_fix_nova_pro_max_tokens
[Fix] Claude Agent SDK E2E Test Nova Pro max_tokens Limit
2026-03-09 15:54:00 -07:00
yuneng-jiang
4c5659ff30
Merge pull request #23199 from BerriAI/doc_per_model_input_tokenc_check
[doc improvement] input token check
2026-03-09 15:53:15 -07:00
yuneng-jiang
dda0146a66
Merge pull request #23197 from BerriAI/litellm_fix_flaky_watsonx_prompt_test
[Fix] Flaky test_watsonx_gpt_oss_prompt_transformation
2026-03-09 15:52:02 -07:00
Chesars
2ea2660ba5 feat(images): support input_fidelity parameter for image edit API
Add input_fidelity parameter ("high"/"low") to the image edit pipeline,
allowing users to control how much effort the model exerts to match
input image style and features. Fixes #22813.
2026-03-09 19:51:31 -03:00
mubashir1osmani
7ffaa6f74e fix(tag-usage): remove broken compute_tag_metadata_totals causing cost panel to show 0
The tag daily activity endpoint used compute_tag_metadata_totals which
deduplicates by request_id, but LiteLLM_DailyTagSpend stores aggregated
daily records where request_id is either NULL or stale. This caused all
metadata totals (total_spend, total_requests, etc.) to be 0 in the UI
cost panel. Now uses the same standard totals as every other entity type.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 18:48:27 -04:00
yuneng-jiang
d719c8a53c
Merge branch 'main' into litellm_fix_nova_pro_max_tokens 2026-03-09 15:47:53 -07:00
yuneng-jiang
2a836c7103 Fix Claude Agent SDK E2E test for Nova Pro max_tokens limit
The Claude Agent SDK sends max_tokens=32000 for unrecognized model names
(like "bedrock-nova-pro"), which exceeds Nova Pro's 10,000 limit. Enable
modify_params in the test proxy config so LiteLLM clamps max_tokens to the
model's actual limit. Also swap nova-premier to nova-pro since premier
requires provisioned throughput unavailable in CI.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 15:45:24 -07:00
shivam
5534f77314 doc improvement 2026-03-09 15:39:27 -07:00
yuneng-jiang
ffd1eb18e0 Merge remote main and resolve conflicts
Kept our sync test fix, accepted upstream's xdist_group marker on
the async handler test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 15:34:50 -07:00
yuneng-jiang
74ed6a16ac Fix flaky test_watsonx_gpt_oss_prompt_transformation
The test was flaky under pytest-xdist parallel execution because it used
async acompletion (which runs completion() in a thread pool via
run_in_executor) and relied on shared global state (known_tokenizer_config,
iam_token_cache, module_level_client) that could be modified by other tests
running in parallel. Failures were silently swallowed by a broad try/except,
causing mock_post.call_count to remain 0.

Fix:
- Convert from async acompletion to sync completion, matching every other
  test in the file. The test's intent is verifying prompt transformation,
  not async behavior.
- Use monkeypatch.setitem for known_tokenizer_config to ensure proper
  teardown isolation.
- Remove unnecessary mock layers (async template fetchers, iam_token_cache
  pre-population, mock completion response) that were only needed for the
  async code path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 15:32:30 -07:00
yuneng-jiang
a5ad414ae0
Merge pull request #23194 from BerriAI/litellm_/recursing-blackburn
[Fix] Batch retrieve missing model_id causing raw output_file_id
2026-03-09 15:28:59 -07:00
yuneng-jiang
4888a31e4f Fix batch retrieve not setting model_id, causing output_file_id to stay raw
When retrieving a batch via the unified batch ID path, only unified_batch_id
was set on _hidden_params but model_id was missing. The managed files hook
requires both to encode output_file_id into a managed ID.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 15:24:50 -07:00
yuneng-jiang
db77976b4e
Merge pull request #23192 from BerriAI/litellm_/pedantic-easley
[Test] Replace SearXNG integration tests with unit tests
2026-03-09 15:20:47 -07:00
yuneng-jiang
29ca052064 Merge remote main, resolve conflict keeping new unit tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 15:20:20 -07:00
yuneng-jiang
b7ac688b2b Replace SearXNG integration tests with unit tests for request/response transformation
The SearXNG search tests were failing in CI because they depend on a live
SearXNG instance that returns results. Since this provider is used by a
very small subset of customers, replace the flaky integration tests with
deterministic unit tests that validate request payloads, URL construction,
response parsing, and header configuration without requiring external infra.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 15:13:58 -07:00
yuneng-jiang
507c772370
Merge pull request #23190 from BerriAI/revert-22655-feat/prisma-metrics-collector
Revert "feat(proxy): add Prisma DB pool and engine health metrics to Prometheus"
2026-03-09 14:57:07 -07:00
yuneng-jiang
8ecac84789
Revert "feat(proxy): add Prisma DB pool and engine health metrics to Promethe…"
This reverts commit 0bb26c3f1b.
2026-03-09 14:55:11 -07:00
github-actions[bot]
c9434a8012
chore: regenerate poetry.lock to match pyproject.toml (#23189)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-09 21:47:52 +00:00
yuneng-jiang
a5e144c419
Merge pull request #23188 from BerriAI/mar9_bump_proxy_extras
[Infra] Bump proxy extras
2026-03-09 14:46:39 -07:00
yuneng-jiang
a9cc39b791 build artifacts 2026-03-09 14:46:03 -07:00