Generates a video from a source image (first frame) and an optional last frame image, supports multiple AI video models, creates a task asynchronously and then polls for the result.
Core Features
- 5 model choices: covering different styles and duration requirements.
- First/last frame control: an optional last frame image controls the video's ending frame.
- Rich parameters: supports Pro mode, sound generation, camera movement control, aspect ratio, etc.
- Asynchronous mode: creating a task returns a taskId immediately, and the script automatically polls until completion (20-minute timeout).
Model Description
| Model (videoType) | Description | Supported durations |
|---|---|---|
| KLING | Keling | 5 seconds/10 seconds |
| WAN | Wanxiang | 5 seconds/10 seconds/15 seconds |
| SEED | Seedance/Doubao | 5 seconds/10 seconds/15 seconds |
| SEED_FAST | Seedance 2.0 Fast | 5 seconds/10 seconds/15 seconds |
| HAILUO | Hailuo | 6 seconds/10 seconds |
Parameter Overview
- Required fields:
imageUrl、videoType、videoTime - Optional core:
lastFrameImageUrl(last frame image),prompt(within 2000 characters)
For the complete parameter table, response field structure, and error codes, see references/api.md。
How to Call
- Create task:
POST /aigc/videoGenAsync→ returns{taskId} - Poll result:
POST /aigc/taskQuery→ pass in{taskId}→ returns status and result - Python script:
python scripts/aigc_videogen.py '<JSON 参数>'(the script automatically completes creation + polling internally)
Asynchronous flow:
- The script calls
/aigc/videoGenAsyncto create a task and obtaintaskId - Wait 2 minutes before starting to poll
/aigc/taskQuery, once every 10 seconds, waiting up to 20 minutes - On success, automatically download the video to the session
media/directory
Output strategy (default script behavior):
- The script automaticallydownloads and savesthe generated video to the session
media/directory, and outputs one line to stdoutSaved full response: <路径数组>。 - The raw API response is silently written to disk at
data/, and its path is only shown on stdout when there is no video output.
Data reading advice:Do not Read the contents of the saved video file. Simply provide the user with the local path after Saved full response: .
Resolving authentication and compute issues
When the following abnormal situations occur, use references/onboarding.md to guide resolution:
Abnormal situations
- API Key not configured: the environment variable is not configured
LINKFOX_AGENT_API_KEY, andLINKFOXAGENT_API_KEY。 - Response 401 or 402 status code
- Response indicates insufficient compute or balance: the message contains "insufficient compute balance/insufficient billing/insufficient balance/quota exceeded/insufficient balance/package expired/recharge required/please recharge", or content with a similar meaning.
Usage Guide
- Model selection: For general product videos use
KLING; for long durations useWAN/SEED。 - First and last frames: pass
imageUrl(first frame, required) + optionallastFrameImageUrl(last frame), supported models: KLING Pro only / WAN / SEED. - Duration matching: you must pass a duration value supported by the model, otherwise an error will occur.
- Prompt: optional, within 2000 characters, describes the desired dynamic effect.
Examples
1. KLING — Product showcase
{"imageUrl": "https://example.com/product.jpg", "videoType": "KLING", "videoTime": 10, "prompt": "商品展示视频"}
3. WAN Wanxiang — with audio and camera movement
{"imageUrl": "https://example.com/scene.jpg", "videoType": "WAN", "videoTime": 15, "voice": true, "camera": "single"}
4. SEED — high resolution
{"imageUrl": "https://example.com/scene.jpg", "videoType": "SEED", "videoTime": 10, "resolution": "1080p", "aspectRatio": "16:9"}
Display rules
- Only display the local path after transfer: tell the user the local video path after
Saved full response:, for example "Video saved to: xxx/a.mp4". - Prohibited Read the video file,Prohibiteddisplay base64 content.
- Prohibitedgiving the user the temporary URL returned directly by the original API (signed, will expire).
Limitations
- The prompt is at most 2000 characters.
- Generation takes a long time, usually 100-600 seconds. The script polls automatically, with a 20-minute timeout.
- KLING last frame image is only supported in Pro mode.
- This interface only supports single-image/first-and-last-frame mode. For multiple reference images, use
linkfox-aigc-videogen-multi。 - No retry on failure (only 1 attempt).
Not applicable
Not applicable:
- Multiple reference image to video →
linkfox-aigc-videogen-multi - Image generation →
linkfox-aigc-imagegen - Text generation →
linkfox-aigc-textgen
Feedback
See references/api.md。