> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reactor.inc/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> To build and serve your own model, start at /deploy/development/quickstart and /deploy/development/overview. Authenticate with reactor auth login, scaffold with reactor init, then run reactor deploy production from the workspace. Deploy builds remotely by default, creates a missing workspace project and its production environment, and waits for rollout. No local Docker or model.version bump is needed. Projects own images and weight sets; environments select the image, weights, GPU, instance count, and variables. Create staging explicitly with reactor environment create staging before deploying to it. Use reactor scale for capacity and reactor rollback for an earlier revision’s image and weights. See /deploy/platform/projects and /deploy/platform/deploy. Client SDK modelName remains account-qualified and selects production by default. Model code imports reactor_runtime; Python client code imports reactor_sdk. Local testing is optional; /deploy/development/local-testing covers reactor run, which needs Docker.
> Reactor hosts multiple models, each with its own connect slug (modelName) and command/event schema. The video model catalog — slug, typed SDK package, and links to its schema — is at /model-api-reference/overview. Robotics policy documentation starts at /robotics/overview; The launch policies are Cosmos Nano DROID (/robotics/cosmos/nano-policy-droid/), DreamZero DROID (/robotics/dreamzero/droid/), and FLUX Action DROID (/robotics/flux-action/droid/), organized by model family and embodiment. Some models expose one slug per experience (e.g. HappyOyster); always take the slug from the model's own pages, never guess it.
> Fastest path to a working app: `npx create-reactor-app my-app --model=<slug>` scaffolds a complete app with secure auth wired up. Typed TypeScript SDKs are published as @reactor-models/<model>; Python uses the base reactor-sdk package.
> Auth: exchange an API key (rk_...) for a JWT via POST https://api.reactor.inc/tokens from your server. Never put the API key in client-side code.
> Append .md to any docs URL for clean Markdown. Search these docs via the MCP server at https://docs.reactor.inc/mcp.

# Quickstart

> Submit a prompt, poll for completion, and save your first generated clip.

[Overview](https://docs.reactor.inc/generations/overview) · [API reference](https://docs.reactor.inc/generations/api-reference) ·
[Model APIs](https://docs.reactor.inc/model-api-reference/overview.md#available-models)

## Set up

Use Node.js 20 or later, or Python 3.10 or later with `requests` installed (`python -m pip install
requests`). These examples run on your server and use HTTP directly.

Set `REACTOR_API_KEY` in your environment to your Reactor API key. Keep it out of browser code and
source control.

## Generate and save a clip

Save the JavaScript example as `generate.mjs` and run `node generate.mjs`, or save the Python example
as `generate.py` and run `python generate.py`. Both submit one eight-second FastH3 request and save
`output.mp4` in the current directory.

The examples print the generation ID so you can resume polling it. They retry temporary polling
errors, honor `Retry-After`, and stop on a failed generation. The ten-minute polling deadline is a
local example limit, not a service timeout; reaching it does not cancel the generation.

```javascript JavaScript theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
import { writeFile } from "node:fs/promises";

const base = "https://api.reactor.inc";
const key = process.env.REACTOR_API_KEY;
if (!key) throw new Error("Set REACTOR_API_KEY");
const headers = { Authorization: `Bearer ${key}` };
const sleep = (seconds) => new Promise((resolve) => setTimeout(resolve, seconds * 1000));
const delay = (response) => {
  const seconds = Number(response.headers.get("Retry-After") ?? 5);
  return Number.isFinite(seconds) && seconds > 0 ? seconds : 5;
};

const created = await fetch(`${base}/generations`, {
  method: "POST",
  headers: { ...headers, "Content-Type": "application/json" },
  body: JSON.stringify({
    model: "reactor/fast-h3",
    input: {
      prompt: "A paper boat drifts on a quiet pond, with gentle water sounds",
      seconds: 8,
      aspect: "16:9",
    },
  }),
  signal: AbortSignal.timeout(60_000),
});
if (!created.ok) {
  throw new Error(`Create ${created.status}: ${await created.text()}`);
}
let generation = await created.json();
console.log("Generation ID:", generation.id);
const deadline = Date.now() + 10 * 60_000;
let wait = delay(created);

while (generation.status === "queued" || generation.status === "running") {
  if (Date.now() + wait * 1000 >= deadline) {
    throw new Error(`Polling deadline reached; resume GET /generations/${generation.id}`);
  }
  await sleep(wait);
  const response = await fetch(`${base}/generations/${generation.id}`, {
    headers,
    signal: AbortSignal.timeout(30_000),
  });
  wait = delay(response);
  if (response.status === 429 || response.status === 503) {
    await response.text();
    continue;
  }
  if (!response.ok) throw new Error(`Poll ${response.status}: ${await response.text()}`);
  generation = await response.json();
}
if (generation.status !== "succeeded") {
  throw new Error(`Generation ${generation.id}: ${JSON.stringify(generation.error)}`);
}
const video = generation.files.find((file) => file.name === "output.mp4");
if (!video) throw new Error("No output.mp4 in the result");
// Signed URLs authenticate the download; do not send the API key.
const download = await fetch(video.url, { signal: AbortSignal.timeout(120_000) });
if (!download.ok) throw new Error(`Download ${download.status}; poll for a fresh URL`);
await writeFile("output.mp4", Buffer.from(await download.arrayBuffer()));
console.log("Saved output.mp4");
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
import os
import time
from pathlib import Path

import requests

base = "https://api.reactor.inc"
headers = {"Authorization": f"Bearer {os.environ['REACTOR_API_KEY']}"}


def delay(response):
    try:
        seconds = float(response.headers.get("Retry-After", "5"))
        return seconds if 0 < seconds < float("inf") else 5
    except ValueError:
        return 5


created = requests.post(
    f"{base}/generations",
    headers=headers,
    json={
        "model": "reactor/fast-h3",
        "input": {
            "prompt": "A paper boat drifts on a quiet pond, with gentle water sounds",
            "seconds": 8,
            "aspect": "16:9",
        },
    },
    timeout=60,
)
if not created.ok:
    raise RuntimeError(f"Create {created.status_code}: {created.text}")
generation = created.json()
print("Generation ID:", generation["id"])
deadline = time.monotonic() + 10 * 60
wait = delay(created)

while generation["status"] in ("queued", "running"):
    if time.monotonic() + wait >= deadline:
        raise TimeoutError(f"Resume GET /generations/{generation['id']}")
    time.sleep(wait)
    response = requests.get(
        f"{base}/generations/{generation['id']}", headers=headers, timeout=30
    )
    wait = delay(response)
    if response.status_code in (429, 503):
        continue
    if not response.ok:
        raise RuntimeError(f"Poll {response.status_code}: {response.text}")
    generation = response.json()

if generation["status"] != "succeeded":
    raise RuntimeError(f"Generation {generation['id']}: {generation['error']}")
video = next(file for file in generation["files"] if file["name"] == "output.mp4")
# Signed URLs authenticate the download; do not send the API key.
download = requests.get(video["url"], timeout=120)
if not download.ok:
    raise RuntimeError(f"Download {download.status_code}; poll for a fresh URL")
Path("output.mp4").write_bytes(download.content)
print("Saved output.mp4")
```

If creation returns `429`, wait for `Retry-After` before submitting again. The examples do not
repeat creation automatically: a network failure can leave you uncertain whether a request was
accepted. For a polling network failure, resume with the printed ID rather than starting over.
See [errors and retries](https://docs.reactor.inc/generations/api-reference#request-errors-and-retries).

## Use reference files

[Upload a file](https://docs.reactor.inc/generations/api-reference#upload-files) and wait for the PUT to succeed before
submitting a generation with its `file_id`. A file with no uploaded bytes is rejected with `400`.
Pass the ID in a field supported by your selected model. For example, FastH3 accepts
`starting_frame`, and FastH3-Omni accepts `reference_images` and `reference_audios`.
Find supported fields and file limits in your model's
[Model APIs](https://docs.reactor.inc/model-api-reference/overview.md#available-models) docs.

Download results within 48 hours of completion. If a signed download URL expires, poll the same
generation for fresh URLs. To cancel a request, see
[Cancel a generation](https://docs.reactor.inc/generations/api-reference#cancel-a-generation).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.