Commit graph

34410 commits

Author SHA1 Message Date
Julio Quinteros Pro
9b92ea16ab fix: update response_format test for vertex_ai's intentional schema diff
Vertex AI / Gemini uses Pydantic's model_json_schema() which omits
additionalProperties: False (Gemini rejects it). The test expected
the same schema for all providers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 19:55:18 -03:00
Julio Quinteros Pro
eb658693a3 fix: use direct AsyncMock assignment instead of patch.object in JWT tests
The patch.object with new_callable=AsyncMock can behave inconsistently
across Python versions, causing mock_response.status_code to return a
MagicMock instead of the assigned value. Direct assignment is simpler
and more reliable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 19:51:09 -03:00
Julio Quinteros Pro
e6a1194c28
Merge pull request #22717 from BerriAI/fix/types-utils-video-tokens-test
fix: add video_tokens to completion_tokens_details test
2026-03-03 19:48:44 -03:00
Julio Quinteros Pro
2943df96ba fix: add video_tokens to expected completion_tokens_details in test
The CompletionTokensDetailsWrapper type now includes video_tokens field,
but this test's expected dict was not updated to include it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 19:46:20 -03:00
Julio Quinteros Pro
fc9d06ceca
Merge pull request #22716 from BerriAI/fix/vertex-function-response-tests
fix: update vertex AI tests for function_response role=user
2026-03-03 19:44:54 -03:00
Julio Quinteros Pro
5a0aba9fb7 fix: update vertex AI tests to expect role=user on function_response messages
The Gemini API requires role="user" on function_response content blocks
(added in commit 273cf12afa), but these tests were never updated to match.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 19:40:28 -03:00
yuneng-jiang
5da7fa9ac1 [Feature] UI - Virtual Keys: Add manual spend reset to unblock keys
Adds a "Reset Spend" button to the key detail view so proxy admins and team
admins can immediately reset a key's spend to $0, unblocking keys that have
hit their budget limit without waiting for the next scheduled budget reset.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 14:39:39 -08:00
Julio Quinteros Pro
2c5c38333d
Merge pull request #22701 from BerriAI/fix/streaming-and-azure-gpt5-test-failures
Fix Anthropic streaming sync and Azure GPT-5.1 logprobs tests
2026-03-03 19:36:44 -03:00
ryan-crabbe
8aa7d53864
Merge pull request #22705 from BerriAI/litellm_feat_batch_expiry_setting_teams
Litellm feat batch expiry setting teams
2026-03-03 14:36:12 -08:00
ryan-crabbe
c8e6428eb7
Update litellm/proxy/openai_files_endpoints/files_endpoints.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-03 14:35:58 -08:00
Ryan Crabbe
35d2bc382f fix(batches): suppress PLR0915 lint for create_batch dispatch function 2026-03-03 14:28:25 -08:00
yuneng-jiang
657a60ea5b fix(audit): AND semantics for combined JSON filters; remove unused allTeams prop
- Fix object_team_id + object_key_hash combining incorrectly as OR — each
  filter now adds an AND clause wrapping an internal OR over before_value
  and updated_values, so both conditions must be satisfied simultaneously
- Rename helper to _build_json_field_or_condition to reflect its purpose
- Remove allTeams from AuditLogsProps and its call site in index.tsx

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 14:24:55 -08:00
Ryan Crabbe
903ade4a1b fix(proxy): add anchor validation for file expiry, key validation for batch expiry
Validate anchor is "created_at" in enforced_file_expires_after (matching
user-provided path). Add key existence validation to batch endpoint for
enforced_batch_output_expires_after.
2026-03-03 13:51:41 -08:00
yuneng-jiang
2d26209d80
Merge pull request #22698 from BerriAI/litellm_test_projects_hooks
[Test] UI - Projects: Add unit tests for project hooks
2026-03-03 13:42:28 -08:00
Ryan Crabbe
d6ad312a4c fix(proxy): validate enforced_file_expires_after keys before access
Add key validation for enforced_file_expires_after to return a clear
400 error instead of an unhandled KeyError 500.
2026-03-03 13:37:11 -08:00
Julio Quinteros Pro
ab718444c5 Remove dead pending_new_content_block attribute
Cleanup per review: this class attribute is no longer used after the
__next__ refactor to queue-based approach.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 18:28:34 -03:00
Julio Quinteros Pro
fbf916d71e
Merge pull request #22699 from BerriAI/fix/mypy-count-tokens-signature
Fix mypy override errors in count_tokens signatures
2026-03-03 18:28:14 -03:00
Julio Quinteros Pro
6b4bc99202 Fix Anthropic streaming sync __next__ and Azure GPT-5.1 logprobs
Two independent fixes for pre-existing test failures on main:

1. Anthropic streaming: The sync __next__ method used a simple
   holding_chunk pattern that lost chunks when multiple events needed
   to be returned. Refactored to use the same chunk_queue approach as
   the async __anext__ method. Also fixed tests that used ModelResponse
   (which defaults finish_reason to 'stop') instead of ModelResponseStream.

2. Azure GPT-5.1 logprobs: The base OpenAI class includes logprobs for
   gpt-5.1+ models, but Azure hasn't verified support for gpt-5.1.
   Added explicit removal of logprobs/top_logprobs for gpt-5.1 (non-5.2)
   models in the Azure config.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 18:16:11 -03:00
Julio Quinteros Pro
279b4f16cb Fix mypy override errors in count_tokens signatures
Replace **kwargs with explicit tools and system parameters to match
the BaseTokenCounter.count_tokens abstract method signature.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-03 18:15:27 -03:00
Harshit Jain
b62a4be6b6
Merge pull request #22676 from BerriAI/litellm_feat_guardrail-list
feat: guardrail-mode-default-list
2026-03-04 02:36:57 +05:30
yuneng-jiang
4edb1e00c6 [Test] UI - Add unit tests for project hooks
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 12:36:26 -08:00
Harshit28j
d661419109 fix: support list of modes in Mode.default for tag-based guardrails 2026-03-04 01:50:28 +05:30
Ryan Crabbe
08613b24cb feat(proxy): add team-level file expiry enforcement 2026-03-03 11:03:14 -08:00
Ryan Crabbe
3d15bcdb11 feat(proxy): add team-level batch output expiry enforcement 2026-03-03 10:58:31 -08:00
Chesars
4b1389501d fix: move _set_usage_and_cost outside try/except in OpenRouter image edit
Prevents discarding already-parsed images when usage calculation fails.
2026-03-03 15:58:23 -03:00
yuneng-jiang
4c1b15d685
Merge pull request #22687 from BerriAI/litellm_fix_spend_log_cleanup
[Fix] Spend Log Cleanup: lock tracking, integer retention, skip log level
2026-03-03 10:48:20 -08:00
Ryan Crabbe
43cec8c980 feat(batches): support output_expires_after passthrough 2026-03-03 10:46:45 -08:00
Chesars
6f74d3881a fix(lint): remove unused imports in batch_utils.py
time, httpx, uuid, and ModelResponse are no longer used after the
vertex_ai batch cost calculation was rewritten upstream.
2026-03-03 15:42:45 -03:00
Chesars
39765149dc Merge remote-tracking branch 'upstream/litellm_oss_staging_03_03_2026' into litellm_oss_staging_03_03_2026 2026-03-03 15:41:22 -03:00
Chesars
a6e18ae31b fix: address review feedback — type OpenAICredentials.api_base as str, remove dead vertex_ai block
- OpenAICredentials.api_base is always non-None due to fallback default,
  so type it as str instead of Optional[str]
- Remove unreachable elif vertex_ai block in create_file(); vertex_ai is
  already handled by ProviderConfigManager via provider_config path
2026-03-03 15:36:45 -03:00
Cesar Garcia
8a1e915bb6
Merge pull request #22403 from shivaaang/fix/openrouter-image-edit
feat(openrouter): add image edit support for OpenRouter models
2026-03-03 15:31:04 -03:00
Cesar Garcia
d384f7c320
Merge pull request #21233 from Chesars/feat/per-request-json-schema-validation
feat: support per-request enable_json_schema_validation for thread safety
2026-03-03 15:29:54 -03:00
Cesar Garcia
a8b5a876bf
Merge pull request #21491 from Chesars/fix/20998-remove-hardcoded-reasoning-summary
fix(anthropic): remove hardcoded reasoning summary in adapter
2026-03-03 15:29:11 -03:00
Chesars
833c1bc45d merge: resolve conflict with staging, remove hardcoded summary from reasoning test 2026-03-03 15:28:45 -03:00
Cesar Garcia
b2c7d2e049
Merge pull request #21577 from Chesars/fix/gemini-streaming-tool-calls-finish-reason
fix(gemini): correct streaming finish_reason for tool calls
2026-03-03 15:25:24 -03:00
Cesar Garcia
bca1964f70
Merge pull request #22603 from BerriAI/fix/helicone-vertex-gemini-provider-url
fix(helicone): correct provider URL for Vertex AI Gemini models
2026-03-03 15:23:51 -03:00
yuneng-jiang
a1ba6c9fa6 Fix log levels: info for unconfigured, warning for misconfigured
Suppress noisy error log fired every cron tick when spend log cleanup
is simply not configured. _should_delete_spend_logs already logs the
specific reason at the right level (info for None, warning for
invalid value), so the redundant blanket error log in
cleanup_old_spend_logs is removed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 10:21:31 -08:00
Chesars
4a88d85446 test: add provider_url routing test for vertex_ai/gemini models
Verifies that vertex_ai gemini models route to
aiplatform.googleapis.com instead of
generativelanguage.googleapis.com, preventing
regressions if the branch ordering changes.
2026-03-03 15:20:51 -03:00
Cesar Garcia
da941e4261
Merge pull request #22589 from Chesars/fix/vertex-preserve-any-type-schema
fix(vertex): preserve type schema semantics for JsonValuefields
2026-03-03 15:19:16 -03:00
Cesar Garcia
f77f28a5f8
Merge pull request #20920 from Chesars/refactor/files-main-credential-helpers
chore: code duplication in files/main.py using credential helpers
2026-03-03 15:18:17 -03:00
Cesar Garcia
fe8fa3abe0
Merge pull request #17308 from Chesars/fix/python-multipart-version-constraint
chore: update python-multipart constraint to >=0.0.18
2026-03-03 15:17:57 -03:00
Cesar Garcia
de415abd5a
Merge pull request #22653 from Chesars/fix/batch-encode-ids-x-litellm-model
fix(proxy): encode batch IDs when x-litellm-model header is used
2026-03-03 15:17:43 -03:00
Cesar Garcia
fecb301684
Update litellm/llms/openrouter/image_edit/transformation.py
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
2026-03-03 15:16:12 -03:00
Chesars
47f0390b9b fix: remove duplicate Pillow==11.0.0 pin (12.1.1 already on line 8) 2026-03-03 15:14:20 -03:00
yuneng-jiang
224c617119 Fix spend log cleanup: lock tracking, integer retention, skip log level
- Only release distributed lock in finally if it was actually acquired;
  prevents spurious Redis release_lock calls on early returns
- Treat bare integer maximum_spend_logs_retention_period as days (e.g. 3 → "3d")
  instead of silently failing with a ValueError
- Elevate "Skipping cleanup" log from info to error so misconfigured
  retention settings are visible without verbose logging
- Add tests for all three fixes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-03 10:12:08 -08:00
Varad Khonde
7d65df351f feat(togetherai): add support for TogetherAI Qwen3.5-397B-A17B model 2026-03-03 23:40:41 +05:30
Chesars
dc9f5a5cc4 fix(deps): update python-multipart to >=0.0.20 in CI and test configs 2026-03-03 15:10:39 -03:00
Chesars
dad7805b42 fix(deps): update python-multipart version to 0.0.22 in all files
Align requirements.txt, CI workflow, liccheck, and license cache
with the >=0.0.22 constraint already set in pyproject.toml.
2026-03-03 15:09:33 -03:00
Chesars
5005773909 fix(deps): relax python-multipart version constraint to >=0.0.22
The caret operator (^0.0.x) in zerover projects restricts to a single
patch version. Changed to >= to allow future patch updates.
2026-03-03 15:09:04 -03:00
Chesars
ead74dff11 refactor: move credential helpers to provider common_utils modules
Move get_openai_credentials() to litellm/llms/openai/common_utils.py
and get_azure_credentials() to litellm/llms/azure/common_utils.py
so they can be reused by batches/main.py and other modules.
Signatures now take individual params instead of GenericLiteLLMParams.
2026-03-03 15:02:24 -03:00