TypeScript SDK
Official typed client: generate, poll, publish, verify webhooks.
Install
npm install @reeloop/sdk- npm: npmjs.com/package/@reeloop/sdk
- Source: github.com/theodorosmd/postai (
packages/reeloop-sdk) - Current version: 0.1.0 - pin with
npm install @reeloop/sdk@0.1.0 - Requires: Node.js >= 18 (uses the global
fetch)
Quickstart
import { ReeloopClient } from "@reeloop/sdk";const reeloop = new ReeloopClient(process.env.REELOOP_API_KEY!);
const { jobId } = await reeloop.generate({ topic: "5 facts about the ocean nobody knows", style: "documentary", voice: "charlotte", duration: "30", mode: "instant", // charge + render now; "director" (the default) is a free draft });
const done = await reeloop.waitForCompletion(jobId); console.log(done.finalVideoUrl); ```
What the SDK handles for you
- Idempotency - every
generate()sends a freshIdempotency-Key, so a network retry replays the original response instead of double-charging. Pass your own key to dedupe across calls. - Correct completion detection -
waitForCompletion()checksrenderStatus/finalVideoUrl(a job can readstatus: "completed"with a FAILED, refunded render) and rejects on failure. - Typed errors -
ReeloopApiErrorexposesstatus, the API'scode, rate-limit headers, and aretryableflag. - Webhook verification -
verifyWebhookSignature(rawBody, signatureHeader, secret)validatesX-Reeloop-Signature(HMAC-SHA256, constant-time) and returns the parsed payload.
import { verifyWebhookSignature } from "@reeloop/sdk";const payload = verifyWebhookSignature(rawBody, headers["x-reeloop-signature"], secret); if (!payload) return new Response("bad signature", { status: 401 }); ```
Sandbox
Use an fl_test_ key (see the Sandbox doc) to develop without spending credits - the SDK works identically against test keys.
Python
A Python client (reeloop-sdk, packages/reeloop-sdk-py in the repo) mirrors this SDK's method surface field-for-field. Not yet published to PyPI - install from source:
pip install "reeloop-sdk @ git+https://github.com/theodorosmd/postai.git#subdirectory=packages/reeloop-sdk-py"from reeloop_sdk import ReeloopClientreeloop = ReeloopClient(api_key) job = reeloop.generate(topic="5 facts about the ocean nobody knows", mode="instant") done = reeloop.wait_for_completion(job["jobId"]) ```