AI Video Generation v3.0
Description
This API supports text-to-video and image-to-video generation.
Version
1.0
Media Requirements
The source document does not specify the supported input image formats, dimensions, or file-size limits. For image-to-video requests, provide the image URL through init_images.
API URL
Production host: https://openapi.meitu.com
Task submission endpoint: https://openapi.meitu.com/api/v1/sdk/sync/push
Task name (task): /v1/v3_mvv_model/ai_video/453181
Task type (task_type): formulaMethod
POST
Content-Type: application/json
Authentication
Request Parameters
| Required | Parameter | Type | Description |
|---|---|---|---|
| Yes | params | string | Algorithm parameters as a JSON string |
| Yes | init_images | object[] | Input media list; provide the input image for image-to-video generation |
| Yes | task | string | Fixed value: /v1/v3_mvv_model/ai_video/453181 |
| Yes | task_type | string | Fixed value: formula |
| No | sync_timeout | int | Synchronous timeout in seconds; default: 30 |
init_images item fields:
| Required | Parameter | Type | Description |
|---|---|---|---|
| Yes | url | string | Image URL or base64-encoded image |
| Yes | profile | object | Media profile |
profile fields:
| Required | Parameter | Type | Description |
|---|---|---|---|
| Yes | media_profiles | object | Media attributes |
| Yes | version | string | Fixed value: v1 |
media_profiles fields:
| Required | Parameter | Type | Description |
|---|---|---|---|
| Yes | media_data_type | string | url indicates a URL; types such as jpg indicate base64 data |
params is a JSON string. After decoding, it has the following structure:
| Required | Field | Type | Description |
|---|---|---|---|
| No | rsp_media_type | string | Default: url; jpg indicates base64 output |
| Yes | parameter | object | Algorithm-specific parameters |
parameter fields:
| Required | Field | Type | Description |
|---|---|---|---|
| Yes | user_prompt | string | User-provided text prompt |
Request Example
{
"task": "/v1/v3_mvv_model/ai_video/453181",
"task_type": "formula",
"init_images": [
{
"url": "http://my-material.zone1.meitudata.com/b2665cf996a410b.jpg",
"profile": {
"media_profiles": {
"media_data_type": "url"
},
"version": "v1"
}
}
],
"params": "{\"rsp_media_type\":\"url\",\"parameter\":{\"user_prompt\":\"绿水青山\"}}",
"sync_timeout": 30
}Response Fields
Generated results are cleaned up periodically. Download and save them promptly.| Field | Type | Description |
|---|---|---|
| request_id | string | Request identifier |
| trace_id | string | Trace identifier |
| code | int | Business status code; 0 means the request was accepted |
| error_code | int | Error code; 0 on success |
| message | string | Business message |
| tips | any | Additional information |
| data | object | Task status and algorithm result |
data fields:
| Field | Type | Description |
|---|---|---|
| status | int | -1: task not found; 0: created; 1: running; 2: failed; 9: timed out and requires the query API; 10: succeeded |
| result | object | Algorithm result |
| progress | number | Task progress |
| predict_elapsed | int | Estimated processing time in milliseconds |
| create_time | int64 | Creation timestamp in milliseconds |
| task_id | string | Task ID |
| custom_task_id | string | Client-supplied custom task ID |
| trace_id | string | Trace identifier inside data |
| client_info | string | Client information |
| init_images | object[]/null | Echo of input media |
result fields:
| Field | Type | Description |
|---|---|---|
| id | string | Task ID |
| urls | string[] | Result URL list |
| error_code | int | Algorithm error code, returned on failure |
| error_message | string | Algorithm error message, returned on failure |
Response Examples
Success Response Example
{
"request_id": "req-ai-video-v3-001",
"trace_id": "trace-ai-video-v3-001",
"code": 0,
"error_code": 0,
"message": "success",
"tips": null,
"data": {
"status": 10,
"result": {
"id": "af5e99fc-0f1b-4a73-9089-d8036d1f6181",
"urls": [
"https://meitu-commons-test.pre.meitudata.com/dist-pic/d79eb9c1-dc67-4a9f-b831-f05f046b96de.jpg",
"https://meitu-commons-test.pre.meitudata.com/dist-pic/9aebd725-df56-4506-8386-63510958d4e1.jpg"
]
},
"progress": 1,
"predict_elapsed": 0,
"create_time": 1786089600000,
"task_id": "af5e99fc-0f1b-4a73-9089-d8036d1f6181",
"custom_task_id": "",
"trace_id": "trace-ai-video-v3-001",
"client_info": "",
"init_images": null
}
}Pending Response Example
Use the query API to retrieve the result.
Response Status: 200
content-type: application/json; charset=utf-8
{
"request_id": "req-ai-video-v3-002",
"trace_id": "trace-ai-video-v3-002",
"code": 0,
"error_code": 0,
"message": "success",
"tips": null,
"data": {
"status": 9,
"result": {},
"progress": 0.85,
"predict_elapsed": 5000,
"create_time": 1786089600000,
"task_id": "af5e99fc-0f1b-4a73-9089-d8036d1f6181",
"custom_task_id": "",
"trace_id": "trace-ai-video-v3-002",
"client_info": "",
"init_images": null
}
}Failed Request Response Example
Response Status: 400
content-type: application/json; charset=utf-8
{
"request_id": "req-ai-video-v3-003",
"trace_id": "trace-ai-video-v3-003",
"code": 20008,
"error_code": 20008,
"message": "UNSUITABLE_IMAGE",
"tips": null,
"data": {
"status": 2,
"result": {
"error_code": 20008,
"error_message": "UNSUITABLE_IMAGE"
},
"progress": 0,
"predict_elapsed": 0,
"create_time": 1786089600000,
"task_id": "",
"custom_task_id": "",
"trace_id": "trace-ai-video-v3-003",
"client_info": "",
"init_images": null
}
}API-specific error codes listed in the source document:
| ErrorCode | Error | Description |
|---|---|---|
| 20001 | PROCESS_ERROR | Processing error |
General Error Codes
See API Error Codes.
SDK Examples
Python
import json
import requests
from sign_sdk import sign
def api_call_example():
key = "your_api_key"
secret = "your_api_secret"
url = "https://openapi.meitu.com/api/v1/sdk/sync/push"
method = "POST"
headers = {
"Content-Type": "application/json",
sign.HeaderHost: "openapi.meitu.com",
}
inner_params = {
"rsp_media_type": "url",
"parameter": {"user_prompt": "绿水青山"},
}
payload = {
"task": "/v1/v3_mvv_model/ai_video/453181",
"task_type": "formula",
"init_images": [
{
"url": "http://my-material.zone1.meitudata.com/b2665cf996a410b.jpg",
"profile": {
"media_profiles": {"media_data_type": "url"},
"version": "v1",
},
}
],
"params": json.dumps(inner_params, ensure_ascii=False),
"sync_timeout": 30,
}
body = json.dumps(payload, ensure_ascii=False)
signer = sign.Signer(key, secret)
signed_request = signer.sign(url, method, headers, body)
response = requests.Session().send(signed_request)
print(f"Status: {response.status_code}")
print(f"Response: {response.text}")
if __name__ == "__main__":
api_call_example()Go
package main
import (
"fmt"
"io"
"net/http"
"github.com/mtlab/api/signer"
)
func main() {
key := "your_api_key"
secret := "your_api_secret"
signObj := signer.NewSigner(key, secret)
url := "https://openapi.meitu.com/api/v1/sdk/sync/push"
method := http.MethodPost
headers := make(http.Header)
headers.Set(signer.HeaderHost, "openapi.meitu.com")
headers.Set("Content-Type", "application/json")
body := `{
"task": "/v1/v3_mvv_model/ai_video/453181",
"task_type": "formula",
"init_images": [{
"url": "http://my-material.zone1.meitudata.com/b2665cf996a410b.jpg",
"profile": {
"media_profiles": {"media_data_type": "url"},
"version": "v1"
}
}],
"params": "{\"rsp_media_type\":\"url\",\"parameter\":{\"user_prompt\":\"绿水青山\"}}",
"sync_timeout": 30
}`
req, err := signObj.Sign(url, method, headers, body)
if err != nil {
fmt.Println("Failed to sign request:", err)
return
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
fmt.Println("Failed to send request:", err)
return
}
defer resp.Body.Close()
responseBody, err := io.ReadAll(resp.Body)
if err != nil {
fmt.Println("Read response failed:", err)
return
}
fmt.Println("Response:", resp.StatusCode, string(responseBody))
}PHP
<?php
require 'signer.php';
$key = 'your_api_key';
$secret = 'your_api_secret';
$signer = new Signer($key, $secret);
$url = 'https://openapi.meitu.com/api/v1/sdk/sync/push';
$method = 'POST';
$headers = ['Content-Type' => 'application/json'];
$innerParams = json_encode([
'rsp_media_type' => 'url',
'parameter' => ['user_prompt' => '绿水青山'],
]);
$body = json_encode([
'task' => '/v1/v3_mvv_model/ai_video/453181',
'task_type' => 'formula',
'init_images' => [
[
'url' => 'http://my-material.zone1.meitudata.com/b2665cf996a410b.jpg',
'profile' => [
'media_profiles' => ['media_data_type' => 'url'],
'version' => 'v1',
],
],
],
'params' => $innerParams,
'sync_timeout' => 30,
]);
$curl = $signer->sign($url, $method, $headers, $body);
$response = curl_exec($curl);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($status === 0) {
echo 'Error: ' . curl_error($curl);
} else {
echo "Status: {$status}\n";
echo "Response: {$response}\n";
}
curl_close($curl);
?>Java
package com.meitu.openai.common;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
public class Main {
public static void main(String[] args) throws Exception {
Signer signer = new Signer("your_api_key", "your_api_secret");
String url = "https://openapi.meitu.com/api/v1/sdk/sync/push";
String method = "POST";
Map<String, String> headers = new HashMap<>();
headers.put("Content-Type", "application/json");
headers.put(Signer.HeaderHost, "openapi.meitu.com");
String body = "{\n" +
" \"task\": \"/v1/v3_mvv_model/ai_video/453181\",\n" +
" \"task_type\": \"formula\",\n" +
" \"init_images\": [{\n" +
" \"url\": \"http://my-material.zone1.meitudata.com/b2665cf996a410b.jpg\",\n" +
" \"profile\": {\n" +
" \"media_profiles\": {\"media_data_type\": \"url\"},\n" +
" \"version\": \"v1\"\n" +
" }\n" +
" }],\n" +
" \"params\": \"{\\\"rsp_media_type\\\":\\\"url\\\",\\\"parameter\\\":{\\\"user_prompt\\\":\\\"绿水青山\\\"}}\",\n" +
" \"sync_timeout\": 30\n" +
"}";
Map<String, String> signedHeaders = signer.sign(url, method, headers, body);
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
connection.setRequestMethod(method);
for (Map.Entry<String, String> entry : signedHeaders.entrySet()) {
connection.setRequestProperty(entry.getKey(), entry.getValue());
}
connection.setDoOutput(true);
connection.getOutputStream().write(body.getBytes(StandardCharsets.UTF_8));
int status = connection.getResponseCode();
InputStream stream = status >= 400
? connection.getErrorStream()
: connection.getInputStream();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
StringBuilder response = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
response.append(line);
}
System.out.println("Response: " + status + " " + response);
}
}
}