创建视频生成任务(万相 3.0)
curl --request POST \
--url https://api.looprouter.com/api/v1/services/aigc/video-generation/video-synthesis \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "wan3.0-video",
"input": {
"prompt": "一只小猫在月光下的屋顶上奔跑,城市的霓虹灯在远处闪烁,电影级画质,流畅运镜。"
},
"parameters": {
"resolution": "1080P",
"ratio": "adaptive",
"duration": 5,
"prompt_extend": true
}
}
'import requests
url = "https://api.looprouter.com/api/v1/services/aigc/video-generation/video-synthesis"
payload = {
"model": "wan3.0-video",
"input": { "prompt": "一只小猫在月光下的屋顶上奔跑,城市的霓虹灯在远处闪烁,电影级画质,流畅运镜。" },
"parameters": {
"resolution": "1080P",
"ratio": "adaptive",
"duration": 5,
"prompt_extend": True
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'wan3.0-video',
input: {prompt: '一只小猫在月光下的屋顶上奔跑,城市的霓虹灯在远处闪烁,电影级画质,流畅运镜。'},
parameters: {resolution: '1080P', ratio: 'adaptive', duration: 5, prompt_extend: true}
})
};
fetch('https://api.looprouter.com/api/v1/services/aigc/video-generation/video-synthesis', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.looprouter.com/api/v1/services/aigc/video-generation/video-synthesis",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'wan3.0-video',
'input' => [
'prompt' => '一只小猫在月光下的屋顶上奔跑,城市的霓虹灯在远处闪烁,电影级画质,流畅运镜。'
],
'parameters' => [
'resolution' => '1080P',
'ratio' => 'adaptive',
'duration' => 5,
'prompt_extend' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.looprouter.com/api/v1/services/aigc/video-generation/video-synthesis"
payload := strings.NewReader("{\n \"model\": \"wan3.0-video\",\n \"input\": {\n \"prompt\": \"一只小猫在月光下的屋顶上奔跑,城市的霓虹灯在远处闪烁,电影级画质,流畅运镜。\"\n },\n \"parameters\": {\n \"resolution\": \"1080P\",\n \"ratio\": \"adaptive\",\n \"duration\": 5,\n \"prompt_extend\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.looprouter.com/api/v1/services/aigc/video-generation/video-synthesis")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"wan3.0-video\",\n \"input\": {\n \"prompt\": \"一只小猫在月光下的屋顶上奔跑,城市的霓虹灯在远处闪烁,电影级画质,流畅运镜。\"\n },\n \"parameters\": {\n \"resolution\": \"1080P\",\n \"ratio\": \"adaptive\",\n \"duration\": 5,\n \"prompt_extend\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.looprouter.com/api/v1/services/aigc/video-generation/video-synthesis")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"wan3.0-video\",\n \"input\": {\n \"prompt\": \"一只小猫在月光下的屋顶上奔跑,城市的霓虹灯在远处闪烁,电影级画质,流畅运镜。\"\n },\n \"parameters\": {\n \"resolution\": \"1080P\",\n \"ratio\": \"adaptive\",\n \"duration\": 5,\n \"prompt_extend\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"output": {
"task_id": "17ed7e50-00cf-4509-aea1-xxxxxx",
"task_status": "PENDING"
},
"request_id": "78c9b768-0285-996c-b682-xxxxxx"
}{
"code": "InvalidParameter",
"message": "<string>",
"request_id": "<string>"
}{
"code": "InvalidParameter",
"message": "<string>",
"request_id": "<string>"
}{
"code": "InvalidParameter",
"message": "<string>",
"request_id": "<string>"
}{
"code": "InvalidParameter",
"message": "<string>",
"request_id": "<string>"
}万相 3.0
创建视频生成任务(万相 3.0)
提交一个异步视频生成任务(万相 3.0,wan3.0-video 或 wan3.0-video-prime,两个模型调用方式完全相同)。
接口与阿里百炼(DashScope)原生完全一致:把 Base URL 指向网关、仅换 API Key 即可调用,无需
WorkspaceId 子域。仅返回 task_id,成片需通过查询接口轮询获取。文生 / 图生(首帧、首尾帧)/
参考生视频共用本接口,靠 input.media 数组组合区分模式。
POST
/
api
/
v1
/
services
/
aigc
/
video-generation
/
video-synthesis
创建视频生成任务(万相 3.0)
curl --request POST \
--url https://api.looprouter.com/api/v1/services/aigc/video-generation/video-synthesis \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "wan3.0-video",
"input": {
"prompt": "一只小猫在月光下的屋顶上奔跑,城市的霓虹灯在远处闪烁,电影级画质,流畅运镜。"
},
"parameters": {
"resolution": "1080P",
"ratio": "adaptive",
"duration": 5,
"prompt_extend": true
}
}
'import requests
url = "https://api.looprouter.com/api/v1/services/aigc/video-generation/video-synthesis"
payload = {
"model": "wan3.0-video",
"input": { "prompt": "一只小猫在月光下的屋顶上奔跑,城市的霓虹灯在远处闪烁,电影级画质,流畅运镜。" },
"parameters": {
"resolution": "1080P",
"ratio": "adaptive",
"duration": 5,
"prompt_extend": True
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'wan3.0-video',
input: {prompt: '一只小猫在月光下的屋顶上奔跑,城市的霓虹灯在远处闪烁,电影级画质,流畅运镜。'},
parameters: {resolution: '1080P', ratio: 'adaptive', duration: 5, prompt_extend: true}
})
};
fetch('https://api.looprouter.com/api/v1/services/aigc/video-generation/video-synthesis', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.looprouter.com/api/v1/services/aigc/video-generation/video-synthesis",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => 'wan3.0-video',
'input' => [
'prompt' => '一只小猫在月光下的屋顶上奔跑,城市的霓虹灯在远处闪烁,电影级画质,流畅运镜。'
],
'parameters' => [
'resolution' => '1080P',
'ratio' => 'adaptive',
'duration' => 5,
'prompt_extend' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.looprouter.com/api/v1/services/aigc/video-generation/video-synthesis"
payload := strings.NewReader("{\n \"model\": \"wan3.0-video\",\n \"input\": {\n \"prompt\": \"一只小猫在月光下的屋顶上奔跑,城市的霓虹灯在远处闪烁,电影级画质,流畅运镜。\"\n },\n \"parameters\": {\n \"resolution\": \"1080P\",\n \"ratio\": \"adaptive\",\n \"duration\": 5,\n \"prompt_extend\": true\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.looprouter.com/api/v1/services/aigc/video-generation/video-synthesis")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"wan3.0-video\",\n \"input\": {\n \"prompt\": \"一只小猫在月光下的屋顶上奔跑,城市的霓虹灯在远处闪烁,电影级画质,流畅运镜。\"\n },\n \"parameters\": {\n \"resolution\": \"1080P\",\n \"ratio\": \"adaptive\",\n \"duration\": 5,\n \"prompt_extend\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.looprouter.com/api/v1/services/aigc/video-generation/video-synthesis")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"wan3.0-video\",\n \"input\": {\n \"prompt\": \"一只小猫在月光下的屋顶上奔跑,城市的霓虹灯在远处闪烁,电影级画质,流畅运镜。\"\n },\n \"parameters\": {\n \"resolution\": \"1080P\",\n \"ratio\": \"adaptive\",\n \"duration\": 5,\n \"prompt_extend\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"output": {
"task_id": "17ed7e50-00cf-4509-aea1-xxxxxx",
"task_status": "PENDING"
},
"request_id": "78c9b768-0285-996c-b682-xxxxxx"
}{
"code": "InvalidParameter",
"message": "<string>",
"request_id": "<string>"
}{
"code": "InvalidParameter",
"message": "<string>",
"request_id": "<string>"
}{
"code": "InvalidParameter",
"message": "<string>",
"request_id": "<string>"
}{
"code": "InvalidParameter",
"message": "<string>",
"request_id": "<string>"
}授权
LoopRouter API Key(sk- 开头),在控制台「令牌」页创建
请求头
可选,值为 enabled。
可用选项:
enabled 请求体
application/json