Add resolution parameter to video generation requests and implement video status polling endpoint

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-27 19:07:27 +02:00
parent 3b807c0f75
commit 98d59de2d1
4 changed files with 33 additions and 0 deletions
+6
View File
@@ -81,6 +81,7 @@ async def generate_video(
prompt: str,
duration_seconds: int | None = None,
aspect_ratio: str = "16:9",
resolution: str | None = None,
) -> dict[str, Any]:
"""Request text-to-video generation via OpenRouter."""
base_url = os.getenv("OPENROUTER_BASE_URL", OPENROUTER_BASE_URL)
@@ -91,6 +92,8 @@ async def generate_video(
}
if duration_seconds is not None:
payload["duration_seconds"] = duration_seconds
if resolution is not None:
payload["resolution"] = resolution
async with httpx.AsyncClient(timeout=120) as client:
resp = client.build_request(
"POST", f"{base_url}/videos", headers=_headers(), json=payload
@@ -106,6 +109,7 @@ async def generate_video_from_image(
prompt: str,
duration_seconds: int | None = None,
aspect_ratio: str = "16:9",
resolution: str | None = None,
) -> dict[str, Any]:
"""Request image-to-video generation via OpenRouter."""
base_url = os.getenv("OPENROUTER_BASE_URL", OPENROUTER_BASE_URL)
@@ -117,6 +121,8 @@ async def generate_video_from_image(
}
if duration_seconds is not None:
payload["duration_seconds"] = duration_seconds
if resolution is not None:
payload["resolution"] = resolution
async with httpx.AsyncClient(timeout=120) as client:
resp = client.build_request(
"POST", f"{base_url}/videos", headers=_headers(), json=payload