Commit Graph
34739 Commits
Author SHA1 Message Date
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
tristanoliveandGitHub 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 CalkinandGitHub 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
Marty SullivanandGitHub 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
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-jiangandGitHub 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
yuneng-jiangandClaude Opus 4.6 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-jiangandGitHub 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-jiangandClaude Opus 4.6 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-jiangandGitHub 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-jiangandGitHub 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-jiangandGitHub 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
yuneng-jiangandGitHub d719c8a53c Merge branch 'main' into litellm_fix_nova_pro_max_tokens 2026-03-09 15:47:53 -07:00
yuneng-jiangandClaude Opus 4.6 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-jiangandClaude Opus 4.6 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-jiangandClaude Opus 4.6 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-jiangandGitHub 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-jiangandClaude Opus 4.6 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-jiangandGitHub 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-jiangandClaude Opus 4.6 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-jiangandClaude Opus 4.6 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-jiangandGitHub 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-jiangandGitHub 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]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
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-jiangandGitHub 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
yuneng-jiang bd914281e5 bump: version 0.4.52 → 0.4.53 2026-03-09 14:45:41 -07:00
yuneng-jiangandGitHub 1a5e215f08 Merge pull request #23186 from BerriAI/litellm_doc_max_budget_per_session_ttl
[Docs] Add LITELLM_MAX_BUDGET_PER_SESSION_TTL to env vars reference
2026-03-09 14:41:52 -07:00
yuneng-jiangandGitHub b4e78ac7b4 Merge branch 'main' into litellm_doc_max_budget_per_session_ttl 2026-03-09 14:41:41 -07:00
yuneng-jiangandClaude Opus 4.6 ea4e2bda8f Document LITELLM_MAX_BUDGET_PER_SESSION_TTL env var
Add missing env var to config_settings.md to fix test_env_keys CI check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 14:40:05 -07:00
yuneng-jiangandGitHub be9d1798b2 Merge pull request #23182 from BerriAI/litellm_/exciting-swanson
[Fix] Model pricing schema test missing output_cost_per_image_token_batches
2026-03-09 14:26:21 -07:00
yuneng-jiangandClaude Opus 4.6 379ce1aae5 [Fix] Add output_cost_per_image_token_batches to model pricing schema test
The gemini-3.1-flash-image-preview model introduced a new pricing field
that was missing from the test's validation schema and cost_fields list.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 14:17:52 -07:00
yuneng-jiangandGitHub 729f32d6d5 Merge pull request #23179 from BerriAI/litellm/intelligent-wilbur
[Fix] Chocolatey v2.5.1 Interactive Prompt Blocking Windows CI
2026-03-09 14:09:58 -07:00
yuneng-jiangandClaude Opus 4.6 4cc7e76fbe Fix Chocolatey v2.5.1 interactive prompt in Windows CI job
Chocolatey v2.5.1 introduced interactive prompts that block CI. Add
--no-progress, --force flags and CHOCOLATEY_CONFIRM_ALL env var to
fully suppress user input in non-interactive environments.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 14:06:46 -07:00
yuneng-jiangandGitHub 5610945830 Merge pull request #23177 from BerriAI/litellm_fix_lint_error
[Fix] Remove duplicate jwt_key_mapping_router import
2026-03-09 13:59:41 -07:00
yuneng-jiangandClaude Opus 4.6 169e76ccf9 Remove duplicate jwt_key_mapping_router import
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 13:58:04 -07:00
yuneng-jiangandGitHub 1103a8c620 Merge pull request #23171 from BerriAI/litellm_survey_vitest_tests
[Test] UI - Survey: add Vitest unit tests for untested components
2026-03-09 12:13:24 -07:00
yuneng-jiangandClaude Sonnet 4.6 994976ce6f [Test] UI - Survey: add Vitest tests for ClaudeCodeModal, ClaudeCodePrompt, SurveyPrompt, and SurveyModal
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 11:48:56 -07:00
michelligabrieleandGitHub c47f77a348 fix(agentcore): handle JSON responses from agents using sync return (#23165)
* fix(agentcore): handle JSON responses from agents using sync return

BedrockAgentCoreApp agents that use synchronous `return` (instead of
async `yield`) respond with Content-Type: application/json instead of
text/event-stream. The streaming parser only handles SSE format, silently
discarding the JSON body and returning empty content to the client.

This adds Content-Type detection in both sync and async streaming
wrappers — when application/json is received, the response is parsed
and converted to a single-chunk stream. Also extends _parse_json_response
with a fallback chain supporting multiple agent response schemas (standard
AgentCore, Strands framework, plain string, raw JSON fallback).

* fix(agentcore): add dict-type guard to _parse_json_response

Prevent AttributeError when json.loads() returns a non-dict
(e.g. JSON array or primitive) by adding an isinstance check
at the top of _parse_json_response. Non-dict values fall back
to raw JSON string content.

* fix(agentcore): handle malformed JSON and split streaming chunks

- Wrap json.loads() in try/except in both sync and async streaming
  wrappers so malformed JSON bodies raise a structured BedrockError
  instead of a raw JSONDecodeError
- Split the JSON-fallback streaming path into two chunks (content
  chunk with finish_reason=None, then stop sentinel with empty delta)
  to match the SSE path convention

* fix(agentcore): catch IO errors in streaming JSON path + async error test

- Broaden except clause to catch both json.JSONDecodeError and IO-level
  exceptions (httpx.ReadError, etc.) from response.read()/aread(), so
  all failures surface as structured BedrockError
- Add async malformed-JSON test to mirror the sync test coverage
2026-03-09 10:22:36 -07:00
Aarish AlamandGitHub e21b06265a fix fkey violation on deleting user (#23115) 2026-03-09 08:53:11 -07:00
0bb26c3f1b feat(proxy): add Prisma DB pool and engine health metrics to Prometheus (#22655)
* feat(proxy): add Prisma DB pool and engine health metrics to Prometheus

Add a PrismaMetricsCollector that periodically queries pg_stat_activity
and the Prisma engine process to expose connection pool and engine health
as Prometheus gauges/counters. Auto-enabled when prometheus_system is in
service_callback.

New metrics:
- litellm_db_pool_active_connections (Gauge)
- litellm_db_pool_idle_connections (Gauge)
- litellm_db_pool_total_connections (Gauge)
- litellm_db_pool_waiting_connections (Gauge)
- litellm_db_engine_up (Gauge)
- litellm_db_engine_restarts_total (Counter)

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

* fix: address Greptile review feedback

- Only increment engine_restarts counter on heavy reconnects (engine
  actually dead), not lightweight network-blip reconnects
- Fix potential KeyError in _get_or_create_gauge/counter fallback path
  when REGISTRY._names_to_collectors is absent
- Rename litellm_db_pool_waiting_connections to
  litellm_db_pool_lock_waiting_connections to clarify it measures lock
  contention, not pool slot queuing

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

* fix: warn when prometheus_system enabled but watchdog disabled

Log a warning when users have prometheus_system in service_callback
but PRISMA_HEALTH_WATCHDOG_ENABLED=false, since DB pool and engine
metrics won't be collected in that configuration.

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

* ci: retrigger CI checks

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

* refactor: use labeled gauge for DB pool connection metrics

Replace 3 separate pool gauges (active, idle, total) with a single
`litellm_db_pool_connections` gauge using a `state` label. This is more
Prometheus-idiomatic and exposes all pg_stat_activity states (active,
idle, idle in transaction, etc.) without ambiguity about what "total"
includes.

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

* fix: address Greptile review — stale labels and fallback re-registration

- Zero out known pg_stat_activity states that are absent from the current
  query result, preventing stale gauge values from persisting.
- Simplify _get_or_create_gauge/counter by removing the fallback loop
  that could re-register an already-registered metric (ValueError).
- Add test for stale label clearing across collection cycles.

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

* fix: include "unknown" in _PG_STATES for stale label clearing

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

* fix: collect immediately on start and consolidate into single query

- Move sleep to end of loop so metrics appear on /metrics immediately
  after startup instead of after a 30s delay.
- Combine pool state and lock waiting queries into a single SQL query
  using conditional aggregation, halving per-cycle DB overhead.

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

* fix: prevent tight spin loop on collection error

Move asyncio.sleep outside the try/except so it always executes even
when _collect_engine_health() or _collect_pool_metrics() raises.

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

* fix: add multiprocess_mode to _get_or_create_gauge initialization

- Include `multiprocess_mode` parameter to properly support multiprocessing in Gauge creation.
- Ensure consistent behavior for labeled and unlabeled Gauges.

* fix: handle invalid env var and document watchdog prerequisite

- Add try/except ValueError for PRISMA_METRICS_COLLECTION_INTERVAL_SECONDS
  to prevent proxy startup crash on non-numeric values (e.g. "30s")
- Document that DB metrics require both prometheus_system callback and
  PRISMA_HEALTH_WATCHDOG_ENABLED=true

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

* fix: use defensive null coalescing for query_raw row values

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

* test: add invalid env var fallback test and fix mock signature

- Add test for non-numeric PRISMA_METRICS_COLLECTION_INTERVAL_SECONDS
- Add **kwargs to mock _patched_get_or_create_gauge for forward compat

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 08:49:46 -07:00
milan-berriandGitHub df2e1bca46 feat: allow JWT and OAuth2 auth to coexist on the same instance (#23153)
When both enable_jwt_auth and enable_oauth2_auth are True, the proxy now
routes tokens based on their format:
- JWT tokens (3 dot-separated parts) -> JWT auth handler
- Opaque tokens -> OAuth2 auth handler

This enables using JWT for human users and OAuth2 for M2M (machine) clients
on the same LiteLLM instance. Previously, enabling OAuth2 would intercept
all tokens on LLM API routes before JWT auth could run.

When only one auth method is enabled, behavior is unchanged (backward compatible).
2026-03-09 08:41:27 -07:00
Ihsan SoydemirandGitHub b1a6ba7711 feat(search): add Serper (serper.dev) as search provider (#23112)
* Add Serper (serper.dev) as a new search provider

* Add @greptileai fixes
2026-03-09 08:40:37 -07:00
Joe ReynaandGitHub 36e04b6efe fix(tests): restore litellm_params=None on mock agent in a2a invoke test (#23125) 2026-03-09 07:16:02 -07:00
Joe ReynaandGitHub 0bc1bd6871 fix(tests): use AsyncMock for prisma find_unique in agent get-by-id test (#23122) 2026-03-09 07:13:50 -07:00
Sameer KankuteandGitHub ca4d4a0188 Merge pull request #23143 from giulio-leone/fix/gpt-5-4-pro-support
fix(models): set gpt-5.4-pro mode to responses — fixes #23014
2026-03-09 17:36:06 +05:30
Sameer KankuteandGitHub 20d911599c Merge pull request #23145 from BerriAI/litellm_publish_enterprise_pr_workflow
Fix enterpise bump yml
2026-03-09 17:28:07 +05:30
Sameer KankuteandGitHub b28d6eca67 Merge pull request #23144 from BerriAI/bump/enterprise-0.1.34
bump: litellm-enterprise 0.1.33 → 0.1.34
2026-03-09 16:44:12 +05:30