Get Started
Get your API Key
Sign up at ModelHunter.AI Dashboard and create an API key from the API Keys page.
Set up your environment
Set your API key as an environment variable:
export MODELHUNTER_KEY="mh_live_xxx"
Generate a video
Submit a text-to-video request and poll for the result.
const API_KEY = process.env.MODELHUNTER_KEY;
const BASE = 'https://api.modelhunter.ai/api/v1';
// 1. Submit a generation request
const response = await fetch(`${BASE}/vidu/text-to-video`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'viduq3-turbo',
input: {
prompt: 'A futuristic city at sunset, flying cars, neon lights',
duration: 4,
aspect_ratio: '16:9',
resolution: '1080p',
},
}),
});
const task = await response.json();
const taskId = task.data.id;
console.log('Task ID:', taskId);
// 2. Poll until complete
let result;
while (true) {
await new Promise(r => setTimeout(r, 3000)); // wait 3s
const poll = await fetch(`${BASE}/tasks/${taskId}`, {
headers: { 'Authorization': `Bearer ${API_KEY}` },
}).then(r => r.json());
console.log('Status:', poll.data.status);
if (poll.data.status === 'succeeded') {
result = poll.data;
break;
}
if (poll.data.status === 'failed') {
throw new Error(poll.data.error?.message || 'Task failed');
}
}
console.log('Video URL:', result.result[0].url);
import requests, time
API_KEY = 'mh_live_xxx'
BASE = 'https://api.modelhunter.ai/api/v1'
headers = {
'Authorization': f'Bearer {API_KEY}',
'Content-Type': 'application/json',
}
# 1. Submit a generation request
response = requests.post(
f'{BASE}/vidu/text-to-video',
headers=headers,
json={
'model': 'viduq3-turbo',
'input': {
'prompt': 'A futuristic city at sunset, flying cars, neon lights',
'duration': 4,
'aspect_ratio': '16:9',
'resolution': '1080p',
},
},
)
task = response.json()
task_id = task['data']['id']
print('Task ID:', task_id)
# 2. Poll until complete
while True:
time.sleep(3)
poll = requests.get(
f'{BASE}/tasks/{task_id}',
headers=headers,
).json()
status = poll['data']['status']
print('Status:', status)
if status == 'succeeded':
print('Video URL:', poll['data']['result'][0]['url'])
break
if status == 'failed':
raise Exception(poll['data'].get('error', {}).get('message', 'Task failed'))
# 1. Submit a generation request
curl -X POST https://api.modelhunter.ai/api/v1/vidu/text-to-video \
-H "Authorization: Bearer mh_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"model": "viduq3-turbo",
"input": {
"prompt": "A futuristic city at sunset, flying cars, neon lights",
"duration": 4,
"aspect_ratio": "16:9",
"resolution": "1080p"
}
}'
# Returns: { "data": { "id": "task_abc123", ... } }
# 2. Poll until complete (replace task_abc123 with your task ID)
curl https://api.modelhunter.ai/api/v1/tasks/task_abc123 \
-H "Authorization: Bearer mh_live_xxx"
# Repeat every few seconds until status is "succeeded" or "failed"
What’s Next?
Async Tasks
Understand the task lifecycle and polling patterns
Webhooks
Get notified when tasks complete instead of polling
Video Models
Explore all video generation models
Image Models
Generate images with Seedream