AI Model APIVideosMiniMax-H3 Format
Query Task and Download
Poll MiniMax-H3 task status and download the generated result.
Query Task
GET http://103.36.63.156:3000/v1/videos/{task_id}
Authorization: Bearer {api_key}curl -X GET "http://103.36.63.156:3000/v1/videos/xxxxxxxxxxxxxxxx" \
-H "Authorization: Bearer sk-xxxxxxxx"Response
{
"task_id": "xxxxxxxxxxxxxxxx",
"status": "completed",
"video_url": "https://cdn.example.com/video/xxxx.mp4",
"duration": 6,
"created_at": 1735660800,
"completed_at": 1735660950
}Status Reference
| status | Description |
|---|---|
queued | Queued, waiting to be processed |
in_progress | Generating |
completed | Generation succeeded |
failed | Generation failed, the error field contains the reason |
Download Video
GET http://103.36.63.156:3000/v1/videos/{task_id}/content
Authorization: Bearer {api_key}curl -X GET "http://103.36.63.156:3000/v1/videos/xxxxxxxxxxxxxxxx/content" \
-H "Authorization: Bearer sk-xxxxxxxx" \
-o output.mp4Polling Examples
JavaScript
async function pollTask(taskId, apiKey) {
const url = `http://103.36.63.156:3000/v1/videos/${taskId}`;
for (let i = 0; i < 120; i++) {
const res = await fetch(url, {
headers: { Authorization: `Bearer ${apiKey}` },
});
const data = await res.json();
if (data.status === 'completed') return data;
if (data.status === 'failed') throw new Error(data.error || 'failed');
await new Promise((r) => setTimeout(r, 5000));
}
throw new Error('timeout');
}Python
import time, requests
def poll_task(task_id, api_key):
url = f"http://103.36.63.156:3000/v1/videos/{task_id}"
headers = {"Authorization": f"Bearer {api_key}"}
for _ in range(120):
data = requests.get(url, headers=headers).json()
if data["status"] == "completed":
return data
if data["status"] == "failed":
raise RuntimeError(data.get("error", "failed"))
time.sleep(5)
raise TimeoutError("timeout")A 5-second polling interval is recommended, with a maximum wait of 10 minutes. Beyond that, treat it as a timeout and prompt the user to retry.
How is this guide?