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 callauth.loginfirst. - 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.subscribepicks 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.
Check that it’s on
Section titled “Check that it’s on”- Open Lightair › Settings… and pick Remote API.
- Make sure Let other apps control Lightair is on. It is by default.
- 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:
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"}}The ways in
Section titled “The ways in”| 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.
Let other devices connect
Section titled “Let other devices connect”By default the server listens on this computer only (127.0.0.1). To reach it from a phone, a tablet or another computer:
- In Settings › Remote API, turn on Other devices on your network.
- 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.
The password
Section titled “The password”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.
The Host check
Section titled “The Host check”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.
Make a first call
Section titled “Make a first call”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" });});Uses the websockets package, version 14 or later (pip install websockets). The password goes in the Authorization header.
import asyncioimport json
from websockets.asyncio.client import connect
PASSWORD = "your-password"
async def main(): headers = {"Authorization": f"Bearer {PASSWORD}"} async with connect("ws://127.0.0.1:4455/rpc", additional_headers=headers) as ws: next_id = 0
async def call(method, params=None): nonlocal next_id next_id += 1 await ws.send(json.dumps( {"jsonrpc": "2.0", "id": next_id, "method": method, "params": params or {}} )) while True: msg = json.loads(await ws.recv()) if msg.get("id") == next_id: if "error" in msg: raise RuntimeError(f"{msg['error']['code']}: {msg['error']['message']}") return msg["result"] # an event that came in meanwhile: skipped in this example
print(await call("app.version")) await call("events.subscribe", {"events": ["scene.program", "stream.state", "record.state"]}) await call("scene.switch", {"scene": "Main"})
async for raw in ws: msg = json.loads(raw) if msg.get("method") == "event": print("event", msg["params"]["name"], msg["params"]["data"])
asyncio.run(main())Scenes, objects, sources and tracks can be named by id or by name in every method. Positions and sizes are canvas pixels.
Requests and answers
Section titled “Requests and answers”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”.
Get events
Section titled “Get events”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.