https://api.yelinai.com/v1/videosCall Method: Three steps (Create Task → Query Status → Get Video)Advantages: More Stable | Task Queue | Long-running Tasks Support
Important Difference - Image-to-Video Upload MethodAsync API differs significantly from Sync API for image-to-video:
If you have an image URL: Download it locally first, then upload via Async API.Example Comparison:
Why Choose Async API?
Higher Stability
Task queue based, avoiding long connection timeout issuesNo Charge on Failure ⭐
Key Advantage: No charges for failures of any kind- ✓ Content violation → No charge
- ✓ Queue timeout → No charge
- ✓ Generation failure → No charge
Flexible Polling
Query task status and progress anytimeParameterized Control
Specify resolution and duration via parameters, more flexibleSync vs Async Comparison
Recommended to use Async API, especially in production environments or when batch generating videos, for better stability.
Quick Start
Async calling consists of three steps: 1 Create Video Task POST request to create task, get task ID 2 Query Task Status Periodically poll to check generation progress 3 Download Video Retrieve video file after task completesComplete Example
Step 1: Create Task (Text-to-Video) Step 1: Create Task (Image-to-Video) Step 2: Query Status Step 3: Download VideoAPI Endpoints
1. Create Video Task
POSThttps://api.yelinai.com/v1/videosCreate a new video generation task
Request Parameters
Model Selection
sora-2: Base model, 720P resolution, extremely high stability, $0.15/callsora-2-pro: HD model, 1080P resolution, generation time ~10 minutes, $0.8/call
Response Fields
2. Query Task Status
GEThttps://api.yelinai.com/v1/videos/{video_id}Query current status and progress of video generation task
Path Parameters
Response Fields
Task Status
3. Get Video Content
GEThttps://api.yelinai.com/v1/videos/{video_id}/contentDownload completed video file
Path Parameters
Response
Returns binary stream of video file (MP4 format) Important NoticeVideo files are stored for 24 hours only. Please download and save to local storage promptly!Complete Code Examples
Python Example (with Polling Logic)
JavaScript/Node.js Example
Best Practices
Polling Interval Recommended polling interval: 3-5 seconds- Video generation typically takes 2-5 minutes
- 3-5 seconds provides timely progress feedback
- Avoids excessive requests
- Task timeout doesn’t auto-cancel
- Can continue querying same video_id later
- Task validity period is 24 hours
- ✓ Network errors → Retry
- ✓ Service busy (503) → Retry
- ✗ Content violation → Don’t retry, modify prompt
- ✗ Insufficient balance → Don’t retry, recharge first
- Creating tasks: High concurrency OK (10-30)
- Querying status: Recommended concurrency ≤ 10
- Downloading videos: Recommended concurrency ≤ 5
Pricing
Async API has exactly the same pricing as Sync API, billed per call.
Billing Rules:
- ✓ Charged only when video successfully generated (status = “completed”)
- ✗ Failed, timeout, cancelled not charged
- ✗ Content safety issues also not charged (important difference from Sync API⭐)
- ✗ Status queries not charged
FAQ
How long is task validity? Task validity: 24 hours- After creating task,
expires_atfield shows expiration time - Can query task status anytime within 24 hours
- After video generation completes, file is stored for 24 hours
- After 24 hours, task and video will be automatically cleaned
- Download video immediately after completion
- Don’t rely on server for long-term storage
- Once created, task will auto-queue for execution
- If no longer needed, simply ignore it
- Incomplete tasks won’t be charged
- Wait for task to naturally complete or fail
- Task auto-expires after 24 hours
- Incorrect video_id - Check if fully copied
- Task expired - Over 24 hours
- Network issues - Retry request
- Different endpoints
- Different calling methods
- Same pricing
- Share same API Key and balance
- Quick testing → Use sync API
- Production environment → Use async API (more stable)
- Batch generation → Use async API
- Normal - Some processing stages update slowly
- Queue waiting - May be queued during peak hours
- Task stuck - Rare cases where task may get stuck
- Continue waiting 5-10 minutes
- If no change after 10 minutes, contact support
- Provide video_id for troubleshooting
- ✗ Image URLs
- ✗ Base64 encoding
- ✗ Online image links
multipart/form-data format, supporting only local file streams.
What image formats are supported?
Supported formats:
- ✓ JPG / JPEG
- ✓ PNG
- ✓ WebP
- File size: < 5MB (recommended)
- Resolution: Recommended 1280x720 or similar ratio
- Source: Must be local file
Billing notes:
- Image-to-video and text-to-video cost the same
- Only charged when successfully generated
- No charge on failure (including format errors, content violations, etc.)
- Typical time: 2-5 minutes
- Factors: Video length, queue size, complexity
- Recommended < 5MB: Fast upload, fast processing
- Large images: Only affects upload time (seconds), no significant impact on generation time
Error Handling
Common Error Codes
Error Response Format
Technical Support
Need Help?
Contact us if you have any questions:- Email: threezhang.cn@gmail.com
- WeChat: Kikivivikids
- Telegram: https://t.me/laozhang_cn
- Documentation: