Skip to content

Commit 00448ef

Browse files
highland0971OpenClaw Bot
andauthored
fix: add timeout parameter to OpenAIVLM client (#1208)
Problem: - OpenAI Python SDK uses DEFAULT_TIMEOUT with connect=5.0 seconds - Some API endpoints (like DashScope) require >5s to establish connection - This causes ConnectTimeout errors with retries, taking ~15-16 seconds Solution: - Add timeout parameter (default=60.0) to _build_openai_client_kwargs - Pass timeout to both Azure and non-Azure OpenAI client constructors Fixes VLM timeout issues when connecting to slow-response endpoints. Co-authored-by: OpenClaw Bot <bot@openclaw.ai>
1 parent 6e5d125 commit 00448ef

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

openviking/models/vlm/backends/openai_vlm.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def _build_openai_client_kwargs(
3535
api_base: str,
3636
api_version: str | None,
3737
extra_headers: Dict[str, str] | None,
38+
timeout: float = 60.0,
3839
) -> Dict[str, Any]:
3940
"""Build kwargs dict shared by sync and async OpenAI/Azure client constructors."""
4041
if provider == "azure":
@@ -44,9 +45,11 @@ def _build_openai_client_kwargs(
4445
"api_key": api_key,
4546
"azure_endpoint": api_base,
4647
"api_version": api_version or DEFAULT_AZURE_API_VERSION,
48+
"timeout": timeout,
4749
}
4850
else:
4951
kwargs = {"api_key": api_key, "base_url": api_base}
52+
kwargs["timeout"] = timeout
5053
if extra_headers:
5154
kwargs["default_headers"] = extra_headers
5255
return kwargs

0 commit comments

Comments
 (0)