Video
Video generation is asynchronous because provider jobs can take from seconds
to several minutes. Submit a job, poll its status (or use a webhook), then
download the completed MP4 through the gateway.
Workflow
curl -X POST "https://api.llmapi.ai/v1/videos" \
-H "Authorization: Bearer $LLM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "kling-v2.1-master-t2v",
"prompt": "An eagle flying over snowy mountains at sunrise",
"seconds": 5
}'
The 202 Accepted response contains a job id. Poll it until status is
completed or failed, then download the content:
curl "https://api.llmapi.ai/v1/videos/VIDEO_ID" \
-H "Authorization: Bearer $LLM_API_KEY"
curl "https://api.llmapi.ai/v1/videos/VIDEO_ID/content" \
-H "Authorization: Bearer $LLM_API_KEY" \
--output video.mp4
The status response is OpenAI Sora-compatible and includes the requested model,
duration, size, progress, usage, and—after completion—the output dimensions and
provider URL:
{
"id": "abc123",
"object": "video",
"status": "completed",
"progress": 100,
"model": "kling-v2.1-master-t2v",
"seconds": "5",
"size": "1920x1080",
"usage": { "duration_seconds": 5 },
"format": "mp4",
"duration_seconds": 5,
"width": 1920,
"height": 1080
}
Create request fields
| Field |
Description |
model |
Video model ID. Use the catalog for supported operations and limits. |
prompt |
Text description of the scene and motion. Required by text-to-video and most image-to-video models. |
seconds |
Requested duration as a number or string, for example 5 or "5". |
size |
Resolution such as 1280x720; width and height can be used where supported. |
fps |
Requested frame rate, when supported. |
image_url |
Public source image for first-frame image-to-video. |
image_list |
Multiple reference images or start/end frames. |
video_url / video_list |
Reference or source videos for supported models. |
webhook |
HTTPS endpoint to receive the completed status payload. |
seed, quality, generate_audio |
Optional model-specific controls. |
For OpenAI-style input references, input_reference: { "image_url": "..." }
is accepted where supported. file_id references from the Files API are not
implemented for video generation; media URLs must be reachable by the provider.
For image-to-video or reference-to-video models, provide the model-supported
image_url, image_list, video_url, or video_list fields. You can provide
webhook in the create request instead of polling.
Notes
- The
/content route is available only after the job completes and streams the MP4 through LLM API.
- Polling is usually appropriate every 5–15 seconds for interactive jobs; do not assume that a job completes within a fixed time because provider queues vary.
- Media URLs supplied to providers must be reachable by the selected provider.
- Webhook delivery is at-least-once and payloads are unsigned; verify the job ID against an authenticated record and make receivers idempotent.
- The direct
video_url in a completed status is provider-hosted and may expire. Prefer downloading through /v1/videos/{id}/content when the file must be retained.
- A failed job includes an error object when available. Common causes are unsupported model parameters, inaccessible media, provider moderation, insufficient credits, or an upstream timeout.
- See the full Video Generation guide for model-specific inputs, durations, resolutions, and pricing. Provider fallback also applies to supported video jobs.
API operation: POST /v1/videos
API operation: GET /v1/videos/{id}
API operation: GET /v1/videos/{id}/content