> ## 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
> Reactor hosts multiple models, each with its own connect slug (modelName) and command/event schema. The catalog of every model — slug, typed SDK package, and links to its schema — is at /model-api-reference/overview. 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

> From zero to a streaming model in 2 minutes.

Everything runs through the `reactor` CLI. Install it, scaffold a project, and run it. The CLI
builds a container with the runtime already inside, so there is nothing to install on your host but
the CLI itself and Docker.

## Install the CLI

```sh theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
curl -fsSL https://reactor.inc/install | bash
```

```sh theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
reactor version
```

Pinning a release in CI? See [Install the CLI](/deploy/platform/installation).

## Scaffold a project

```bash theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
reactor init my-model
```

This creates a ready-to-run project:

```
my-model/
├── model.py            # Your model. The only file you need to edit to start
├── reactor.yaml        # Model name, version, runtime entrypoint, and the image
├── config.yaml         # Model config, handed to your model at load time
├── requirements.txt    # Python dependencies
├── deployment.yaml     # Which GPUs and regions to run on, once you deploy
├── .dockerignore       # Paths kept out of the image build
└── README.md
```

`reactor.yaml` describes the image. The scaffolded `build:` block is one line that pins the
runtime release:

```yaml reactor.yaml theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
build:
  runtime_version: "3.2.5"
```

[Build the image](/deploy/platform/build) covers the full `build:` block. Bump `runtime_version` to
upgrade the runtime; releases are immutable, so there is no `latest` to track.

The scaffolded `model.py` is a small working `ReactorModel` that generates frames on its own and
takes one command, so you can stream something before you write any code. Run it first, then replace
it with your own model.

## Run it

```bash theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
cd my-model
reactor run
```

The first run builds the image, which takes a minute. Then the runtime starts and waits:

```
INFO __main__: starting reactor runtime version=3.2.5 model=model:MyModel host=0.0.0.0 port=8080
INFO reactor_runtime.runner.runner: model loaded; session ready model=MyModel tracks=1 commands=1
INFO reactor_runtime.service: runtime started components="['http', 'runner']"
```

Nothing is generated yet. The model produces frames only while a client is connected, so the next
step is to attach one.

## Connect a client

The fastest option is the [Reactor Sandbox](https://reactor-sandbox.vercel.app/): open it, pick
**Local (Direct)**, and click **Connect**. Frames start streaming immediately.

To build your own frontend, point the [JS SDK](https://docs.reactor.inc) at your local model with
`local: true`:

<CodeGroup>
  ```tsx React theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
  import { ReactorProvider, ReactorView } from "@reactor-team/js-sdk";

  <ReactorProvider modelName="my-model" local={true} autoConnect={true}>
    <ReactorView className="w-full aspect-video" />
  </ReactorProvider>
  ```

  ```javascript Vanilla JS theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
  import { Reactor } from "@reactor-team/js-sdk";

  const reactor = new Reactor({ modelName: "my-model", local: true });
  await reactor.connect();
  const stream = reactor.getMediaStream("main_video");
  document.querySelector("video").srcObject = stream;
  ```
</CodeGroup>

## The iteration loop

`reactor build` and `reactor run` share one image tag, and `run` reuses whatever image is already
there. So the loop is always the same two commands:

<Steps>
  <Step title="Edit your model">
    Change `model.py`, `config.yaml`, or anything else in the project.
  </Step>

  <Step title="Rebuild">
    ```bash theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
    reactor build
    ```

    This bakes your current code and dependencies into the image.
  </Step>

  <Step title="Run">
    ```bash theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
    reactor run
    ```

    Boots the image you just built and starts serving on port 8080.
  </Step>
</Steps>

Editing a file does not change the running container, and `reactor run` on its own will not pick the
change up: it reuses the existing image. Chain them while you iterate:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
reactor build && reactor run
```

## What `reactor run` actually does

1. Builds the image defined by the `build:` block in `reactor.yaml` if it does not exist yet, and
   reuses it otherwise.
2. Starts the container, maps port 8080 to your host, and sets `PORT` to match.
3. Inside the container, the runtime reads `reactor.yaml` and resolves `runtime.import`
   (`model:MyModel` means the class `MyModel` in `model.py`).
4. It calls your model's `load()` once, passing the path to `runtime.config`.
5. It serves WebRTC signaling on that port and waits.

The runtime reads its settings from environment variables. `HOST` and `PORT` name the address it
binds, so `reactor run --port` maps the host port and sets `PORT` in the container to match.

When a client connects, the runtime wakes your `run()` loop and streams whatever it emits.

## Command reference

`reactor run` starts the model.

| Flag                             | Description                                                               |
| -------------------------------- | ------------------------------------------------------------------------- |
| `--port <number>`                | Host port mapped onto the container. Default 8080.                        |
| `--gpus <value>`                 | Forwarded to `docker run --gpus`. No GPUs are attached unless you set it. |
| `--device <path>`                | Forwarded to `docker run --device`. Repeatable.                           |
| `-e <KEY>` / `--env <KEY=VALUE>` | Forward a host environment variable into the container. Repeatable.       |
| `--env-file <path>`              | Dotenv-style file forwarded into the container.                           |
| `--tty`                          | Allocate a TTY.                                                           |
| `--platform <value>`             | Target platform of the auto-build. Default `linux/amd64`.                 |

`reactor build` builds the image without running it.

| Flag                                 | Description                                                 |
| ------------------------------------ | ----------------------------------------------------------- |
| `-f <path>` / `--dockerfile <path>`  | Use a non-default Dockerfile, for example `Dockerfile.gpu`. |
| `--no-cache`                         | Skip the layer cache and rebuild every step.                |
| `--build-secret id=<name>,env=<var>` | Forward a BuildKit secret, for private package pulls.       |
| `--platform <value>`                 | Target platform. Default `linux/amd64`.                     |

<Tip>
  Builds target `linux/amd64`, the platform Reactor serves models on, so on an Apple Silicon Mac the
  default build runs under emulation. Pass `--platform linux/arm64` for a faster local loop, and
  drop it before publishing.
</Tip>

## Next

<CardGroup cols={2}>
  <Card title="Model Anatomy" icon="microscope" href="https://docs.reactor.inc/deploy/development/reactor-model/model-anatomy">
    Replace the scaffold with your own model, line by line.
  </Card>

  <Card title="The Run Loop" icon="play" href="https://docs.reactor.inc/deploy/development/reactor-model/run-loop">
    Emitting frames, batches, and frame rates.
  </Card>

  <Card title="Load Your Weights" icon="box" href="https://docs.reactor.inc/deploy/development/weights">
    Resolve checkpoints the same way locally and in production.
  </Card>

  <Card title="Deploy to Reactor" icon="cloud" href="/deploy/platform/deploying">
    Register, publish, and go live on Reactor's GPUs.
  </Card>
</CardGroup>
