VidGuy Docs

Build videos faster with VidGuy

Guides and best practices for turning prompts into platform-ready videos.

Polling

Snack generation is asynchronous. POST /api/v1/snacks returns immediately with a jobId; you poll GET /api/v1/jobs/{id} until the job reaches a terminal state.

Recommended flow

  1. POST /api/v1/snacks with a brandId (and optionally render: true).
  2. Save the returned jobId and pollUrl.
  3. Poll GET /api/v1/jobs/{id} until status is completed or failed.
  4. On completed, read the manifest (and result.renderedAssets[] if you set render: true).

Recommended interval

  • Start at 3-5 seconds. The poll endpoint is cheap and not rate-limited.
  • A typical snack job completes in 60-90 seconds (manifest only) or 90-150 seconds with render: true.
  • If you don't see a terminal state after 15 minutes, our auto-fail sweeper marks the job failed and refunds credits — no action needed on your side.

Job states

StateMeaning
queuedAccepted; waiting for the Modal worker to pick it up
processingActively running (LLM copy plan + asset matching + optional render)
completedManifest (and rendered assets if requested) ready in result
failedJob failed; credits refunded if appropriate. See error

Polling reference (Node.js)

async function generateSnack(apiKey, brandId, render = false) {
  const start = await fetch("https://vidguy.ai/api/v1/snacks", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${apiKey}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ brandId, render }),
  }).then((r) => r.json());

  if (!start.jobId) throw new Error(JSON.stringify(start));

  while (true) {
    const job = await fetch(`https://vidguy.ai${start.pollUrl}`, {
      headers: { Authorization: `Bearer ${apiKey}` },
    }).then((r) => r.json());

    if (job.status === "completed") return job.result;
    if (job.status === "failed") {
      throw new Error(`Snack generation failed: ${job.error}`);
    }
    await new Promise((r) => setTimeout(r, 4000));
  }
}

Settlement timing

On the first poll after a job reaches completed, you may briefly see creditsFinal: null even though status: "completed". The next poll will show the settled value. This is expected and matches the behavior of every async offering — there's no double-charge risk.