Skip to main content
Orux AIOruxAI

AI Video Generation: From Prompt to MP4

Submit a video-generation task, poll its status, and retrieve the completed output using one async API.

ai video generation api

Models available now

Browse full catalog

What you'll build

Submit a video-generation task, keep its task ID, poll the task, and retrieve the completed output. The accepted prompt, image, duration, and resolution fields vary by model.

1. Choose a model

Open the video model catalog and review the model detail page for its input schema, supported output settings, and current price. Create an API key from Keys.

2. Submit a generation task

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

const response = await fetch("https://orux.top/api/v1/tasks", {
  method: "POST",
  headers,
  body: JSON.stringify({
    model: "YOUR_VIDEO_MODEL_ALIAS",
    input: { prompt: "a paper boat sailing down a rainy street gutter" },
  }),
})

if (!response.ok) throw new Error(await response.text())
const { task_id } = await response.json()
Swipe horizontally to view the full content

Use the exact input property names documented by the selected model.

3. Poll and retrieve the output

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

if (task.status !== "SUCCESS") throw new Error(task.error?.message ?? task.status)
console.log(task.result)
Swipe horizontally to view the full content

Persist the task ID so a restarted process can continue polling instead of submitting the same request again. Failed or expired tasks are not charged.

Cost control

  • Duration and output settings can affect the total charge. Check the selected model's current price and supported values before submission.
  • Show the estimate to the user before confirming the task.

Next steps

Compare the video models, review the pricing page, and read the API quickstart.

← All use cases