Skip to content
Changelog

Connect to the Remote API

Reach Lightair's local server on port 4455 over JSON-RPC, MCP, obs-websocket or the command line, send the password, and make a first call.

In short

  • Lightair answers on port 4455 of this computer: obs-websocket at /, JSON-RPC 2.0 at /rpc, MCP at /mcp.
  • Send the password from Settings › Remote API as Authorization: Bearer <password>, or call auth.login first.
  • Only this computer can connect until you turn on Other devices on your network; then the password is always asked.
  • Events come as {"method": "event", "params": {"name", "data"}}. events.subscribe picks which.

In the appLightair › Settings… › Remote API

Lightair runs one local server that other apps, scripts and AI agents use to control it. Every change they make to the workspace is an ordinary change: it can be undone, and Undo names who made it.

  1. Open Lightair › Settings… and pick Remote API.
  2. Make sure Let other apps control Lightair is on. It is by default.
  3. Note the Port. It’s 4455 unless you changed it.

The status line under the switch says who may connect (“On, for this Mac only”) and how many clients are connected. If another app already uses the port, it says “Port 4455 is in use (OBS or another app?). Choose another port.” Use − and + beside Port to pick another one.

To see that the server answers, ask it for its address list. This request needs no password:

Terminal window
curl http://127.0.0.1:4455/
{"name":"Lightair","version":"…","ways_in":{"obs-websocket v5":"ws://this-address/","JSON-RPC 2.0":"ws://this-address/rpc","MCP (Streamable HTTP)":"http://this-address/mcp"}}
Way in Address For
JSON-RPC 2.0 over WebSocket ws://127.0.0.1:4455/rpc Scripts and apps written for Lightair. Every method and event.
MCP, Streamable HTTP http://127.0.0.1:4455/mcp AI agents that connect over HTTP. See MCP server.
MCP over stdio lightair mcp AI agents that start their tools as programs. See Command line.
Command line lightair call <method> [params] One call from a shell script, answered as JSON.
obs-websocket 5 ws://127.0.0.1:4455/ Tools made for OBS: Stream Deck, Touch Portal, bots. See obs-websocket.

All of them reach the same methods. The method reference is under Remote API methods.

Lightair Live and Lightair Editor don’t use this port. They pair with the desktop and connect over an encrypted port of their own; see Pair a phone.

By default the server listens on this computer only (127.0.0.1). To reach it from a phone, a tablet or another computer:

  1. In Settings › Remote API, turn on Other devices on your network.
  2. Connect to this computer’s address on your network instead of 127.0.0.1. The Connect section at the bottom of the page shows the addresses with it filled in, each with a copy button.

While other devices may connect, the password is always asked.

Lightair makes a password of 24 letters and digits the first time it’s needed and keeps it in the system’s credential store: the Keychain on a Mac, Windows Credential Manager on Windows. Settings › Remote API › Password shows it (the eye button), copies it, and makes a new one (New). Clients using the old one must connect again with the new one.

Ask for the password is on by default. You can turn it off only while Other devices on your network is off; then apps on this computer connect without one.

Send it in one of these ways:

Way in How to send it
JSON-RPC (/rpc) An Authorization: Bearer <password> header on the WebSocket request, or auth.login with {"password": "…"} as the first call. Browsers can’t set the header, so a web page uses auth.login.
MCP over HTTP (/mcp) Authorization: Bearer <password> on every request.
obs-websocket (/) obs-websocket’s own challenge and salt, as every OBS tool does.
lightair call, lightair mcp Nothing: they read it from the credential store themselves.

Until a JSON-RPC client has sent the right password, every call except auth.login is refused with code -32001 and no events are sent to it. See Errors.

While Other devices on your network is off, Lightair refuses any request whose Host header isn’t a local name (localhost, a name ending in .localhost, 127.0.0.1 or ::1) with HTTP 403 “Forbidden host”. This stops a web page from reaching the server through a domain name it points at your computer. A page can still open ws://127.0.0.1:4455/rpc directly, so keep Ask for the password on if you browse while Lightair runs.

These examples connect to /rpc, sign in, read the version, switch to a scene named “Main”, and print the events that follow. Put your own password and scene name in.

Runs in a browser or in Node.js 22 and later, which have WebSocket built in.

const PASSWORD = "your-password";
const ws = new WebSocket("ws://127.0.0.1:4455/rpc");
let nextId = 0;
const pending = new Map();
function call(method, params = {}) {
const id = ++nextId;
ws.send(JSON.stringify({ jsonrpc: "2.0", id, method, params }));
return new Promise((resolve, reject) => pending.set(id, { resolve, reject }));
}
ws.addEventListener("message", (e) => {
const msg = JSON.parse(e.data);
if (msg.method === "event") {
console.log("event", msg.params.name, msg.params.data);
return;
}
const waiting = pending.get(msg.id);
if (!waiting) return;
pending.delete(msg.id);
if (msg.error) waiting.reject(new Error(`${msg.error.code}: ${msg.error.message}`));
else waiting.resolve(msg.result);
});
ws.addEventListener("open", async () => {
await call("auth.login", { password: PASSWORD });
console.log(await call("app.version"));
await call("events.subscribe", { events: ["scene.program", "stream.state", "record.state"] });
await call("scene.switch", { scene: "Main" });
});

Scenes, objects, sources and tracks can be named by id or by name in every method. Positions and sizes are canvas pixels.

Requests are JSON-RPC 2.0 text messages. Lightair answers each request that has an id, with result or error; a request without an id is a notification and gets no answer. An array of requests is a batch and is answered with an array. Binary messages close the connection.

{"jsonrpc": "2.0", "id": 7, "method": "scene.switch", "params": {"scene": "Main"}}
{"jsonrpc": "2.0", "id": 7, "result": {}}

A method that the window answers has 20 seconds to do it; after that the call fails with “Lightair didn’t answer in time”.

Once signed in, a client gets every event as a notification:

{"jsonrpc": "2.0", "method": "event", "params": {"name": "scene.program", "data": {"id": "…", "name": "Main"}}}

To get only some, call events.subscribe with their names. It answers with the list it kept:

{"jsonrpc": "2.0", "id": 3, "method": "events.subscribe", "params": {"events": ["scene.program", "stream.state"]}}

Call it with no events to get every event again. audio.levels, the meters, comes many times a second and is sent only to a client that names it.

Each client has a queue of 1,000 events. If a client falls behind and events it can’t do without are dropped, it gets session.resync once there’s room again: read state.get again then. A client that subscribes to a list gets it only if the list names it. Every event and its data are in Events.