Commit Graph
31 Commits
Author SHA1 Message Date
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
Chesars 2e9f057fbd style: run black formatter on entire codebase 2026-03-11 17:07:57 -03:00
Sameer KankuteandClaude Sonnet 4.6 512a438935 feat(proxy): add WebSocket endpoint for responses API and route_llm_request support
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 17:22:44 +05:30
Xianzong Xie 0b8c10c488 Add native_background_mode to override polling_via_cache for specific models
This follow-up to PR #16862 allows users to specify models that should use
the native provider's background mode instead of polling via cache.

Config example:
  litellm_settings:
    responses:
      background_mode:
        polling_via_cache: ["openai"]
        native_background_mode: ["o4-mini-deep-research"]
        ttl: 3600

When a model is in native_background_mode list, should_use_polling_for_request
returns False, allowing the request to fall through to native provider handling.

Committed-By-Agent: cursor
2026-01-27 15:54:46 -08:00
Ishaan JaffandGitHub 76eda472be [Feat] New API Endpoint - Responses API (v1/responses/compact) (#18697)
* init transform_compact_response_api_request

* init acompact_responses

* init async_compact_response_api_handler in llm http handler

* init transform_compact_response_api_request for openai

* init acompact_responses

* fix acompact_responses

* add OAI Compact API

* docs responses API Compact

* code qa checks

* test_openai_compact_responses_api

* fix mypy linting
2026-01-06 16:24:04 +05:30
Sameer Kankute 7d0f41f437 Add cost tracking for responses api in background mode 2025-12-19 13:35:48 +05:30
Sameer Kankute 8e2a91c0c1 fix:mypy errors for litellm_staging_12_17_2025 2025-12-17 22:16:46 +05:30
Xiaohan FuandGitHub aac17e5e22 various fixes for openrouter driven models (/messages and its streaming) and introduce the option to send all chunked responses in stream towards the guardrail. (#18085) 2025-12-17 11:21:26 +05:30
Ishaan JaffandGitHub 24d6ec67c7 [QA] Cursor Integration x LiteLLM (#17855)
* fix utils.py

* ValidUserMessageContentTypesLiteral

* add _transform_tool_choice

* _transform_responses_api_content_to_chat_completion_content

* TestContentTypeTransformation

* test_map_tool_choice_string_auto

* fix validate_chat_completion_user_messages

* fix _is_input_item_tool_call_output

* fix LiteLLMCompletionResponsesConfig
2025-12-13 12:49:45 -08:00
Sameer KankuteandGitHub b83bc10562 Merge pull request #16862 from xianzongxie-stripe/add_polling_via_cache_feature
Add polling via cache feature
2025-12-08 08:41:25 +05:30
Xianzong Xie 7c9b70bfdc chore: remove unused datetime import
Committed-By-Agent: cursor
2025-12-05 11:25:59 -08:00
Xianzong Xie 508414d3a4 refactor: use typed DeleteResponseResult for polling delete response
Committed-By-Agent: cursor
2025-12-05 09:24:46 -08:00
Xianzong Xie 5d59f47db4 refactor: extract should_use_polling_for_request to polling_handler module
Committed-By-Agent: cursor
2025-12-05 09:02:15 -08:00
Sameer Kankute a6006e698c Add support for cursor BYOK with its own configuration 2025-12-05 09:34:49 +05:30
Xianzong Xie a8a38778a3 fix: resolve provider from router for polling_via_cache
- Fix bug where model names without slash (e.g., 'gpt-5') couldn't
  match providers in polling_via_cache list
- Look up model in llm_router.model_name_to_deployment_indices
- Check ALL deployments for matching provider (supports load balancing)
- Check custom_llm_provider first, then extract from model string
- Add comprehensive tests for provider resolution logic

Committed-By-Agent: cursor
2025-12-04 17:47:30 -08:00
Xianzong Xie 1c3c12bb1b refactor: move background_streaming_task to separate module
- Create new background_streaming.py in response_polling/
- Update endpoints.py to import from new location
- Update __init__.py to export background_streaming_task
- Add tests for module imports and structure

Committed-By-Agent: cursor
2025-12-03 22:50:26 -08:00
Xianzong Xie c464af4c15 chore: add noqa for PLR0915 in _background_streaming_task
Committed-By-Agent: cursor
2025-12-03 21:57:56 -08:00
Xianzong Xie 901252fb78 chore: remove unused imports and variables
- Remove unused typing imports (Any, Dict)
- Remove unused output_index variable
- Fix comment to reflect actual key structure (item_id, content_index)

Committed-By-Agent: cursor
2025-12-03 21:39:49 -08:00
Xianzong Xie 540f14ef51 feat: improve polling via cache feature
- Add 150ms batched updates instead of per-event updates for better performance
- Handle response.output_text.delta events for text accumulation
- Add response.in_progress event handling for status updates
- Add response.completed event handling with reasoning, tools, tool_choice
- Remove unused output_item parameter from update_state
- Remove response.done event type (not valid in OpenAI spec)
- Remove documentation files
- Add comprehensive unit tests for ResponsePollingHandler

Committed-By-Agent: cursor
2025-12-03 18:37:28 -08:00
Xianzong Xie fc30b92167 add polling via cache feature 2025-12-03 18:37:28 -08:00
Ishaan JaffandGitHub 4cef208c5f [Fix] - Responses API - add /openai routes for responses API. (Azure OpenAI SDK Compatibility) (#15988)
* add /openai routes for responses API

* TestResponsesAPIEndpoints
2025-10-27 19:12:13 -07:00
Sameer KankuteandGitHub 110ce543c2 [Feat]Add cancel endpoint support for openai and azure (#14561)
* Add cancel endpoint support for openai
 and azure

* fix lint error

* fix cancel url contruction azure

* readd changes
2025-09-15 07:08:56 -07:00
Ishaan JaffandGitHub 4dc9626fd5 [Feat] New LLM API Endpoint - Add List input items for Responses API (#11602)
* (feat) add list_input_items

* add alist_input_items to router

* add GET input_items for responses API

* test_basic_openai_list_input_items_endpoint

* TestTransformListInputItemsRequest

* test_ensure_initialize_azure_sdk_client_always_used
2025-06-10 15:47:16 -07:00
Ishaan JaffandGitHub 5de101ab7b [Feat] Add GET, DELETE Responses endpoints on LiteLLM Proxy (#10297)
* add GET responses endpoints on router

* add GET responses endpoints on router

* add GET responses endpoints on router

* add DELETE responses endpoints on proxy

* fixes for testing GET, DELETE endpoints

* test_basic_responses api e2e
2025-04-24 17:34:26 -07:00
Ishaan Jaff d7847feba9 Add stubbed routes to pass initial auth tests 2025-03-13 16:43:25 -07:00
Ishaan Jaff db1f48bbfb responses_api 2025-03-12 20:38:05 -07:00
Ishaan Jaff e7e44694cc fix response api handling 2025-03-12 18:49:17 -07:00
Ishaan Jaff 2ca2ecacb5 fix responses_api 2025-03-12 17:39:07 -07:00
Ishaan Jaff 98718f6f09 working responses_api 2025-03-12 17:26:12 -07:00
Ishaan Jaff f2041762e6 add responses_api 2025-03-12 17:08:16 -07:00