Orux AIOruxAI

AI Video Generation: From Prompt to MP4

Text-to-video and image-to-video through one async task API. Model comparison (MiniMax H3 vs Kling 3.0 Omni), polling code and cost control for per-second billing.

ai video generation api
minimax-h3kling-3.0-omni

What you'll build

The same submit-and-poll pattern as images, pointed at video models: describe a scene or upload a still, and get back an MP4. This is the core of short-video generators, ad creative tools and storyboarding features.

Pick a model

ModelPriceStrength
minimax-h312 Credits / secondomni-modal, generates native stereo audio
kling-3.0-omni21 Credits / secondtext/image/reference-video modes in one family

A 10-second clip costs 120 credits on MiniMax H3 or 210 on Kling 3.0 Omni. Failed tasks are not charged.

1. Submit

const headers = { Authorization: `Bearer ${process.env.ORUX_API_KEY}`, "Content-Type": "application/json" }

const submit = await fetch("https://orux.top/api/v1/tasks", {
  method: "POST", headers,
  body: JSON.stringify({
    model: "minimax-h3",
    input: { prompt: "a paper boat sailing down a rainy street gutter, ambient rain sound" },
  }),
})
const { task_id } = await submit.json()

2. Poll

let task
do {
  await new Promise((r) => setTimeout(r, 10000))
  task = await (await fetch(`https://orux.top/api/v1/tasks/${task_id}`, { headers })).json()
  console.log(task.status)
} while (task.status === "QUEUED" || task.status === "RUNNING")

if (task.status === "SUCCESS") console.log("video:", task.result[0])

Video renders take longer than images (typically tens of seconds to a few minutes depending on model and duration). Poll every 10 seconds and persist the task id — if your process restarts, you can resume polling instead of paying for a second submission.

Cost control

  • Duration drives cost: a 15-second clip costs 2× the 7-second one.
  • Decide the clip length before submitting; the model page lists each model's allowed durations.
  • Show an estimated cost in your own UI before the user confirms — it prevents refund requests.

Next steps

Compare all video models on the model market, and see each model page for durations, resolutions and image-input options.

← All use cases