https://api.yelinai.com/v1/videosWorkflow: Three steps (Create Task → Query Status → Get Video)Advantages: More Stable | Task Queue | Long Tasks Support | No Charge on Failure
Why Choose Async API?
Higher Stability
Based on task queue, avoids long connection timeout issuesNo Charge on Failure ⭐
Major Advantage: No charge for any failure- ✓ Content violation → No charge
- ✓ Queue timeout → No charge
- ✓ Generation failed → No charge
Flexible Polling
Query task status and progress anytimeBatch Processing
Suitable for batch generation and background tasksSync vs Async Comparison
Recommend using Async API, especially in production environments or when batch generating videos for better stability.
Quick Start
Async workflow consists of three steps: 1 Create Video Task POST request to create task, get task ID 2 Query Task Status Periodically poll for generation progress 3 Download Video Get video file after task completesComplete Example
Step 1: Create Task (Text-to-Video) Step 1: Create Task (Image-to-Video - Single Image) Step 1: Create Task (Image-to-Video - First/Last Frame) Step 2: Query Status Step 3: Get VideoAPI Endpoints
1. Create Video Task
POSThttps://api.yelinai.com/v1/videosCreate a new video generation task
Request Parameters
Available Models
Model Naming Convention:
landscape= Landscape (16:9)fast= Fast version (cheaper)fl= Supports frame-to-video (image-to-video)
-fl suffix) support uploading 2 images:
- First image: Video start frame
- Second image: Video end frame
Response Fields
2. Query Task Status
GEThttps://api.yelinai.com/v1/videos/{video_id}Query the current status of a video generation task
Path Parameters
Response Fields
Task Status Description
3. Get Video Content
GEThttps://api.yelinai.com/v1/videos/{video_id}/contentGet the actual content of a completed video
Path Parameters
Response Fields
ImportantVideo URLs are typically valid for 24 hours. Please download and save locally promptly!
Complete Code Examples
Python Example (with Polling Logic)
JavaScript/Node.js Example
Best Practices
Polling Interval Settings Recommended polling interval: 5-10 seconds- Video generation typically takes 2-5 minutes
- 5-10 seconds provides timely feedback
- Avoids excessive requests
- Task timeout doesn’t auto-cancel
- Can continue querying the same video_id later
- Tasks are valid for 24 hours
- ✓ Network error → Retry
- ✓ Service busy (503) → Retry
- ✗ Content violation → Don’t retry, modify prompt
- ✗ Insufficient balance → Don’t retry, top up first
- Task creation: Can be highly concurrent (10-30)
- Status query: Recommend concurrency ≤ 10
- Video download: Recommend concurrency ≤ 5
Pricing
Async API has same pricing as Sync API, charged per request.
Billing Rules:
- ✓ Only charge when video successfully generates (status = “completed”)
- ✗ Failure, timeout, cancellation no charge
- ✗ Content safety failure also no charge (major difference from sync API ⭐)
- ✗ Status queries are free
FAQ
How long are tasks valid? Task validity: 24 hours- Can query task status anytime within 24 hours after creation
- Video files are stored for 24 hours after generation completes
- Tasks and videos are automatically cleaned up after 24 hours
- Download immediately after video generation completes
- Don’t rely on server for long-term storage
- Incorrect video_id - Check if copied completely
- Task expired - Over 24 hours
- Network issue - Retry the request
- Different endpoints
- Different workflows
- Same pricing
- Share the same API Key and balance
- Quick testing → Use Sync API
- Production → Use Async API (more stable)
- Batch generation → Use Async API
Error Handling
Common Error Codes
Error Response Format
Technical Support
Need Help?
If you have questions, feel free to contact us:- Email: threezhang.cn@gmail.com
- WeChat: Kikivivikids
- Telegram: https://t.me/laozhang_cn
- Docs: