OyeFilmy Logo
personFreeUpgrade
bolt0cr
U

Get started

Webhooks & Polling

OyeFilmy AI generation is asynchronous. Learn how to receive your results via polling or webhooks.

How async processing works

When you call POST /api/generate, the server immediately returns a predictionId and begins processing in the background. You have two options to receive the result:

Polling workflow

Poll GET /api/generate/status/:predictionId at regular intervals until the job completes:

// 1. Start the generation
const res = await fetch("https://api.oyefilmy.com/api/generate", {
  method: "POST",
  headers: {
    "Authorization": "Bearer of_live_YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    modelKey: "seedance_2_0_fast_t2v",
    prompt: "A drone shot flying over misty mountains at sunrise",
    aspectRatio: "16:9",
    duration: 5,
  }),
});
const { predictionId } = await res.json();

// 2. Poll until complete
let result;
do {
  await new Promise(r => setTimeout(r, 3000)); // Wait 3s
  const statusRes = await fetch(
    `https://api.oyefilmy.com/api/generate/status/${predictionId}`,
    { headers: { "Authorization": "Bearer of_live_YOUR_API_KEY" } }
  );
  result = await statusRes.json();
  console.log("Status:", result.status); // "processing" → "completed"
} while (result.status === "processing");

// 3. Use the result
if (result.status === "completed") {
  console.log("Output URL:", result.outputUrl);
}

Polling status values

StatusDescriptionAction
processingQueued or generatingKeep polling
completedGeneration complete, output availableRead url
failedGeneration failed — credits are refunded automaticallyRead error

Recommended interval: Poll every 3 seconds for image models, every 5 seconds for video models. Video generation can take 30–120 seconds.

Collecting results

Polling is currently the only way to receive a result. Start the generation, keep the predictionId, and poll GET /api/generate/status/:predictionId until it reports completed or failed. Poll every 3 seconds for images and every 5 for video; video typically takes 30–120 seconds.