llmboxDocumentationSign in
API · Video

Video

POST /v1/videos — asynchronous video generation: create a job, poll its status, download the video.

Video is generated asynchronously: you create a job, poll its status and download the finished video. It works only with video models from the catalog; in the examples below put their ID in place of VIDEO_MODEL_ID.

The operator may turn off intake of new jobs: then POST /v1/videos answers 503 with the code video_disabled. Jobs already created can still be polled and finished videos downloaded.

1. Create a job

bash
curl https://llmbox.cc/v1/videos \
  -H "Authorization: Bearer $LLMBOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "VIDEO_MODEL_ID",
    "prompt": "Waves crashing against a lighthouse at sunset",
    "seconds": 8
  }'

The response is a 202 with the job object:

json
{"id": "vid_...", "object": "video", "model": "VIDEO_MODEL_ID", "status": "queued", "progress": 0, "created_at": 1790000000}

2. Poll the status

bash
curl https://llmbox.cc/v1/videos/vid_... \
  -H "Authorization: Bearer $LLMBOX_API_KEY"

Poll every few seconds until status becomes completed or failed. The intermediate statuses are queued and in_progress.

json
{"id": "vid_...", "object": "video", "status": "completed", "seconds": "8", "data": [{"url": "https://.../v1/videos/vid_.../content"}]}

A failed job has status: "failed" and error.code: "video_generation_failed"; it is not billed.

3. Download the video

The link in data[0].url points to GET /v1/videos/{id}/content. Download it with the same key:

bash
curl -L https://llmbox.cc/v1/videos/vid_.../content \
  -H "Authorization: Bearer $LLMBOX_API_KEY" \
  -o video.mp4

Before the job completes, this address returns 404 not_found.

Specifics

  • Billing happens once, when the job completes: the price of the video for its conditions (see below) — a per-video part plus a per-second part × the video length from the provider's response (the requested length if it did not report it). The charge never exceeds the job's reserve.
  • Reserve. When a job is created, the price of the video at your prices for the chosen conditions and length is reserved on your balance. If no length is given, the model's default length is used — and it is what gets generated. A job is created only if the free remainder (the balance minus the reserves of requests in progress and of unfinished video jobs) covers the whole reserve; otherwise it gets 402 insufficient_quota with the reserve and the amount missing, and the key spend limit gives 403 spend_limit_exceeded. The reserve is held until the job completes or fails.
  • Parameters: prompt, seconds (or duration, duration_seconds), resolution (or mode), generate_audio, aspect_ratio, negative_prompt, seed; references — image, images, video, input_reference. The request body limit is 90 MiB.
  • A job is visible only to keys of your account; someone else's id returns 404 not_found.
  • Video jobs are not subject to the general concurrent request limit; creating a job with a body over 5 MiB is limited separately (503 overloaded, see Limits).

Video conditions

The price of a video depends on its conditions: resolution, audio, length. The model page in the catalog shows a price “≈ $X / video” — the price of a typical video (the model's default resolution, length and audio) — and below it the full table of conditions with the allowed values and prices. The request accepts:

  • resolution — the resolution. For models whose tier parameter is called mode (for example, std and pro), pass mode instead: the model page says which parameter it needs. The other one of the pair is ignored: for a model with mode the resolution field is not used, and vice versa;
  • generate_audio — a boolean, with audio or without;
  • seconds — the length as an integer number of seconds from 1 to 3600. You can pass duration or duration_seconds instead, but only one field — two at once return 400 invalid_request with param: "seconds".

If a parameter is not passed, the model's default value is used — it is shown on the model page. size is not accepted: set the resolution with resolution (or mode).

bash
curl https://llmbox.cc/v1/videos \
  -H "Authorization: Bearer $LLMBOX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "VIDEO_MODEL_ID",
    "prompt": "Waves crashing against a lighthouse at sunset",
    "resolution": "1080p",
    "generate_audio": true,
    "seconds": 8
  }'

The job object in the create and poll responses includes the applied resolution (or mode), generate_audio and seconds.

Condition check errors are 400 with type: "invalid_request_error":

codeWhen
unsupported_video_optionsThis model has no price for the combination of resolution (mode), audio, length and operation (text to video, image to video or video to video). Image to video — when the request carries image, images or input_reference; video to video — when it carries video or an input_reference that is a link to a video file. The message lists the supported values.
invalid_resolutionresolution (or mode) is not a string.
unsupported_parameterparam is size: it is not accepted, use resolution or mode.
invalid_requestgenerate_audio is not a boolean; the length is not an integer from 1 to 3600; two length fields were passed.

If the selected options cannot be served right now, the response is 503 video_options_unavailable: choose other options.