Commit graph

34348 commits

Author SHA1 Message Date
Yuneng Jiang
4022762f46
chore: fixes 2026-04-04 23:00:10 -07:00
Ishaan Jaffer
8a7a2a4e0e fix(cost_breakdown): pass service_tier to _get_token_base_cost for correct tier pricing 2026-03-04 15:49:26 -08:00
Ishaan Jaffer
71f0f2d0d6 address greptile review feedback (greploop iteration 1) 2026-03-04 15:07:33 -08:00
Ishaan Jaffer
cf06646b45 refactor(logging): compute cost_breakdown before StandardLoggingPayload constructor
Extracts _enrich_cost_breakdown_with_cache_costs() call out of the
constructor arg list and into a separate variable. Also drops the
redundant cost_breakdown param from the function signature — reads
logging_obj.cost_breakdown directly instead.
2026-03-04 14:58:12 -08:00
Cursor Agent
8fb8e497ec feat(cost_breakdown): show cache read/write cost in Logs UI
Add cache_read_input_cost and cache_write_input_cost to CostBreakdown.

Backend (litellm_logging.py):
- Add _enrich_cost_breakdown_with_cache_costs() that reads cached_tokens
  and cache_creation_tokens from usage, computes their costs via
  _get_token_base_cost, and injects them into the existing cost_breakdown
  dict before it reaches the spend log.

Frontend (CostBreakdownViewer.tsx):
- Show 'Cache Read Cost' and 'Cache Write Cost' sub-rows under Input Cost
  when the values are present and > 0.

Types (types/utils.py):
- Add cache_read_input_cost and cache_write_input_cost to CostBreakdown.

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-03-04 22:23:30 +00:00
Cursor Agent
6f56852cf1 Revert "feat(cost_breakdown): add granular cost breakdown for web search, cache read/write, and token tiers"
This reverts commit 2c468b775a.
2026-03-04 22:12:24 +00:00
Cursor Agent
2c468b775a feat(cost_breakdown): add granular cost breakdown for web search, cache read/write, and token tiers
Add detailed per-component cost breakdown to the Logs UI Cost Breakdown section:

Backend:
- Extend CostBreakdown TypedDict with granular fields: input_cost_text,
  input_cost_cache_read, input_cost_cache_creation, input_cost_audio,
  output_cost_text, output_cost_reasoning, output_cost_audio, plus
  corresponding token counts and pricing tier indicators (above_128k/200k)
- Add generic_cost_per_token_with_breakdown() that returns individual
  cost components alongside totals
- Add _calculate_input_cost_breakdown() returning InputCostBreakdownResult
- Wire granular breakdown through completion_cost -> _store_cost_breakdown
- Add _populate_granular_cost_breakdown() fallback for pre-computed costs
  (when response_cost is in hidden_params)

Frontend:
- Extend CostBreakdown interface with new fields
- Update CostBreakdownViewer to show nested breakdown under Input/Output:
  Text Tokens, Cache Read, Cache Write, Reasoning, Audio with token counts
- Show 'Web Search / Tool Cost' label for tool_usage_cost
- Display pricing tier badge (Above 200K / 128K Token Pricing)

Tested with OpenAI gpt-4o-mini via /responses (web search) and
/chat/completions (cache read). Component sums verified to match totals.

Co-authored-by: Ishaan Jaff <ishaan-jaff@users.noreply.github.com>
2026-03-04 20:54:17 +00:00
Miguel Armenta
750fc4a980
azure content enhancement... (#22581)
* azure content enhancement...

* rafactored to increase confidence score

* improvements based on additional feedback

* removed unused import

* Force-split any word longer than max length allowed

* preserve whitespace in text splitting

* moving common initialization to base class

* consolidate enforcement into async_make_request as single point, remove redundant caller-side checks, extract shared init/HTTP logic into base, and fix stale log messages

* clean up

* clean up tests
2026-03-04 10:22:30 -08:00
ryan-crabbe
0df36582de
Merge pull request #22728 from BerriAI/litellm_batch_expiry_validation_followup
fix(proxy): improve team expiry enforcement validation
2026-03-04 10:16:02 -08:00
Sameer Kankute
23d312dbd2
Merge pull request #22771 from BerriAI/litellm_responses_websocket_2
Add support for responses websocket for all providers
2026-03-04 22:12:12 +05:30
Julio Quinteros Pro
edbb8ce360
Merge pull request #22775 from BerriAI/fix/model-prices-schema-new-properties
fix: add new model_prices properties to validation schema
2026-03-04 11:52:01 -03:00
Julio Quinteros Pro
53ea6a280a
Merge pull request #22776 from BerriAI/fix/ruff-unused-imports
fix: remove unused EncryptedContentAffinityCheck import in router.py
2026-03-04 11:51:11 -03:00
Julio Quinteros Pro
512a5fa3c7
Merge pull request #22788 from BerriAI/fix/azure-batches-add-tenacity-ci
Add tenacity to e2e Azure batch CI and revert importorskip
2026-03-04 11:50:44 -03:00
Julio Quinteros Pro
9f000373de
Merge pull request #22789 from BerriAI/fix/linting-ci-openai-version
Remove incompatible openai==1.100.1 pin from linting CI
2026-03-04 11:50:29 -03:00
Julio Quinteros Pro
75b2e40cd3 Remove incompatible openai==1.100.1 pin from linting CI
The linting workflow force-installed openai==1.100.1 which conflicts
with litellm's requirement of openai>=2.8.0, causing pip dependency
resolver errors and CI cancellation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 11:46:31 -03:00
Julio Quinteros Pro
aa62ddaf0a Add tenacity to e2e Azure batch CI and revert importorskip
PR #22785 used pytest.importorskip which causes exit code 5 (all
skipped) in CI. Instead, add tenacity to the CI workflow pip install
and restore direct imports.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 11:45:14 -03:00
Julio Quinteros Pro
4ec92ba924 fix: add new model_prices properties to validation schema
Add cache_read_input_token_cost_per_audio_token, supports_code_execution,
and supports_file_search to the JSON schema used by the model prices
validation test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 11:37:02 -03:00
Julio Quinteros Pro
f0cd93aeb2 fix: remove unused imports in tool_management_endpoints and streaming_iterator
- Remove unused ToolOutputPolicy import
- Remove unused _WsClientConnection TYPE_CHECKING import

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 11:36:08 -03:00
Julio Quinteros Pro
0dc8b08987 fix: remove unused top-level EncryptedContentAffinityCheck import
The class is already imported locally where it's used (line 1261).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 11:36:08 -03:00
Julio Quinteros Pro
317c162dfe
Merge pull request #22785 from BerriAI/fix/azure-batches-test-tenacity-import
Guard tenacity import in e2e Azure batch tests
2026-03-04 11:34:57 -03:00
Julio Quinteros Pro
a7e2bc3a92
Merge pull request #22784 from BerriAI/fix/responses-id-security-test
Fix responses ID security test for new request_cache parameter
2026-03-04 11:34:23 -03:00
Julio Quinteros Pro
fac622b5e6
Merge pull request #22783 from BerriAI/fix/schema-migration-check
Add missing migration for LiteLLM_ToolTable policy changes
2026-03-04 11:34:16 -03:00
Julio Quinteros Pro
f4e8c02ba2
Merge pull request #22781 from BerriAI/fix/tool-management-endpoint-tests
Fix tool management tests using wrong field name call_policy
2026-03-04 11:34:04 -03:00
Julio Quinteros Pro
d3b210fdd0
Merge pull request #22780 from BerriAI/fix/a2a-cost-calculator-test
Fix A2A message context_id access when message is a dict
2026-03-04 11:33:53 -03:00
Julio Quinteros Pro
f0c80d2a86
Merge pull request #22778 from BerriAI/fix/azure-test-exclude-aresponses-websocket
Exclude aresponses_websocket from Azure SDK client init test
2026-03-04 11:33:23 -03:00
Julio Quinteros Pro
570e8861bd
Merge pull request #22777 from BerriAI/fix/mcp-streaming-test-and-iterator
Fix flaky MCP streaming test and iterator silent failure
2026-03-04 11:33:11 -03:00
Julio Quinteros Pro
8495e05221 Guard tenacity import in e2e Azure batch tests
tenacity is not in pyproject.toml dependencies, causing ImportError
during test collection. Use pytest.importorskip to gracefully skip
when tenacity is not available.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 11:32:20 -03:00
Julio Quinteros Pro
c0ac788709 Fix responses ID security test for new request_cache parameter
The _encrypt_response_id method now receives request_cache=None as a
keyword argument from async_post_call_success_hook. Updated the mock
assertion to expect this parameter.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 11:29:51 -03:00
Julio Quinteros Pro
d8d3375a3c Add missing migration for LiteLLM_ToolTable policy changes
PR #22732 changed the ToolTable schema (renamed call_policy to
input_policy, added output_policy/user_agent/last_used_at columns,
updated indexes) but didn't include a migration for these changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 11:27:51 -03:00
Julio Quinteros Pro
1ec6502f88 Fix tool management tests using wrong field name call_policy
Tests used call_policy throughout but the actual API model uses
input_policy and output_policy. Updated _make_tool_row helper,
list filter query param, and policy update request/response assertions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 11:20:17 -03:00
Julio Quinteros Pro
d6949e5323 Fix A2A message context_id access when message is a dict
The asend_message function accessed request.params.message.context_id
using attribute syntax, but message can be either a dict or an object.
Handle both cases using isinstance check, matching the existing pattern
in litellm/a2a_protocol/utils.py.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 11:16:48 -03:00
Julio Quinteros Pro
d22996ee87 Exclude aresponses_websocket from Azure SDK client init test
The aresponses_websocket CallType was recently added but not included
in the test exclusion list. It uses WebSocket passthrough (not Azure SDK
client initialization), so it correctly doesn't call
initialize_azure_sdk_client.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 11:13:57 -03:00
Julio Quinteros Pro
e8301829cd Fix flaky MCP streaming test by properly mocking inner aresponses call
The test_streaming_mcp_events_validation test was flaky because:
1. It didn't mock the nested aresponses() call inside the iterator's
   _create_initial_response_iterator(), causing real API calls that fail
   without credentials
2. The iterator silently swallowed exceptions and set phase="finished",
   discarding pre-generated MCP discovery events
3. The _execute_tool_calls mock had wrong signature (missing tool_server_map)

Production fix: MCPEnhancedStreamingIterator no longer sets phase="finished"
on LLM call failure — it falls through to emit MCP discovery events first.

Test fix: Added mock for litellm.responses.main.aresponses returning a fake
async streaming iterator, fixed mock signatures, removed try/except that
masked failures.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 11:09:24 -03:00
Sameer Kankute
51552eafe7
Merge pull request #22751 from BerriAI/litellm_fix_mcp_edit_tools
Fix MCP server URL and tools management
2026-03-04 18:30:28 +05:30
Sameer Kankute
db0d5588fa
Merge pull request #22740 from BerriAI/litellm_fix_file_wild_card
Add support for wildcards models for files api
2026-03-04 18:30:00 +05:30
Sameer Kankute
ece7fdb213
Merge pull request #22744 from BerriAI/litellm_mcp_streaming_fix
Add mcp streaming events Fix and consistent response ID
2026-03-04 18:29:48 +05:30
Sameer Kankute
b5183e9f3b
Merge pull request #22752 from BerriAI/litellm_search_api_add
[Feat] Add Google Search API Integration
2026-03-04 18:29:10 +05:30
Sameer Kankute
213bf11ede
Merge pull request #22763 from BerriAI/litellm_test_e2e_batches_test
feat(tests): add proxy e2e azure batches test
2026-03-04 18:28:52 +05:30
Sameer Kankute
d143df8591 Add tests for resp
onses websocket
2026-03-04 18:27:06 +05:30
Sameer Kankute
c058c2b371 Add documentation related to responses websocket 2026-03-04 18:26:43 +05:30
Sameer Kankute
be9c09e8d2 Add supports_native_websocket to handle providers who don't handle websocket 2026-03-04 18:26:16 +05:30
Sameer Kankute
eec6f6ee69 Add support for responses websocket for all providers 2026-03-04 18:24:50 +05:30
Sameer Kankute
8764e5da8c
Merge pull request #22559 from BerriAI/litellm_responses_websocket
[Feat] Add support for Responses Websocket
2026-03-04 17:57:34 +05:30
github-actions[bot]
09ee2d54b8
chore: regenerate poetry.lock to match pyproject.toml (#22769)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-04 12:24:44 +00:00
Sameer Kankute
a6b5197ddc
Merge pull request #22689 from BerriAI/litellm_oss_staging_03_03_2026
Litellm oss staging 03 03 2026
2026-03-04 17:53:57 +05:30
Sameer Kankute
95c6a7e183
Merge pull request #22768 from BerriAI/revert-21491-fix/20998-remove-hardcoded-reasoning-summary
Revert "fix(anthropic): remove hardcoded reasoning summary in adapter"
2026-03-04 17:53:02 +05:30
Sameer Kankute
4e229b7b21
Revert "fix(anthropic): remove hardcoded reasoning summary in adapter" 2026-03-04 17:52:49 +05:30
Sameer Kankute
7d790b39be
Merge pull request #22765 from BerriAI/main
merge main for 030326
2026-03-04 17:40:42 +05:30
Sameer Kankute
d14420b8f2 Add tenacity in dependencies 2026-03-04 17:28:22 +05:30
Sameer Kankute
ef7aa6c8ad Add this test in cicd 2026-03-04 17:24:48 +05:30