Skip to content

Fix: Responses API now respects global request_timeout #12211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

colesmcintosh
Copy link
Collaborator

Title

Fix: Responses API now respects global request_timeout

Relevant issues

Fixes LIT-272

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🐛 Bug Fix

Changes

This PR fixes an issue where the responses API endpoints were not respecting the global request_timeout configuration value and were timing out after 30 seconds instead.

Problem

  • The responses API was timing out after 30 seconds even when request_timeout in litellm_settings was set to a larger value
  • This was inconsistent with other API endpoints that properly respect the global timeout

Solution

  • Modified ProxyBaseLLMRequestProcessing.base_process_llm_request to check for litellm.request_timeout when user_request_timeout is None
  • This ensures the responses API uses the configured global timeout value, matching the behavior of other endpoints

Testing

Added comprehensive tests in tests/proxy_unit_tests/test_responses_api_timeout.py:

  • Test that request_timeout from config is properly propagated
  • Test that explicit timeouts take precedence over global settings
  • Test the timeout fallback logic in ProxyBaseLLMRequestProcessing

All tests pass:

tests/proxy_unit_tests/test_responses_api_timeout.py::test_common_request_processing_explicit_timeout PASSED [ 25%]
tests/proxy_unit_tests/test_responses_api_timeout.py::test_common_request_processing_uses_litellm_timeout PASSED [ 50%]
tests/proxy_unit_tests/test_responses_api_timeout.py::test_responses_api_timeout_from_config PASSED [ 75%]
tests/proxy_unit_tests/test_responses_api_timeout.py::test_responses_api_timeout_not_overwritten PASSED [100%]

- Modified ProxyBaseLLMRequestProcessing to use litellm.request_timeout when user_request_timeout is None
- Added comprehensive tests to verify timeout behavior in responses API
- Ensures consistency with other API endpoints that already respect global timeout settings

This fixes the issue where responses API was timing out at 30 seconds instead of respecting the configured global request_timeout value.
Copy link

vercel bot commented Jul 1, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 1, 2025 8:19pm

Copy link
Contributor

@ishaan-jaff ishaan-jaff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewed

@@ -303,6 +301,13 @@ async def common_processing_pre_call_logic(
self.data["temperature"] = user_temperature
if user_request_timeout:
self.data["request_timeout"] = user_request_timeout
elif (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the wrong place. It should be on responses/main.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants