Skip to main content

Get Started

1

Get your API Key

Sign up at ModelHunter.AI Dashboard and create an API key from the API Keys page.
2

Set up your environment

Set your API key as an environment variable:
export MODELHUNTER_KEY="mh_live_xxx"
3

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);

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