> ## 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. Deploying is the default path: reactor init scaffolds a workspace, reactor auth login authenticates, and reactor model deploy registers the model, publishes the release with the weights/ folder, and activates it on Reactor's GPUs, in one command from that workspace. Docker must be running, because the publish step builds the image locally. Bump model.version in reactor.yaml before redeploying a change, because a release that already has an image is reactivated as it is. Deployment access is granted per account, so contact team@reactor.inc if a deploy is refused. Every key in reactor.yaml is documented at /deploy/platform/reactor-yaml. Model code imports reactor_runtime; Python client code imports reactor_sdk. The runtime overview explains the model interface. Running the model on your own machine with reactor run is optional and needs a GPU you attach with --gpus; /deploy/development/local-testing covers that loop and pairs a complete brightness model with a Python client test in a separate brightness-test workspace.
> 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.

# Pika H3 Flex overview

> Generate video with synchronized audio from a prompt, first and last frames, or image, video, and audio references.

**Pika H3 Flex** generates video clips with synchronized audio. A prompt is all it needs. You can
also set the clip's first frame, its last frame, or both from your own images. Or you can steer it
with references: up to nine images for characters, objects, and settings, up to three audio clips
for voices and sound, and up to three reference videos, which are experimental. To carry a scene
forward, continue an earlier clip from its last frame, or from its last few seconds of picture and
sound.

You never choose a mode. The model picks how to build each clip from the inputs you send. Frame
images and references cannot share a clip.

Clips wait in a queue until they are ready, and then you play them. While one clip plays, you can
queue more, change their order, or turn on autoplay so that ready clips play as they arrive.

The Pika H3 Flex reference has four pages: this overview, the
[schema](https://docs.reactor.inc/model-api-reference/pika-h3-flex/schema.md) with every command and message, the
[prompt guide](https://docs.reactor.inc/model-api-reference/pika-h3-flex/prompt-guide.md) for writing scenes with references,
and the [tutorial](https://docs.reactor.inc/model-api-reference/pika-h3-flex/tutorial.md), which walks through uploads, queues,
and playback.

Pika H3 Flex speaks the same wire protocol as every other Reactor model: you open a session with the
[`Reactor`](https://docs.reactor.inc/sdk-reference/reactor-class) class, send named commands, and receive messages. Its
model name is **`reactor/pika-h3-flex`**. The
[`@reactor-models/pika-h3-flex` typed package](https://docs.reactor.inc/sdk-reference/typed-model-sdk) adds named methods
and React hooks on top of the same protocol.

## At a glance

| Spec | Value |
| - | - |
| Model name | `reactor/pika-h3-flex` |
| Pricing | |
| Input | Text; a first frame, a last frame, or both; or up to 9 reference images, 3 audio clips, and 3 videos (experimental) |
| Continuation | From a clip's last frame, or from its last 2.33 seconds of picture and sound |
| Output tracks | `main_video` and `main_audio` |
| Clip length | 5 to 15.083 seconds. `state_update.clip_seconds_choices` lists the exact values. |
| Aspect ratios | 21:9, 16:9, 3:2, 4:3, 5:4, 1:1, 4:5, 3:4, 2:3, 9:16, and 9:21 |
| Resolution | `768p` (1344 × 768 at 16:9, the default) or `480p` (832 × 480 at 16:9) |
| Video size | `canvas_accepted` and `resolution_accepted` report the size for other aspect ratios and resolutions. |
| Prompt budget | 2,048 text tokens, including the labels for references and frame images |

## Key features

> [card] Video with sound
>
> Describe the scene, the camera, the dialogue, and the soundscape in one prompt.

> [card] Frames and references
>
> Start or end a clip on your own image, or steer it with reference images, audio, and video:
> characters, objects, settings, voices, and sound.

> [card] Clip control
>
> Queue clips, choose the playback order, and continue a generated scene.

## Quick start

> [tab] npm
>
> ```shell theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
> npx create-reactor-app my-pika-app --model=pika-h3-flex
> ```

> [tab] pnpm
>
> ```shell theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
> pnpm create reactor-app my-pika-app --model=pika-h3-flex
> ```

Create a session token on your server, then connect with the base JavaScript SDK or the typed
`@reactor-models/pika-h3-flex` package. Do not put your `rk_` API key in browser code. See
[Authentication](https://docs.reactor.inc/authentication.md) for how to create tokens.

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

const reactor = new Reactor({ modelName: "reactor/pika-h3-flex" });
const video = document.querySelector("video")!;
const audio = document.querySelector("audio")!;

reactor.on("trackReceived", (name, _track, stream) => {
  if (name === "main_video") {
    video.srcObject = stream;
    void video.play().catch(console.error);
  }
  if (name === "main_audio") {
    audio.srcObject = stream;
    void audio.play().catch(console.error);
  }
});

reactor.on("message", async (message) => {
  if (message.type === "clip_generated") {
    const { clip } = message.data as { clip: { clip_id: string } };
    await reactor.sendCommand("play", { clip_id: clip.clip_id });
  }
});

reactor.on("statusChanged", async (status) => {
  if (status !== "ready") return;
  await reactor.sendCommand("enqueue", {
    prompt:
      "A ceramic artist turns a blue bowl on a wheel in a sunlit studio. The camera slowly pushes in. The wheel hums and rain taps the window. No music.",
  });
});

await reactor.connect(await getToken()); // Implement getToken() on your server.
```

```tsx React theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
import {
  PikaH3FlexProvider,
  PikaH3FlexMainVideoView,
  usePikaH3Flex,
  usePikaH3FlexClipGenerated,
} from "@reactor-models/pika-h3-flex";

export function App({ token }: { token: string }) {
  return (
    <PikaH3FlexProvider jwtToken={token} connectOptions={{ autoConnect: true }}>
      <Player />
    </PikaH3FlexProvider>
  );
}

function Player() {
  const { status, enqueue, play } = usePikaH3Flex();

  usePikaH3FlexClipGenerated((message) => {
    void play({ clip_id: message.clip.clip_id });
  });

  return (
    <>
      <PikaH3FlexMainVideoView audioTrack="main_audio" muted={false} className="w-full" />
      <button
        disabled={status !== "ready"}
        onClick={() =>
          void enqueue({
            prompt:
              "A ceramic artist turns a blue bowl on a wheel in a sunlit studio. The camera slowly pushes in. The wheel hums and rain taps the window. No music.",
          })
        }
      >
        Generate
      </button>
    </>
  );
}
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark-high-contrast"}}
import asyncio
import os
from reactor_sdk import Reactor, ReactorStatus

async def main():
    reactor = Reactor(model_name="reactor/pika-h3-flex",
                      api_key=os.environ["REACTOR_API_KEY"])

    @reactor.on_status(ReactorStatus.READY)
    async def on_ready(status):
        await reactor.send_command("enqueue", {
            "prompt": "A ceramic artist turns a blue bowl on a wheel in a sunlit studio. The camera slowly pushes in. The wheel hums and rain taps the window. No music.",
        })

    @reactor.on_message
    def on_message(msg):
        if msg["type"] == "clip_generated":
            asyncio.ensure_future(
                reactor.send_command("play", {"clip_id": msg["data"]["clip"]["clip_id"]})
            )

    await reactor.connect()
    await asyncio.Event().wait()  # run until interrupted

asyncio.run(main())
```

## How it works

1. Connect to `reactor/pika-h3-flex`. The model describes the session with a `state_update` and a
   `queue_update`.
2. If you want frame images or references, upload them first. Then call `enqueue` with a prompt. The
   model picks how to build the clip from what you send.
3. Wait for `clip_generated`, then call `play` to stream the clip, or turn on autoplay instead.
4. Queue more clips, change their order, or continue a clip that has finished generating.


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