MiniMax H3 文字轉影片
使用文字轉影片端點建立非同步 Task。
概覽
使用文字轉影片端點搭配支援的模型。使用回傳的 Task ID 擷取其狀態,或提供 callback_url 以接收下方說明的回呼通知。
快速入門
- 建立 API 金鑰並將其設定為 RUNAPI_API_KEY。
- 選擇支援的模型,並傳送本文符合該模型結構描述的 POST 請求。
- 儲存返回的任務 ID,然後輪詢直到終止狀態,或處理下方說明的回呼。
端點
- 基礎 URL
https://runapi.ai- API 版本
v1- 身分驗證
Authorization: Bearer YOUR_API_TOKEN
支援的模型
開啟模型頁面以查看目前的定價、速率限制及商業用途詳情。
請求綱要
欄位及允許值取決於所選模型。若提供 callback_url,其將接收下方記錄的 Task 交付內容。
minimax-h39 個欄位
aspect_ratiostring產生影片的長寬比;自適應模式僅在提供參考媒體時可用。
允許的值:adaptive, 21:9, 16:9, 4:3, 1:1, 3:4, 9:16
callback_urlstring用於非同步通知的 Webhook URL。
duration_secondsinteger產生影片的時長(秒)。
允許的值:4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
預設值: 6
modelstring模型 slug。
output_resolutionstring產生影片的解析度。
允許的值:768p, 2k
預設值: 2k
promptstring影片生成提示。
範圍:1 - 7000
reference_audio_urlsarray公開 HTTP(S) WAV 或 MP3 參考音訊 URL;需搭配參考影像或影片,每個片段須為 2–15 秒,且合計音訊時長不得超過 15 秒。
項目數上限:3
reference_image_urlsarray公開 HTTP(S) 參考影像 URL;支援 JPG、JPEG、PNG、WEBP、HEIC 或 HEIF,每張最大 30 MB,每邊 256–5760 像素,長寬比 0.4–2.5。
項目數上限:9
reference_video_urlsarray公開 HTTP(S) MP4 或 MOV 參考影片 URL;每個片段須為 2–15 秒,且合計影片時長不得超過 15 秒。
項目數上限:3
條件規則
當所有列出的條件均符合時,這些需求即適用。
-
當
reference_audio_urls = {"present" => true}- 必填
- 不接受
-
當
reference_image_urls = {"present" => false},reference_video_urls = {"present" => false}- 必填
aspect_ratio- 不接受
建立接受記錄
POST /api/v1/minimax_h3/text_to_video
回應綱要
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"id": {
"type": "string"
},
"status": {
"enum": [
"processing"
],
"type": "string"
},
"task_replayed": {
"type": "boolean"
}
},
"required": [
"id",
"status",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
回應範例
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"id": "tsk_reference_demo",
"status": "processing"
}
輪詢處理中
GET /api/v1/minimax_h3/text_to_video/:id
回應綱要
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"id": {
"type": "string"
},
"status": {
"enum": [
"processing"
],
"type": "string"
}
},
"required": [
"id",
"status",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
回應範例
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"id": "tsk_reference_demo",
"status": "processing"
}
輪詢已完成
GET /api/v1/minimax_h3/text_to_video/:id
回應綱要
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"id": {
"type": "string"
},
"status": {
"enum": [
"completed"
],
"type": "string"
},
"videos": {
"items": {
"properties": {
"url": {
"type": "string",
"x-runapi-generated-media": true
}
},
"required": [
"url"
],
"type": "object",
"unevaluatedProperties": false
},
"type": "array"
}
},
"required": [
"id",
"status",
"videos",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
回應範例
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"id": "tsk_reference_demo",
"status": "completed",
"videos": [
{
"url": "https://file.runapi.ai/reference-video.mp4"
}
]
}
輪詢失敗
GET /api/v1/minimax_h3/text_to_video/:id
回應綱要
{
"properties": {
"billing": {
"properties": {
"refund": {
"oneOf": [
{
"properties": {
"refunded_at": {
"type": "string"
}
},
"required": [
"refunded_at"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"reservation": {
"oneOf": [
{
"properties": {
"amount_cents": {
"type": "integer"
}
},
"required": [
"amount_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
},
"settlement": {
"oneOf": [
{
"properties": {
"amount_micro_cents": {
"type": "integer"
},
"charged_amount_cents": {
"type": "integer"
}
},
"required": [
"charged_amount_cents",
"amount_micro_cents"
],
"type": "object",
"unevaluatedProperties": false
},
{
"enum": [
null
]
}
]
}
},
"required": [
"reservation",
"settlement",
"refund"
],
"type": "object",
"unevaluatedProperties": false
},
"error": {
"type": "string"
},
"id": {
"type": "string"
},
"status": {
"enum": [
"failed"
],
"type": "string"
}
},
"required": [
"id",
"status",
"error",
"billing"
],
"type": "object",
"unevaluatedProperties": false
}
回應範例
{
"billing": {
"refund": null,
"reservation": null,
"settlement": null
},
"error": "Task processing failed.",
"id": "tsk_reference_demo",
"status": "failed"
}
客戶回呼:已完成
POST callback_url
回應綱要
{
"properties": {
"id": {
"type": "string"
},
"status": {
"enum": [
"completed"
],
"type": "string"
},
"videos": {
"items": {
"properties": {
"url": {
"type": "string",
"x-runapi-generated-media": true
}
},
"required": [
"url"
],
"type": "object",
"unevaluatedProperties": false
},
"type": "array"
}
},
"required": [
"id",
"status",
"videos"
],
"type": "object",
"unevaluatedProperties": false
}
回應範例
{
"id": "tsk_reference_demo",
"status": "completed",
"videos": [
{
"url": "https://file.runapi.ai/reference-video.mp4"
}
]
}
客戶回呼:失敗
POST callback_url
回應綱要
{
"properties": {
"error": {
"oneOf": [
{
"type": "string"
},
{
"properties": {
"code": {
"type": "string"
},
"limit_cents": {
"type": "integer"
},
"message": {
"type": "string"
},
"reset_at": {
"format": "date-time",
"type": [
"string",
"null"
]
},
"used_cents": {
"type": "integer"
},
"window": {
"enum": [
"1h",
"1d",
"7d",
"daily",
"weekly",
"monthly",
"lifetime"
],
"type": "string"
}
},
"required": [
"code",
"message"
],
"type": "object",
"unevaluatedProperties": false
}
]
},
"id": {
"type": "string"
},
"status": {
"enum": [
"failed"
],
"type": "string"
}
},
"required": [
"id",
"status",
"error"
],
"type": "object",
"unevaluatedProperties": false
}
回應範例
{
"error": {
"code": "generation_failed",
"message": "Task processing failed."
},
"id": "tsk_reference_demo",
"status": "failed"
}
錯誤
POST /api/v1/minimax_h3/text_to_video
回應綱要
{
"properties": {
"error": {
"description": "人類可讀的錯誤訊息。",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
回應範例
{
"error": "Authentication required"
}
錯誤
GET /api/v1/minimax_h3/text_to_video/:id
回應綱要
{
"properties": {
"error": {
"description": "人類可讀的錯誤訊息。",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
回應範例
{
"error": "Authentication required"
}
錯誤
POST /api/v1/minimax_h3/text_to_video
回應綱要
{
"oneOf": [
{
"properties": {
"error": {
"description": "人類可讀的錯誤訊息。",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
},
{
"properties": {
"error": {
"description": "人類可讀的驗證摘要。",
"type": "string"
},
"errors": {
"additionalProperties": {
"items": {
"type": "string"
},
"type": "array"
},
"description": "以公開請求欄位為索引鍵的驗證訊息,每個欄位包含一組人類可讀的字串陣列。",
"type": "object"
}
},
"required": [
"error",
"errors"
],
"type": "object",
"unevaluatedProperties": false
}
]
}
回應範例
{
"error": "model must be one of: minimax-h3"
}
錯誤
POST /api/v1/minimax_h3/text_to_video
回應綱要
{
"properties": {
"error": {
"description": "人類可讀的錯誤訊息。",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
回應範例
{
"error": "Insufficient balance"
}
錯誤
POST /api/v1/minimax_h3/text_to_video
回應綱要
{
"properties": {
"error": {
"description": "人類可讀的錯誤訊息。",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
回應範例
{
"error": "API key credit limit exceeded"
}
錯誤
POST /api/v1/minimax_h3/text_to_video
回應綱要
{
"properties": {
"error": {
"description": "人類可讀的錯誤訊息。",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
回應範例
{
"error": "The request uses features that are not supported for the selected model"
}
錯誤
POST /api/v1/minimax_h3/text_to_video
回應綱要
{
"properties": {
"error": {
"description": "人類可讀的錯誤訊息。",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
回應範例
{
"error": "Rate limit reached. Please retry later."
}
錯誤
POST /api/v1/minimax_h3/text_to_video
回應綱要
{
"properties": {
"error": {
"description": "人類可讀的錯誤訊息。",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
回應範例
{
"error": "Service under maintenance, please try again later"
}
錯誤
POST /api/v1/minimax_h3/text_to_video
回應綱要
{
"properties": {
"error": {
"description": "人類可讀的錯誤訊息。",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
回應範例
{
"error": "The request timed out"
}
錯誤
GET /api/v1/minimax_h3/text_to_video/:id
回應綱要
{
"properties": {
"error": {
"description": "人類可讀的錯誤訊息。",
"type": "string"
}
},
"required": [
"error"
],
"type": "object",
"unevaluatedProperties": false
}
回應範例
{
"error": "Task with id 'tsk_reference_demo' not found"
}
產生的程式碼範例
直接使用 cURL,或為您的程式語言安裝 SDK。每個範例均會提交本參考中所示的已驗證請求。
安裝
pip install runapi-minimax-h3
import os
from runapi.minimax_h3 import MiniMaxH3Client
client = MiniMaxH3Client(api_key=os.environ["RUNAPI_API_KEY"])
task = client.text_to_video.create(
model="minimax-h3",
prompt="A slow aerial view of a quiet coastline at sunrise.",
aspect_ratio="16:9"
)