Video Generation
Generate videos from text or images asynchronously -- submit a prompt, poll for progress, and receive a permanent CDN-hosted video URL.
Supported Models
| Model | Provider | Type | Max Duration | Notes |
|---|---|---|---|---|
google/veo-3.1 | Google Vertex | Text-to-video | 8 seconds | Highest quality |
google/veo-3.1-fast | Google Vertex | Text-to-video | 8 seconds | Faster generation |
google/veo-3.1-lite | Google Vertex | Text-to-video | 8 seconds | Most affordable |
bedrock/nova-reel-1.1 | Amazon Bedrock | Text-to-video | 6 seconds | |
bedrock/nova-reel-1.0 | Amazon Bedrock | Text-to-video | 6 seconds | |
bailian/wan2.7-t2v | Alibaba Bailian | Text-to-video | 5 seconds | |
bailian/wan2.6-t2v | Alibaba Bailian | Text-to-video | 5 seconds | |
bailian/wan2.6-i2v | Alibaba Bailian | Image-to-video | 5 seconds | Requires source image |
Text-to-Video
Submit a video generation request with a text prompt:
terminal
bash
curl -X POST https://api.chuizi.ai/v1/videos/generations \ -H "Authorization: Bearer ck-your-key-here" \ -H "Content-Type: application/json" \ -d '{ "model": "google/veo-3.1", "prompt": "A golden retriever running through a sunlit meadow, slow motion, cinematic", "duration": 5 }'
Response (immediate):
config.json
json
{ "id": "gen-xxxxxxxxxxxxxxxx", "status": "processing", "created": 1712000000 }
The video is not ready yet. You need to poll for the result.
Async Polling
Video generation takes 30 seconds to several minutes depending on the model and duration. Poll the Generation API to check status:
terminal
bash
curl https://api.chuizi.ai/v1/generation?id=gen-xxxxxxxxxxxxxxxx \ -H "Authorization: Bearer ck-your-key-here"
Processing (not ready yet)
config.json
json
{ "id": "gen-xxxxxxxxxxxxxxxx", "status": "processing", "created": 1712000000 }
Completed
config.json
json
{ "id": "gen-xxxxxxxxxxxxxxxx", "status": "completed", "created": 1712000000, "output": { "video_url": "https://media.chuizi.ai/videos/gen-xxxxxxxxxxxxxxxx.mp4" }, "usage": { "duration_seconds": 5 }, "x_chuizi": { "generation_id": "gen-xxxxxxxxxxxxxxxx", "cost": "0.15000000", "latency_ms": 45000 } }
Failed
config.json
json
{ "id": "gen-xxxxxxxxxxxxxxxx", "status": "failed", "error": { "message": "Content policy violation", "type": "invalid_request_error" } }
CDN Delivery
Generated videos are stored on media.chuizi.ai (Cloudflare R2 CDN). URLs are permanent and do not expire. You can use them directly in your application or download them.
Code Examples
example.py
python
import time import requests from openai import OpenAI client = OpenAI( base_url="https://api.chuizi.ai/v1", api_key="ck-your-key-here", ) # Step 1: Submit the video generation request response = requests.post( "https://api.chuizi.ai/v1/videos/generations", headers={ "Authorization": "Bearer ck-your-key-here", "Content-Type": "application/json", }, json={ "model": "google/veo-3.1-fast", "prompt": "A cat sitting on a windowsill watching rain fall outside, cozy atmosphere", "duration": 5, }, ) result = response.json() gen_id = result["id"] print(f"Video generation started: {gen_id}") # Step 2: Poll for completion while True: status_response = requests.get( f"https://api.chuizi.ai/v1/generation?id={gen_id}", headers={"Authorization": "Bearer ck-your-key-here"}, ) status = status_response.json() if status["status"] == "completed": print(f"Video ready: {status['output']['video_url']}") break elif status["status"] == "failed": print(f"Generation failed: {status['error']['message']}") break else: print("Still processing... waiting 10 seconds") time.sleep(10)
Next Steps
- Video Generations API — full API reference for the video endpoint
- Image Generation — generate still images from text prompts
- Pricing — video generation costs per model