-
Notifications
You must be signed in to change notification settings - Fork 13
SDK disables httpx's default timeout #72
Copy link
Copy link
Open
Description
When timeout_ms is not explicitly configured (the default), the SDK passes timeout=None to httpx.Client.build_request(), which overrides httpx's built-in Timeout(5.0) default and disables all timeouts for the request. This causes indefinite hangs when TCP connections stall during response body reads.
Root cause
timeout = timeout_ms / 1000 if timeout_ms is not None else NoneThis None is then passed to:
client.build_request(
...,
timeout=timeout, # None → disables httpx timeout entirely
)In httpx, an explicit timeout=None means "no timeout" — it does not mean "use the client default." The correct sentinel for "no override" is httpx.USE_CLIENT_DEFAULT.
Impact
sdk_configuration.timeout_msdefaults toNone- Every request made without an explicit
timeout_mshas no read timeout - If a TCP connection stalls (e.g., CloudFlare → provider network issue), the request blocks forever
- We've reproduced this at ~5% rate against
nvidia/nemotron-3-super-120b-a12bvia DeepInfra — requests hang indefinitely duringreceive_response_bodywhile OpenRouter logs show the generation completed normally
Reproduction
import openrouter
sdk = openrouter.OpenRouter(api_key="...")
print(sdk.sdk_configuration.timeout_ms) # None
# This request has NO timeout — will hang forever on TCP stall
response = sdk.chat.send(messages=[...], model="nvidia/nemotron-3-super-120b-a12b")Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels