
<1sRound-trip latency
ZeroInfrastructure to manage
1,000sof GPUs, on demand
import { Reactor } from "@reactor-team/js-sdk";
const video = document.querySelector("video")!;
const reactor = new Reactor({ modelName: "reactor/helios" });
// Render frames as soon as they arrive.
reactor.on("trackReceived", (name, track) => {
if (name !== "main_video") return;
video.srcObject = new MediaStream([track]);
void video.play();
});
// Once the session is ready, set a prompt and start generating.
reactor.on("statusChanged", async (status) => {
if (status !== "ready") return;
await reactor.sendCommand("set_prompt", { prompt: "A serene mountain landscape at sunrise" });
await reactor.sendCommand("start", {});
});
const jwt = await getToken(); // token minted on your server
await reactor.connect(jwt);
import { ReactorProvider, ReactorView, useReactor } from "@reactor-team/js-sdk";
import { useEffect } from "react";
function Studio() {
const { status, sendCommand } = useReactor((s) => ({
status: s.status,
sendCommand: s.sendCommand,
}));
// Once the session is ready, set a prompt and start generating.
useEffect(() => {
if (status !== "ready") return;
sendCommand("set_prompt", { prompt: "A serene mountain landscape at sunrise" });
sendCommand("start", {});
}, [status]);
return <ReactorView className="w-full aspect-video" />;
}
export default function App({ token }: { token: string }) {
// token is minted on your server
return (
<ReactorProvider modelName="reactor/helios" jwtToken={token} connectOptions={{ autoConnect: true }}>
<Studio />
</ReactorProvider>
);
}
import asyncio
import os
from reactor_sdk import Reactor
async def main():
async with Reactor(model_name="reactor/helios", api_key=os.environ["REACTOR_API_KEY"]) as reactor:
await reactor.connect()
# Receive decoded frames as NumPy arrays.
output = reactor.tracks.with_direction("recvonly").with_kind("video").one()
@output.on_frame
def on_frame(frame):
...
# Set a prompt and start generating.
await reactor.send_command("set_prompt", {"prompt": "A serene mountain landscape at sunrise"})
await reactor.send_command("start", {})
asyncio.run(main())
#include <reactor/reactor.hpp>
reactor::Reactor client{"reactor/helios", reactor::ApiKey{std::getenv("REACTOR_API_KEY")}};
// Once the session is ready, set a prompt and start generating.
auto status = client.on_status([&client](reactor::Status s) {
if (s != reactor::Status::Ready) return;
client.send_command("set_prompt", {{"prompt", "A serene mountain landscape at sunrise"}});
client.send_command("start", {});
});
client.connect().get();
// Render frames as soon as they arrive.
auto output = client.track("main_video");
auto frames = output.on_frame([](const reactor::VideoFrame& frame) {
render(frame.bgra, frame.width, frame.height);
});
import Reactor
let reactor = try Reactor(model: "reactor/helios", jwt: token)
// Render frames as soon as they arrive.
let output = try reactor.track("main_video")
let frames = try output.onFrame { frame in
render(frame.pixels, frame.width, frame.height)
}
// Once the session is ready, set a prompt and start generating.
let status = reactor.onStatus { s in
guard s == .ready else { return }
Task {
try await reactor.sendCommand("set_prompt", ["prompt": "A serene mountain landscape at sunrise"])
try await reactor.sendCommand("start")
}
}
try await reactor.connect()
import inc.reactor.sdk.*;
// token is a session-scoped JWT minted on your server.
try (Reactor reactor = Reactor.open(ReactorOptions
.builder("https://api.reactor.inc", "reactor/helios")
.jwt(token)
.build())) {
try {
reactor.connect().join();
try (Subscription frames = reactor.track("main_video").onFrame((VideoFrame frame) -> {
System.out.printf("Frame: %dx%d%n", frame.width(), frame.height());
})) {
reactor.sendCommand("set_prompt", JsonValue.object()
.put("prompt", "A serene mountain landscape at sunrise").build()).join();
reactor.sendCommand("start").join();
Thread.sleep(30_000);
}
} finally {
reactor.disconnect().join();
}
}
npx create-reactor-app my-app --model=helios
Start building
Quickstart
Stream real-time AI video into your app in a few minutes.
Using the SDK
Connect and steer models from JavaScript, React, Python, C++, Swift, or Java.
Explore the models
Browse every model on Reactor and the commands that drive each one.