# Video

## Generate Video

> Generates videos from text prompts or images. Supports 18+ models from Google, OpenAI, Kling AI, Runway, Pollo, and others. Asynchronous generation — poll POST /api/v1/getAsyncResponse with taskId to retrieve results. The same request body (model, prompt, image, length, resolution) can also be sent to POST /api/v1/chat/completions when using a video model.

```json
{"openapi":"3.1.0","info":{"title":"FastRouter API Reference","version":"1.0.0"},"tags":[{"name":"Video","description":"Generate videos from text prompts or images using video generation models."}],"servers":[{"url":"https://api.fastrouter.ai","description":"Production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","description":"FastRouter API Key. Get yours at https://fastrouter.ai\n\nFormat: `Authorization: Bearer YOUR_API_KEY`"}},"responses":{"UnauthorizedError":{"description":"Invalid Credentials - Your API key is invalid, disabled, or your OAuth session has expired. Check your credentials.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"status":{"type":"integer"}}}}}}}},"RateLimitError":{"description":"Rate Limited - You have exceeded your request limits (TPM/RPM). Slow down or increase your limits.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"status":{"type":"integer"}}}}}}}}}},"paths":{"/api/v1/videos":{"post":{"operationId":"createVideo","tags":["Video"],"summary":"Generate Video","description":"Generates videos from text prompts or images. Supports 18+ models from Google, OpenAI, Kling AI, Runway, Pollo, and others. Asynchronous generation — poll POST /api/v1/getAsyncResponse with taskId to retrieve results. The same request body (model, prompt, image, length, resolution) can also be sent to POST /api/v1/chat/completions when using a video model.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["model","prompt"],"properties":{"model":{"type":"string","description":"Video generation model in provider/model format. See documentation for full list of supported models.","enum":["google/veo2","google/veo3","google/veo3-fast","openai/sora-2","openai/sora-2-pro","kling-ai/kling-v1-6","kling-ai/kling-v2","kling-ai/kling-v2-1","kling-ai/kling-v2-1-master","runway/runway-gen-3-turbo","runway/runway-gen-4-turbo","pika/pika-v2-2","minimax/minimax-hailuo-02","bytedance/seedance","bytedance/seedance-pro","pollo/pollo-v1-6","vidu/vidu-v2-0","vidu/vidu-q1"]},"prompt":{"type":"string","description":"Natural language description of the video scene to generate"},"image":{"type":"string","format":"uri","description":"URL of an input image for image-to-video generation. Only URLs supported (no base64). Formats: JPG, PNG, JPEG. Aspect ratio must be 1:4 to 4:1. Required for some models."},"length":{"type":"integer","enum":[4,5,6,8,10,12],"description":"Duration of the video in seconds. Supported values vary by model: 4, 5, 6, 8, 10, or 12."},"seconds":{"type":"integer","enum":[4,8,12],"description":"Duration in seconds (used by Sora models). Supported: 4, 8, or 12."},"resolution":{"type":"string","enum":["480p","720p","1080p"],"description":"Output video resolution"},"aspectRatio":{"type":"string","enum":["16:9","9:16","4:3","3:4","1:1","5:3","3:5"],"description":"Width-to-height ratio of the video frame"},"size":{"type":"string","enum":["720x1280","1280x720","1024x1792","1792x1024"],"description":"Video dimensions (used by Sora models)"},"mode":{"type":"string","enum":["std","pro"],"description":"Generation style/mode (if supported by model)"},"seed":{"type":"integer","description":"Random seed for deterministic output (optional; useful for reproducibility)"},"generateAudio":{"type":"boolean","description":"Generate audio track for the video (supported by some models)"}}}}}},"responses":{"200":{"description":"Video generation task queued successfully","content":{"application/json":{"schema":{"oneOf":[{"type":"object","description":"Response format for most models (Veo, Kling, etc.)","properties":{"chat_id":{"type":"string"},"model":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"},"data":{"type":"object","properties":{"taskId":{"type":"string","description":"Use this to poll for completion"},"status":{"type":"string","enum":["waiting","queued","processing"]}}},"usage":{"type":"object","properties":{"user_key_credits_used":{"type":"number"},"credits_used":{"type":"number"},"provider":{"type":"string"}}}}},{"type":"object","description":"Response format for Sora models","properties":{"id":{"type":"string","description":"Video ID - use this to poll for completion"},"chat_id":{"type":"string"},"object":{"type":"string"},"created_at":{"type":"integer"},"status":{"type":"string","enum":["queued","in_progress","completed"]},"model":{"type":"string"},"seconds":{"type":"string"},"size":{"type":"string"},"usage":{"type":"object"}}}]}}}},"400":{"description":"Bad Request - Invalid parameters or model"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"429":{"$ref":"#/components/responses/RateLimitError"},"500":{"description":"Internal Server Error"}}}}}}
```

## Get Async Response

> Polls for asynchronous video generation results. Poll with the \`taskId\` returned from POST /api/v1/videos until status is \`succeed\` or \`completed\`, then download from the provided URL.\
> \
> \*\*taskId and model rules:\*\*\
> \- If \`taskId\` includes a provider prefix (e.g. \`pol\_\` for Pollo), then \*\*model is optional\*\*.\
> \- If \`taskId\` has no provider prefix, then \*\*model is required\*\* and must match the model used in the original /videos request.

```json
{"openapi":"3.1.0","info":{"title":"FastRouter API Reference","version":"1.0.0"},"tags":[{"name":"Video","description":"Generate videos from text prompts or images using video generation models."}],"servers":[{"url":"https://api.fastrouter.ai","description":"Production API"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key","description":"FastRouter API Key. Get yours at https://fastrouter.ai\n\nFormat: `Authorization: Bearer YOUR_API_KEY`"}},"responses":{"UnauthorizedError":{"description":"Invalid Credentials - Your API key is invalid, disabled, or your OAuth session has expired. Check your credentials.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"status":{"type":"integer"}}}}}}}},"RateLimitError":{"description":"Rate Limited - You have exceeded your request limits (TPM/RPM). Slow down or increase your limits.","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string"},"type":{"type":"string"},"code":{"type":"string"},"status":{"type":"integer"}}}}}}}}}},"paths":{"/api/v1/getAsyncResponse":{"post":{"operationId":"getAsyncResponse","tags":["Video"],"summary":"Get Async Response","description":"Polls for asynchronous video generation results. Poll with the `taskId` returned from POST /api/v1/videos until status is `succeed` or `completed`, then download from the provided URL.\n\n**taskId and model rules:**\n- If `taskId` includes a provider prefix (e.g. `pol_` for Pollo), then **model is optional**.\n- If `taskId` has no provider prefix, then **model is required** and must match the model used in the original /videos request.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["taskId"],"properties":{"taskId":{"type":"string","description":"The taskId returned from POST /api/v1/videos. When it includes a provider prefix (e.g. pol_ for Pollo), model can be omitted."},"model":{"type":"string","description":"The video model used in the original /videos request. Required when taskId has no provider prefix; optional when taskId has a provider prefix (e.g. pol_)."}}}}}},"responses":{"200":{"description":"Video generation status or completed video","content":{"application/json":{"schema":{"oneOf":[{"type":"object","description":"Completed response (most models)","properties":{"code":{"type":"string"},"message":{"type":"string"},"data":{"type":"object","properties":{"taskId":{"type":"string"},"generations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"createdDate":{"type":"string"},"updatedDate":{"type":"string"},"status":{"type":"string","enum":["waiting","processing","succeed","failed"]},"failMsg":{"type":"string"},"url":{"type":"string","format":"uri","description":"Downloadable video URL"},"mediaType":{"type":"string"}}}}}}}},{"type":"object","description":"Sora model response","properties":{"id":{"type":"string"},"chat_id":{"type":"string"},"object":{"type":"string"},"created_at":{"type":"integer"},"status":{"type":"string","enum":["queued","in_progress","completed","failed"]},"progress":{"type":"integer","description":"Completion percentage (0-100)"},"completed_at":{"type":"integer"},"model":{"type":"string"},"seconds":{"type":"string"},"size":{"type":"string"},"usage":{"type":"object"}}}]}}}},"400":{"description":"Bad Request - Invalid taskId or model"},"401":{"$ref":"#/components/responses/UnauthorizedError"},"404":{"description":"Not Found - Invalid taskId or expired result"},"429":{"$ref":"#/components/responses/RateLimitError"},"500":{"description":"Internal Server Error"}}}}}}
```
