Skip to main content
Async Endpoint: 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 issues

No Charge on Failure ⭐

Major Advantage: No charge for any failure
  • ✓ Content violation → No charge
  • ✓ Queue timeout → No charge
  • ✓ Generation failed → No charge
Sync API charges as long as request succeeds (HTTP 200), even if generation fails!

Flexible Polling

Query task status and progress anytime

Batch Processing

Suitable for batch generation and background tasks

Sync 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 completes

Complete 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 Video

API Endpoints

1. Create Video Task

POST https://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)
First/Last Frame FeatureImage-to-video models (with -fl suffix) support uploading 2 images:
  • First image: Video start frame
  • Second image: Video end frame
The API will automatically generate a smooth transition animation from start frame to end frame.

Response Fields

2. Query Task Status

GET https://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

GET https://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
Reasons:
  • Video generation typically takes 2-5 minutes
  • 5-10 seconds provides timely feedback
  • Avoids excessive requests
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 Recommended retry logic:
Retry scenarios:
  • ✓ Network error → Retry
  • ✓ Service busy (503) → Retry
  • ✗ Content violation → Don’t retry, modify prompt
  • ✗ Insufficient balance → Don’t retry, top up first
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, cancellation no charge
  • ✗ Content safety failure also no charge (major difference from sync API ⭐)
  • ✗ Status queries are free
Major advantage of Async API: No charge for failures of any kind, including content safety review failures. Sync API charges as long as request succeeds, even if generation ultimately fails.

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
Recommendations:
  • Download immediately after video generation completes
  • Don’t rely on server for long-term storage
Why am I getting 404 when querying? Possible reasons:
  1. Incorrect video_id - Check if copied completely
  2. Task expired - Over 24 hours
  3. Network issue - Retry the request
Solution:
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
Usage recommendations:
  • Quick testing → Use Sync API
  • Production → Use Async API (more stable)
  • Batch generation → Use Async API
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:

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