cURL
curl https://api.apipod.ai/v1/videos/generations \
-H "Authorization: Bearer $APIPOD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "magi-2-t2v",
"prompt": "黄昏时分,一只纸船漂过雨水浸湿的城市街道,慢速跟拍",
"duration": 5,
"resolution": "1080p",
"aspect_ratio": "16:9",
"generate_audio": true
}'import os import requests
response = requests.post(
"https://api.apipod.ai/v1/videos/generations",
headers={
"Authorization": f"Bearer {os.environ['APIPOD_API_KEY']}",
"Content-Type": "application/json",
},
json={
"model": "magi-2-t2v",
"prompt": "黄昏时分,一只纸船漂过雨水浸湿的城市街道,慢速跟拍",
"duration": 5,
"resolution": "1080p",
"aspect_ratio": "16:9",
"generate_audio": True,
},
timeout=60,
) response.raise_for_status() print(response.json())package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.apipod.ai/v1/videos/generations"
payload := strings.NewReader("{\n \"model\": \"magi-2-t2v\",\n \"prompt\": \"黄昏时分,一只纸船漂过雨水浸湿的城市街道,慢速跟拍,水洼反射霓虹灯光,伴随着轻柔的雨声\"\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))
}falseconst response = await fetch("https://api.apipod.ai/v1/videos/generations", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.APIPOD_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "magi-2-t2v",
prompt: "黄昏时分,一只纸船漂过雨水浸湿的城市街道,慢速跟拍",
duration: 5,
resolution: "1080p",
aspect_ratio: "16:9",
generate_audio: true,
}),
});
if (!response.ok) {
throw new Error(`APIPod request failed: ${response.status} ${await response.text()}`);
}
console.log(await response.json());{
"code": 200,
"message": "success",
"data": {
"task_id": "vid_task_01JEXAMPLE"
}
}MAGI-2
MAGI-2 文生视频
Sand AI MAGI-2 文生视频支持最长 8000 字提示词,单次生成 4-30 秒 1080p、25 fps 原生有声视频,提供六种画幅选择。
POST
https://api.apipod.ai
/
v1
/
videos
/
generations
cURL
curl https://api.apipod.ai/v1/videos/generations \
-H "Authorization: Bearer $APIPOD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "magi-2-t2v",
"prompt": "黄昏时分,一只纸船漂过雨水浸湿的城市街道,慢速跟拍",
"duration": 5,
"resolution": "1080p",
"aspect_ratio": "16:9",
"generate_audio": true
}'import os import requests
response = requests.post(
"https://api.apipod.ai/v1/videos/generations",
headers={
"Authorization": f"Bearer {os.environ['APIPOD_API_KEY']}",
"Content-Type": "application/json",
},
json={
"model": "magi-2-t2v",
"prompt": "黄昏时分,一只纸船漂过雨水浸湿的城市街道,慢速跟拍",
"duration": 5,
"resolution": "1080p",
"aspect_ratio": "16:9",
"generate_audio": True,
},
timeout=60,
) response.raise_for_status() print(response.json())package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.apipod.ai/v1/videos/generations"
payload := strings.NewReader("{\n \"model\": \"magi-2-t2v\",\n \"prompt\": \"黄昏时分,一只纸船漂过雨水浸湿的城市街道,慢速跟拍,水洼反射霓虹灯光,伴随着轻柔的雨声\"\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))
}falseconst response = await fetch("https://api.apipod.ai/v1/videos/generations", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.APIPOD_API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "magi-2-t2v",
prompt: "黄昏时分,一只纸船漂过雨水浸湿的城市街道,慢速跟拍",
duration: 5,
resolution: "1080p",
aspect_ratio: "16:9",
generate_audio: true,
}),
});
if (!response.ok) {
throw new Error(`APIPod request failed: ${response.status} ${await response.text()}`);
}
console.log(await response.json());{
"code": 200,
"message": "success",
"data": {
"task_id": "vid_task_01JEXAMPLE"
}
}MAGI-2 输出原生 1080p、25 fps 音画同步视频(实际成片比
duration 长约 0.24 秒),出片耗时约 13–20 分钟。建议配置 callback_url 回调或轮询 GET /v1/videos/status/{task_id}。按请求的 duration 统一按秒计费,画幅与音频开关不影响单价。请求体
application/json
此页面对您有帮助吗?