Video Generation
https://api.tokenbay.com/v1/videosAsynchronous video generation: submit a task, poll its status, then download the result
One OpenAI-style entry point serves multiple video model families (HappyHorse, Veo 3.1, Seedance). The model field in the request body selects the target model; the rest of the body is model-specific.
Success and business failures both return HTTP 200. A successful response carries the task fields at the top level of the JSON body (no data wrapper); a failed call carries an error object ({ message, type, code }) instead.
Video routes disable failover retries by default because task creation is not idempotent.
Submit a Generation Task
Authenticates the Authorization header, then routes by the model field in the request body to the matching model.
Task creation is not idempotent, so failover retries are disabled for video routes.
/v1/videosCompatibility aliasPOST/v1/video/generationsRequest
schemaCommon top-level fields. The exact field set is defined per model family — see the HappyHorse, Veo 3.1, and Seedance pages.
modelstringRequiredVideo model ID. Selects the target model and task type. Documented families: HappyHorse, Veo 3.1, Seedance — see the model pages for their full parameter sets.
promptstringRequiredVideo description prompt. Length limits and language guidance vary by model.
image / images / input_reference / last_frame_image / reference_imagesstring | array<string>OptionalImage inputs for image-to-video, first/last-frame, and reference workflows. Field names and limits vary by model — see the model pages.
duration / secondsinteger | stringOptionalVideo duration in seconds. Supported tiers and defaults vary by model.
resolution / sizestringOptionalResolution tier, such as 720p or 1080p. Supported values vary by model.
aspect_ratiostringOptionalAspect ratio such as 16:9 or 9:16. HappyHorse and Seedance take ratio inside metadata instead.
negative_promptstringOptionalNegative prompt. Support depends on the model.
seedintegerOptionalRandom seed for best-effort reproducibility.
generate_audiobooleanOptionalWhether to generate audio; only applies to models that support it.
metadataobjectOptionalVendor-specific parameter container. The accepted keys are defined per model family — see the model pages.
Response
schemaSubmission receipt, returned at the top level of the JSON body.
idstringOptionalTask ID (task_xxx). Same value as task_id, kept for OpenAI SDK compatibility.
task_idstringOptionalTask ID used for polling and download.
objectstringOptionalAlways video.
modelstringOptionalModel name from the request.
statusstringOptionalInitial task status, usually QUEUED.
SUBMITTEDQUEUEDIN_PROGRESSSUCCESSFAILUREprogressintegerOptionalProgress 0–100, usually 0 right after submission.
created_atintegerOptionalTask creation time (Unix seconds).
Authentication uses the Authorization: Bearer sk-xxx header only; never put the API key in the request body.
Check for the error field in the body to tell success from failure — the HTTP status is 200 either way.
Query Task Detail
/v1/videos/{task_id}Compatibility aliasGET/v1/video/generations/{task_id}Response
schemaTask detail, returned at the top level of the JSON body.
task_idstringOptionalTask ID.
actionstringOptionalTask action, such as generate.
statusstringOptionalTask status. SUCCESS and FAILURE are terminal.
SUBMITTEDQUEUEDIN_PROGRESSSUCCESSFAILUREprogressstringOptionalProgress percentage string, such as "50%".
result_urlstringOptionalResult video download URL, present when status is SUCCESS. Has the form /v1/videos/{task_id}/content.
fail_reasonstringOptionalFailure reason, present when status is FAILURE.
quotaintegerOptionalQuota consumed by this task, filled after settlement.
submit_time / start_time / finish_timeintegerOptionalTask submission, execution start, and completion times (Unix seconds).
created_at / updated_atintegerOptionalRecord creation and last update times (Unix seconds).
errorobjectOptional
Task-level error detail, present for failed tasks.
error.messagestringOptionalError message.
error.codestringOptionalError code.
Status lifecycle: SUBMITTED → QUEUED → IN_PROGRESS → SUCCESS / FAILURE. SUCCESS and FAILURE are terminal.
Poll every 10–15 seconds and never below 5 seconds. Suggested overall timeout: 5 minutes for generation tasks, 8–10 minutes for video editing.
On FAILURE, read fail_reason (and the error object when present) for the cause.
Download the Result
/v1/videos/{task_id}/contentResponse
binaryvideo/mp4 byte stream.
The result_url returned by the query endpoint is exactly this URL — use either interchangeably.
Range requests are supported (HTTP 206) for resumable downloads and seek-while-playing in video players.
