Video generation
End-to-end flow for creating, polling, and receiving video generations.
This guide covers the full video generation lifecycle: creating a request, polling for status, receiving webhooks, and handling errors.
Flow overview
Video generation is asynchronous:
- Create —
POST /v1/responsesreturns anidandstatus: "queued". - Poll —
GET /v1/responses/{id}untilstatusiscompletedorfailed. - Webhook (optional) — receive
video.generation.completedevents instead of polling.
For a minimal walkthrough, see the Quickstart. For webhook setup, see Webhooks.
Token billing
HyperFrames generations bill the orchestration LLM by token usage:
- Rates are listed per million tokens on Engines and via
GET /v1/engines. - Token usage is collected when the orchestration agent finishes composing your project.
- Credits are deducted after orchestration, before render and upload complete.
- The
usagefield on completed responses reflects token counts andcost_usd.
You need a positive credit balance to create a request.
Create: POST /v1/responses
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Orchestration LLM id (e.g. moonshotai/kimi-k2.5). Listed on GET /v1/engines. |
input | string | array | Yes | Prompt text or input message items with text, image, or video content parts. |
instructions | string | No | System-level guidance, separate from conversation input. |
width | number | No | Canvas width in pixels. Default 1080. |
height | number | No | Canvas height in pixels. Default 1920. |
aspectRatio | string | No | Aspect ratio (e.g. 16:9). |
provider | object | No | Provider routing (default: framerate). See Provider routing. |
Example
curl -X POST https://api.pipevideo.co/v1/responses \
-H "Authorization: Bearer pv_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"model": "moonshotai/kimi-k2.5",
"input": "A cat walking on a beach at sunset",
"provider": { "order": ["framerate"] }
}'Response
{
"id": "gen_abc123xyz",
"object": "response",
"status": "queued",
"model": "moonshotai/kimi-k2.5",
"engine": "hyperframes",
"provider": "framerate",
"created_at": 1709827200,
"output": [
{
"type": "message",
"id": "gen_abc123xyz_msg",
"role": "assistant",
"status": "in_progress",
"content": []
}
],
"output_video_url": null
}Poll: GET /v1/responses/{id}
| Field | Description |
|---|---|
status | queued, in_progress, completed, or failed |
output_video_url | Video URL when completed |
usage | Token counts and cost_usd when available |
error | { code, message } when failed |
latency_ms | End-to-end latency when completed |
Polling recommendations
- Poll every 2–5 seconds. Generation typically takes 30 seconds to several minutes.
- Stop after 10–15 minutes if still queued or in progress.
- For production, use webhooks instead of polling.
Status transitions
queued → in_progress → completed
→ failedTransitions are one-way.
Error handling
HTTP errors
| Status | When |
|---|---|
401 | Invalid or missing API key |
429 | Rate limit exceeded |
400 | Invalid model, insufficient balance, malformed input |
404 | Generation not found |
500 | Server error |
Generation failures
| Cause | Description |
|---|---|
| Insufficient credits | Balance is zero or charge failed |
| Provider failure | Video orchestration or render pipeline error |
| Engine not available | Engine not supported on selected provider |
Providers
Pipevideo routes generation to an external video orchestration provider. Pipevideo handles credits, organization scoping, and customer webhooks. See Provider routing and Framerate.
Next steps
- Responses API — full request/response schema
- Multimodal inputs — reference images and video
- Webhooks — push notifications for completions