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/happyhorse-1.0-t2v | Alibaba Bailian | Text-to-video | 15 seconds | Audio output, 720P/1080P |
bailian/happyhorse-1.0-i2v | Alibaba Bailian | Image-to-video | 15 seconds | Requires source image |
bailian/happyhorse-1.0-r2v | Alibaba Bailian | Reference-to-video | 15 seconds | Multiple reference images |
bailian/happyhorse-1.0-video-edit | Alibaba Bailian | Video edit | 15 seconds | Requires source video |
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:
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):
{ "id": "gen-xxxxxxxxxxxxxxxx", "status": "processing", "created": 1712000000 }
The video is not ready yet. You need to poll for the result.
Image-to-Video
For models that support image-to-video (e.g., bailian/wan2.6-i2v), include a source image:
curl -X POST https://api.chuizi.ai/v1/videos/generations \ -H "Authorization: Bearer ck-your-key-here" \ -H "Content-Type: application/json" \ -d '{ "model": "bailian/wan2.6-i2v", "prompt": "The person in the photo starts walking forward", "image": "https://example.com/photo.jpg", "duration": 5 }'
Reference-to-Video
HappyHorse reference-to-video accepts one or more reference images. Mention them in your prompt as Image 1, Image 2, etc.:
curl -X POST https://api.chuizi.ai/v1/videos/generations \ -H "Authorization: Bearer ck-your-key-here" \ -H "Content-Type: application/json" \ -d '{ "model": "bailian/happyhorse-1.0-r2v", "prompt": "Use Image 1 as the character and Image 2 as the outfit reference, cinematic camera move", "reference_image_urls": [ "https://example.com/character.jpg", "https://example.com/outfit.jpg" ], "duration": 5, "resolution": "720P" }'
Video Editing
HappyHorse video edit takes a public source video URL plus optional reference images:
curl -X POST https://api.chuizi.ai/v1/videos/generations \ -H "Authorization: Bearer ck-your-key-here" \ -H "Content-Type: application/json" \ -d '{ "model": "bailian/happyhorse-1.0-video-edit", "prompt": "Change the jacket to the striped sweater from Image 1", "video_url": "https://example.com/source.mp4", "reference_image_urls": ["https://example.com/sweater.png"], "resolution": "720P" }'
Async Polling
Video generation takes 30 seconds to several minutes depending on the model and duration. Poll the video result endpoint to check status:
curl https://api.chuizi.ai/v1/videos/gen-xxxxxxxxxxxxxxxx \ -H "Authorization: Bearer ck-your-key-here"
Processing (not ready yet)
{ "id": "gen-xxxxxxxxxxxxxxxx", "status": "processing", "created": 1712000000 }
Completed
{ "id": "gen-xxxxxxxxxxxxxxxx", "status": "succeeded", "model": "google/veo-3.1-fast", "url": "https://media.chuizi.ai/videos/gen-xxxxxxxxxxxxxxxx.mp4", "video_url": "https://media.chuizi.ai/videos/gen-xxxxxxxxxxxxxxxx.mp4", "cost": "0.15000000", "latency_ms": 45000, "created": 1712000000 }
Failed
{ "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
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() generation_id = result["id"] print(f"Video generation started: {generation_id}") # Step 2: Poll for completion while True: status_response = requests.get( f"https://api.chuizi.ai/v1/videos/{generation_id}", headers={"Authorization": "Bearer ck-your-key-here"}, ) status = status_response.json() if status["status"] == "succeeded": print(f"Video ready: {status.get('video_url') or status.get('url')}") break elif status["status"] == "failed": print(f"Generation failed: {status['error']['message']}") break else: print("Still processing... waiting 10 seconds") time.sleep(10)
Tips
- Set long timeouts. Video generation can take 30 seconds to 3 minutes. Your polling logic should wait at least 5 minutes before giving up.
- Poll every 10 seconds. Polling too frequently wastes resources. Every 10 seconds is sufficient.
- Check content policies. Video generation models have strict content moderation. Prompts that violate content policies will be rejected.
- Use the
fastorlitevariants for testing and prototyping. Switch to the full model for production quality. - Videos are billed per generation, not per token. Check the pricing page for per-model generation costs.
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