DEV Community

Alex
Alex

Posted on

AI video from n8n with the HTTP Request node: start the job, poll it, download the file

Disclosure: I run UberLLM; the examples use its API, but the setup works the same with any compatible provider where noted.

AI video is not a normal request/response call. A clip takes a minute or more, so video APIs treat it as a job: you start it, check on it, and download the file when it is done. n8n handles that with nodes it already has: HTTP Request, Wait and If. No community node, works on n8n Cloud and self-hosted.

The shape below (start, wait, poll, branch, download) works with any job-style video API. The URLs and field names are UberLLM's; swap them for your provider's.

The workflow

Manual Trigger
  → Settings (Set)
  → Start video (HTTP Request, POST)
  → Wait for video (Wait, 15 s)  ←──────────────┐
  → Check video job (HTTP Request, GET)          │
  → Video ready? (If: status = succeeded)        │
       yes → Video result (Set) → Video (HTTP Request, file)
       no  → Still making video? (If) ── yes ────┘
                                       no → Stop and Error
Enter fullscreen mode Exit fullscreen mode

1. One credential for every node

In any HTTP Request node: Authentication → Generic credential type → Header Auth → Create new:

  • Name: Authorization
  • Value: Bearer ull_... (your key)

Every HTTP node in the workflow uses this same credential, including the download.

2. Settings

A Set node keeps the inputs in one place:

Field Value
prompt your prompt
model fal-ai/veo3.1/fast
duration_seconds 8
resolution 720p
aspect_ratio 16:9
audio true
max_cost 1.5

max_cost is a ceiling in US dollars: a job that could cost more is refused with 400 max_cost_too_low before anything is charged.

3. Start the job

HTTP Request node, POST https://api.uberllm.dev/v1/video/generations, Send Headers on:

Header Value
Idempotency-Key {{ $execution.id }}-video
X-UberLLM-Source n8n

Send Body → JSON → this expression:

{{ JSON.stringify({
  model: $json.model,
  prompt: $json.prompt,
  duration_seconds: $json.duration_seconds,
  resolution: $json.resolution,
  aspect_ratio: $json.aspect_ratio,
  audio: $json.audio,
  max_cost: $json.max_cost
}) }}
Enter fullscreen mode Exit fullscreen mode

The answer comes back at once with HTTP 202:

{
  "id": "6f1c…",
  "object": "media.job",
  "kind": "video",
  "status": "queued",
  "model": "fal-ai/veo3.1/fast",
  "estimated_cost_usd": …,
  "max_cost_usd": …,
  "poll_url": "/v1/video/generations/6f1c…"
}
Enter fullscreen mode Exit fullscreen mode

max_cost_usd is held from your balance while the job runs and is the most it can be billed.

Why the Idempotency-Key matters in n8n: if the connection drops and n8n retries the node, the same key within 24 hours returns the same job instead of starting (and paying for) a second one. The same key with a different body is refused with 409 idempotency_key_reused. Building the key from $execution.id gives one key per run. If your provider supports idempotency keys, use them the same way.

4. Wait, then poll

Wait node: 15 seconds.

Check video job, HTTP Request, GET, URL as an expression:

{{ 'https://api.uberllm.dev/v1/video/generations/' + $json.id }}
Enter fullscreen mode Exit fullscreen mode

The job is in one of six states:

status HTTP Means
queued 202 Accepted, waiting to start
running 202 Being made
succeeded 200 Done; the file is in results[].url
failed 200 Not made; error.message says why
canceled 200 Stopped before it was made
expired 200 Not finished in time

Two If nodes do the branching:

  • Video ready?: {{ $json.status }} equals succeeded.
  • Still making video? (on the false branch): a boolean expression that loops back to Wait while the job runs, with a limit:
{{ ['queued', 'running'].includes($json.status) && $runIndex < 60 }}
Enter fullscreen mode Exit fullscreen mode

60 checks × 15 seconds is 15 minutes. Most videos take 1 to 5 minutes. If the loop gives up, the job still finishes and is billed (or refunded) on the server, so nothing is lost by stopping to wait. The docs suggest checking every 5 to 10 seconds; 15 keeps the execution log shorter.

The false branch ends in Stop and Error with the reason:

{{ 'The video job ' + $json.id + ' ended as ' + $json.status + ': ' +
   ($json.error && $json.error.message ? $json.error.message : 'it took too long to wait for') }}
Enter fullscreen mode Exit fullscreen mode

failed, canceled and expired jobs cost nothing; the hold comes back.

5. Download the file

A Set node pulls out what you need from the finished job: job_id = {{ $json.id }}, url = {{ $json.results[0].url }}, and the cost from usage.cost_usd.

The exact charge arrives a little after the file is ready, usually within 30 seconds. Until then a succeeded job shows "usage": { "cost_usd": null, "cost_pending": true }, so treat a null cost as "not in yet", not as zero.

Then the last HTTP Request: GET {{ $json.url }}, same credential, Options → Response → Response Format File, Put Output in Field data, and a generous timeout (the template uses 300000 ms). The video is now binary data, ready for Google Drive, S3 or YouTube nodes.

Two things to know about that link:

  • It needs your key, so a service that fetches a video by URL (Instagram, Blotato) cannot open it. Upload the file somewhere first.
  • Video files are kept for about 3 hours after the job ends. After that the download answers 404 artifact_expired.

To skip the download step, add output_upload_url (a presigned PUT link for S3, R2 or Google Cloud Storage) to the start request and the file is uploaded there when the job succeeds.

6. Or get called back instead of polling

Add callback_url (an n8n Webhook URL, https:// on a public host) to the start request. When the job has ended and its bill is final, UberLLM sends one POST with the same JSON the GET returns, plus UberLLM-Event, UberLLM-Event-Id and UberLLM-Signature headers. Answer with any 2xx within 15 seconds; otherwise it is retried after 30 seconds, 2 minutes, 10 minutes, 30 minutes and 2 hours. A message can arrive twice, so drop repeats by UberLLM-Event-Id.

Image to video

Use an image-to-video model and add image_url (a public https:// link) to the body, for example fal-ai/kling-video/v3/standard/image-to-video or fal-ai/veo3.1/fast/image-to-video. Most of these make the clip in the shape of your picture, so crop it first (9:16 for vertical) and leave aspect_ratio out. Without a picture they answer 400 image_required, before anything is charged.

Check the price first

Add "validate": true to the start body. Nothing is made or charged; the answer gives cost_usd (listed price) and max_cost_usd (what would be held).

For reference, the public catalog on November 20, 2026 listed fal-ai/veo3.1/fast at $0.085 per second at 720p without sound and $0.1275 per second with sound, so the 8-second clip above is about $1.02. Prices move; check before a big batch.

Coming from the Gemini "Generate a video" node

Google turned off the Veo 3.1 preview models in the Gemini API on 22 October 2026, which broke workflows built on that node. The model names map like this:

Gemini model UberLLM model
veo-3.1-generate-preview fal-ai/veo3.1
veo-3.1-fast-generate-preview fal-ai/veo3.1/fast
veo-3.1-lite-generate-preview fal-ai/veo3.1/lite

Import it instead of building it

The full workflow is a ready-made file: in n8n, ⋯ → Import from URL… and paste
https://raw.githubusercontent.com/PSA-Team-source/uberllm-n8n-templates/main/workflows/veo-3-1-fast-text-to-video.json. There are also Kling image-to-video, a faceless Shorts pipeline, a UGC product ad and a Gemini Veo replacement in the same repository. UberLLM is prepaid credit; there is no free tier.

Sources

Top comments (0)