AI API requests use a hardcoded 120s httpx timeout, which kills long running local/api model generations even while it still actively produces tokens.
Split the timeout (connect/write/pool short, read raised to 600s) as a quick fix, but it should be a config entry instead of hardcoded:
@staticmethod
async def do_request(url: str, headers: dict, payload: dict):
async def _fetch():
timeout = httpx.Timeout(connect=10, read=600, write=10, pool=10)
async with httpx.AsyncClient(timeout=timeout) as client:
return await client.post(url, headers=headers, json=payload)
Additionally, failures are logged with no useful message, logging.error(f"Request failed: {error}") relies on str(exception), which is empty for httpx timeout exceptions, so the terminal just shows Request failed: with nothing after it. Should log repr(error) (or the exception type name) instead so the actual failure reason is visible.
Sources: hanfor/ai_request/api_request_methods/standard_ai_api.py (timeout, line 18; error logging, line 77)
AI API requests use a hardcoded 120s httpx timeout, which kills long running local/api model generations even while it still actively produces tokens.
Split the timeout (connect/write/pool short, read raised to 600s) as a quick fix, but it should be a config entry instead of hardcoded:
Additionally, failures are logged with no useful message,
logging.error(f"Request failed: {error}")relies onstr(exception), which is empty for httpx timeout exceptions, so the terminal just showsRequest failed:with nothing after it. Should logrepr(error)(or the exception type name) instead so the actual failure reason is visible.Sources: hanfor/ai_request/api_request_methods/standard_ai_api.py (timeout, line 18; error logging, line 77)