Video Template Generation
curl --request POST \
--url https://api.minimaxi.com/v1/video_template_generation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--data '
{
"template_id": "393769180141805569",
"media_inputs": [
{
"value": "https://cdn.hailuoai.com/prod/2024-09-18-16/user/multi_chat_file/9c0b5c14-ee88-4a5b-b503-4f626f018639.jpeg"
}
],
"text_inputs": [
{
"value": "狮子"
}
]
}
'{
"task_id": "401047179385389059",
"base_resp": {
"status_code": 0,
"status_msg": "success"
}
}视频生成Agent
创建视频Agent任务
deprecated
使用本接口创建视频Agent任务。
POST
/
v1
/
video_template_generation
Video Template Generation
curl --request POST \
--url https://api.minimaxi.com/v1/video_template_generation \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: <content-type>' \
--data '
{
"template_id": "393769180141805569",
"media_inputs": [
{
"value": "https://cdn.hailuoai.com/prod/2024-09-18-16/user/multi_chat_file/9c0b5c14-ee88-4a5b-b503-4f626f018639.jpeg"
}
],
"text_inputs": [
{
"value": "狮子"
}
]
}
'{
"task_id": "401047179385389059",
"base_resp": {
"status_code": 0,
"status_msg": "success"
}
}授权
请求头
请求体的媒介类型,请设置为 application/json,确保请求数据的格式为 JSON
可用选项:
application/json 请求体
application/json
文本输入数组,用于填充模板中的文本部分,不同模板对此要求不同
Show child attributes
Show child attributes
媒体输入数组(如图片),用于填充模板中的媒体部分,不同模板对此要求不同
Show child attributes
Show child attributes
接收任务状态更新通知的回调 URL。支持通过 callback_url 参数可以配置回调,以接收任务状态的更新的异步通知
-
地址验证:配置后,MiniMax 服务器会向
callback_url发送一个POST请求,请求体中包含challenge字段。服务端需要在 3 秒内原样返回该challenge值以完成验证 -
状态更新:验证成功后,每当任务状态变更时,MiniMax 都会向该 URL 推送最新的任务状态。推送的数据结构与调用查询视频生成任务接口的响应体一致
回调返回的status包括以下状态:
processing- 生成中success- 成功failed- 失败
回调服务示例:
from fastapi import FastAPI, HTTPException, Request
from fastapi.middleware.cors import CORSMiddleware
import json
app = FastAPI()
@app.post("/get_callback")
async def get_callback(request: Request):
try:
json_data = await request.json()
challenge = json_data.get("challenge")
if challenge is not None:
# Verification request, return challenge as is
return {"challenge": challenge}
else:
# Callback request, handle your own logic here
# Example payload:
# {
# "task_id": "115334141465231360",
# "status": "Success",
# "file_id": "205258526306433",
# "base_resp": {
# "status_code": 0,
# "status_msg": "success"
# }
# }
return {"status": "success"}
except Exception as e:
raise HTTPException(status_code=500, detail=str(e))
if __name__ == "__main__":
import uvicorn
uvicorn.run(
app, # 必选
host="0.0.0.0", # 必选
port=8000, # 必选,端口可设置
# ssl_keyfile="yourname.yourDomainName.com.key", # 可选,看是否开启ssl
# ssl_certfile="yourname.yourDomainName.com.crt", # 可选,看是否开启ssl
)此页面对您有帮助吗?
⌘I