Async Endpoint:
https://api2.laozhang.ai/v1/videosWorkflow: Three steps (Create Task → Query Status → Get Video)Advantages: More Stable | Task Queue | Long Tasks Support | No Charge on FailureWhy Choose Async API?
Higher Stability
Based on task queue, avoids long connection timeout issues
No 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 anytime
Batch Processing
Suitable for batch generation and background tasks
Sync vs Async Comparison
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 completes
Complete Example
API Endpoints
1. Create Video Task
POST
https://api2.laozhang.ai/v1/videosCreate a new video generation taskRequest Parameters
Available Models
Model Naming Convention:
landscape= Landscape (16:9)fast= Fast versionfl= Supports frame-to-video (image-to-video)
Response Fields
2. Query Task Status
GET
https://api2.laozhang.ai/v1/videos/{video_id}Query the current status of a video generation taskPath Parameters
Response Fields
Task Status Description
3. Get Video Content
GET
https://api2.laozhang.ai/v1/videos/{video_id}/contentGet the actual content of a completed videoPath Parameters
Response Fields
Complete Code Examples
Python Example (with Polling Logic)
JavaScript/Node.js Example
Best Practices
Polling Interval Settings
Polling Interval Settings
Recommended polling interval: 5-10 secondsReasons:
- Video generation typically takes 2-5 minutes
- 5-10 seconds provides timely feedback
- Avoids excessive requests
Timeout Handling
Timeout Handling
Recommended timeout: 10 minutes (600 seconds)Note:
- Task timeout doesn’t auto-cancel
- Can continue querying the same video_id later
- Tasks are valid for 24 hours
Error Retry Strategy
Error Retry Strategy
Recommended retry logic:Retry scenarios:
- ✓ Network error → Retry
- ✓ Service busy (503) → Retry
- ✗ Content violation → Don’t retry, modify prompt
- ✗ Insufficient balance → Don’t retry, confirm account credit first
Batch Generation Optimization
Batch Generation Optimization
Concurrency control suggestions:Suggestions:
- 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, and cancellation billing follows console order status
- ✗ Content safety failure billing follows console order status (major difference from sync API ⭐)
- ✗ Status queries are free
FAQ
How long are tasks valid?
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
Why am I getting 404 when querying?
Why am I getting 404 when querying?
Possible reasons:
- Incorrect video_id - Check if copied completely
- Task expired - Over 24 hours
- Network issue - Retry the request
Can I mix async and sync APIs?
Can I mix async and sync APIs?
Yes, they’re completely independentThe two API systems are completely separate:
- 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
How to choose the right model?
How to choose the right model?
Choose based on needs:
Error Handling
Common Error Codes
Error Response Format
Technical Support
Need Help?
If you have questions, feel free to contact us:
- Email: hi@laozhang.ai
- Telegram: https://t.me/laozhang_cn
- Docs: https://docs.laozhang.ai
Next Steps
Sync API
View sync calling method (OpenAI compatible)
Code Examples
View more application examples
Model Overview
Learn about Veo-3.1 model details
Troubleshooting
View more Q&A