Inngest + ReelSDK $0.03 per output minute, first $0.50 free

Render video in an Inngest function with step.waitForEvent

An Inngest step returns at most 4 MiB, so ReelSDK captions the video on its own machines for $0.03 per output minute while your function sleeps in step.waitForEvent. Only URLs move between steps, well inside the 256 KiB a Free-plan event carries, and a 20-second clip comes back captioned in about 13 seconds.

  • Idempotency-Key on the job, event id from the webhook
  • The function sleeps in step.waitForEvent while ReelSDK renders
  • Final read with the key, even after a timeout
What Node's spawn throws inside a step when the serve host has no ffmpeg

Error: spawn ffmpeg ENOENT

Source: Node.js child_process

The same job as one call to ReelSDK

import { Inngest } from "inngest";

export const inngest = new Inngest({ id: "video-app" });

export const captionVideo = inngest.createFunction(
  { id: "caption-video", triggers: [{ event: "video/uploaded" }] },
  async ({ event, step }) => {
    const job = await step.run("start-captions", async () => {
      const res = await fetch("https://api.reelsdk.com/v1/captions", {
        method: "POST",
        headers: {
          Authorization: `Bearer ${process.env.REELSDK_KEY}`,
          "Content-Type": "application/json",
          Prefer: "respond-async",
          "Idempotency-Key": `captions-${event.id}`,
        },
        body: JSON.stringify({
          video_url: event.data.videoUrl,
          style: "karaoke",
          webhook_url: process.env.INNGEST_WEBHOOK_URL,
        }),
      });

      const { job, error } = await res.json();
      if (!res.ok) throw new Error(`reelsdk ${res.status}: ${JSON.stringify(error)}`);
      return { id: job.id as string };
    });

    const finished = await step.waitForEvent("wait-for-reelsdk", {
      event: "reelsdk/job.finished",
      timeout: "2h",
      if: `async.data.id == "${job.id}"`,
    });

    // The webhook is a hint; the job read with the key is the answer, even after a timeout
    return await step.run("read-job", async () => {
      const res = await fetch(`https://api.reelsdk.com/v1/jobs/${job.id}?wait=60`, {
        headers: { Authorization: `Bearer ${process.env.REELSDK_KEY}` },
      });
      const { job: done } = await res.json();
      if (done.status !== "succeeded") throw new Error(`reelsdk job ${job.id} ${done.status}`);
      return { video: done.outputs.video as string, srt: done.outputs.srt as string, viaWebhook: finished !== null };
    });
  },
);
The function sleeps in step.waitForEvent until the webhook event arrives, then returns the video and srt linksTry it

Why ffmpeg breaks here

Steps carry URLs, never video

Inngest calls your server through serve for every step, so a step that spawns ffmpeg needs the binary on that server, or Node throws spawn ffmpeg ENOENT. The step also has to finish within that server's request timeout, even though Inngest allows a step up to 2 hours. A step returns at most 4 MiB, and an event carries at most 256 KiB on Free and 3 MiB on Pro, so video bytes can't move between steps.

The first step.run starts a captions job with Prefer: respond-async and an Idempotency-Key built from the event id, so a retried step doesn't start a second job. step.waitForEvent then sleeps until an event whose data.id matches the job. ReelSDK POSTs the finished job to an Inngest webhook, and the transform turns it into a reelsdk/job.finished event with ReelSDK's Idempotency-Key as the event id. The last step reads the job with the key either way, so a missed or forged event can't hand back the wrong links. Captions cost $0.03 per output minute.

Inngest next to ReelSDK

Inngest next to ReelSDK
LimitInngestReelSDK
Step output4 MiB per step, 32 MiB of run stateOutputs as URLs, kept 7 days
Event size256 KiB on Free, 3 MiB on ProInputs by URL, up to 500 MB each
Step durationUp to 2 hours, capped by your host's timeoutJobs up to 10 min while the function sleeps
Steps1,000 per function3 here: start, wait, read
WebhooksTransform on Inngest, no signature checkSigned, up to 6 attempts over about 7 h
PriceFree $0 with 50k executions a month, Pro from $99$0.03 per output minute for captions

Inngest limits from Inngest limits, checked November 2026.

Set it up

A webhook, a function, a test event

This uses the v4 SDK. The Inngest dev server isn't reachable from the internet, so ReelSDK's webhook can't get to it; to test locally, run a webhook body through the transform and send the resulting event yourself, and the waiting step picks it up.

  1. Create the Inngest webhook

    In the Inngest dashboard, create a webhook and paste the transform below. It names the event reelsdk/job.finished, passes the job JSON through as data, and uses ReelSDK's Idempotency-Key header, <job id>:<status>, as the event id. Put the webhook URL in INNGEST_WEBHOOK_URL on the server that serves your functions.

    transform.js
    function transform(evt, headers = {}, queryParams = {}) {
      return {
        id: headers["Idempotency-Key"],
        name: "reelsdk/job.finished",
        data: evt,
      };
    }
    
  2. Start the job and wait for the event

    The function in the fix block runs 3 steps: start-captions sends POST /v1/captions with webhook_url set to INNGEST_WEBHOOK_URL, wait-for-reelsdk waits up to 2 h for the matching event, and read-job reads the job with ?wait=60 and returns the video and srt URLs. Every ReelSDK job succeeds or fails within 60 min of being created, so 2 h covers it.

    Environment variables
    REELSDK_KEY
    Your ReelSDK API key
    INNGEST_WEBHOOK_URL
    The webhook URL from the Inngest dashboard
  3. Send a test event

    Send video/uploaded with a videoUrl in data. A 20-second clip comes back as a karaoke-captioned video with an srt about 13 seconds after the request, and the run returns viaWebhook: true.

FAQ

Video on Inngest, answered

Can an Inngest function run ffmpeg?

Only on a server that has the ffmpeg binary, within that server's request timeout, and with results under the 4 MiB a step can return. Starting the encode on ReelSDK keeps the function to HTTP calls and URLs, which fit in the 256 KiB a Free-plan event can carry.

How do I wait for a webhook in an Inngest function?

Point the provider at an Inngest webhook whose transform returns { name, data, id }, then call step.waitForEvent with that event name, a timeout and an if expression such as async.data.id == the job id. It returns the event, or null when the timeout passes. Use if or match, not both.

What if the event never matches the wait?

step.waitForEvent returns null when its timeout passes. The function doesn't depend on the event for its result: the read-job step always fetches the job with your key, waiting up to 60 s, and returns the video and srt URLs once the job has succeeded.

Does Inngest check ReelSDK's webhook signature?

No. Inngest doesn't verify provider webhook signatures. ReelSDK signs each delivery with a Reelsdk-Signature header, an HMAC-SHA256 over the timestamp and body, and the function here doesn't need to check it: the last step reads the job from ReelSDK with your key before it returns any links.

What does a captioned video cost?

ReelSDK bills captions at $0.03 per output minute, with the transcript and the srt, vtt and ass files in the same job. Inngest's Free plan is $0 with 50k executions a month, and Pro starts at $99 a month.

All integrations

Ready to build?

Ship video from your app today

Your first $0.50 is free, and one key covers every endpoint.

Moonlit lake with a lit cabin under the mountains