Video
Video generation usually takes time. Create a task, save the returned task ID, and use that ID to check the result.
Create a task
Section titled “Create a task”POST /v1/video/generationsAuthorization: Bearer OMROUTER_API_KEYContent-Type: application/jsoncurl --silent --show-error \ 'https://omrouter.com/v1/video/generations' \ --header "Authorization: Bearer $OMROUTER_API_KEY" \ --header 'Content-Type: application/json' \ --data "{ \"model\": \"$OMROUTER_MODEL_ID\", \"prompt\": \"A short establishing shot of a city at sunrise\" }"A successful submission returns a task identifier and initial status:
{ "task_id": "task-id", "status": "submitted"}Optional fields such as image input, duration, dimensions, frame rate, and seed depend on the model. Follow the selected video model’s documentation.
Poll a task
Section titled “Poll a task”GET /v1/video/generations/{task_id}Authorization: Bearer OMROUTER_API_KEYcurl --silent --show-error \ "https://omrouter.com/v1/video/generations/$TASK_ID" \ --header "Authorization: Bearer $OMROUTER_API_KEY"Terminal responses can contain a result URL or an error:
{ "task_id": "task-id", "status": "succeeded", "url": "https://...", "format": "mp4"}How often to check
Section titled “How often to check”- Check every few seconds instead of sending requests continuously.
- Set a maximum wait time.
- Stop checking after a
failedresult and show the error. - Do not automatically create another task; that can create a duplicate charge.
- Result URLs can expire, so save the result promptly.
Omrouter also provides OpenAI-style /v1/videos routes. If a client uses that endpoint, follow the client’s task parameter format.