feat: implement timeout handling and error messages for image generation

This commit is contained in:
2026-05-31 11:54:11 +02:00
parent c410c2e80d
commit 5794c96c21
4 changed files with 85 additions and 26 deletions
+2 -1
View File
@@ -12,9 +12,10 @@ def _backend(path: str) -> str:
def _api(method: str, path: str, *, token: str | None = None, **kwargs):
headers = kwargs.pop("headers", {})
timeout = kwargs.pop("timeout", 30)
if token:
headers["Authorization"] = f"Bearer {token}"
return httpx.request(method, _backend(path), headers=headers, timeout=30, **kwargs)
return httpx.request(method, _backend(path), headers=headers, timeout=timeout, **kwargs)
def _model_matches_modality(model: dict, modality: str) -> bool: