OpenCode Server
OpenChamber runs on top of an OpenCode server. By default it starts one for you, so you don’t have to do anything. You only need this page if you want to point OpenChamber at a server you already run, or manage the one it starts.
How OpenChamber finds a server
When OpenChamber starts, it looks for a server in this order:
- reuse a server it already started
- connect to an external one if you configured
OPENCODE_HOST,OPENCODE_PORT, orOPENCODE_SKIP_START - connect to the shared local
opencode serve --servicedaemon if Use shared OpenCode service is on - otherwise, start and manage its own
By default, OpenChamber manages its own server on an allocated port. The port can change after a restart. It does not automatically connect to another OpenCode server on port 4096.
Use the shared OpenCode service
If you also use the OpenCode CLI or TUI, you can point OpenChamber at the same local opencode serve --service background service without setting environment variables.
- Open Settings → General → OpenCode Server.
- Turn on Use shared OpenCode service.
OpenChamber reads the running service address and password from OpenCode’s service.json and switches to it. If no service is running and an OpenCode CLI binary is installed, OpenChamber starts opencode serve --service for you. In enterprise mode, OpenChamber connects only to an already-running local service and does not start one itself.
Turning the option off switches OpenChamber back to its own private OpenCode server without stopping the shared service.
If a service manager such as systemd runs OpenCode, leave this option off and connect to the server you already run instead. OpenChamber never starts or restarts a server it connects to that way.
After opencode update, the running service keeps the old version until it restarts. When OpenChamber connects and finds an installed release of OpenCode newer than the running service, it restarts the service, except in enterprise mode. From the OpenCode update notification, select Update to run opencode upgrade, then Reload OpenCode to restart the service on the new version.
Enable OpenChamber tools on an external local server
When OpenChamber connects to a local external server (through Use shared OpenCode service or through OPENCODE_HOST and OPENCODE_SKIP_START), OpenChamber cannot inject its managed plugins at server startup. Instead, it provides a single plugin folder that you register in your global OpenCode config:
- Open Settings → General → OpenCode Server.
- In the info banner, select Add to OpenCode config.
If your global opencode.json is read-only or managed by your organization, select Copy path in the same banner and add that folder path to the plugins list in your managed OpenCode config.
Once registered, OpenChamber’s tools, limit failover, and session titles activate automatically whenever OpenChamber is running, and hide overlapping built-in OpenCode tools (such as OpenCode’s built-in browser and automation tools) while OpenChamber is open. When OpenChamber closes, the plugin turns off and OpenCode returns to its standard built-in tools and prompts.
Sessions in a folder where OpenCode loaded the plugin also get OpenChamber’s instructions for its tools, such as when to link an issue, draw a page or ask for a secret, and leads work there. A project config that turns the plugin off for a folder turns those instructions off too.
OpenChamber tools require a local OpenCode server on the same machine and are not available when connected to a remote server.
Connect to a server you already run
Set these before starting OpenChamber:
OPENCODE_HOST=http://localhost:4096 OPENCODE_SKIP_START=true openchamberOPENCODE_HOST— the full address of your OpenCode server, including the port (a value likehttp://localhost:4096). It must not have a path at the end.OPENCODE_SKIP_START=true— tells OpenChamber not to start its own server.
If you only need to change the port, set OPENCODE_PORT instead of OPENCODE_HOST.
If OPENCODE_HOST is missing its port or has a path, OpenChamber ignores it and falls back to starting its own server. Watch the startup logs for a [config] warning if a connection you expected didn’t happen.
Share one server with VS Code
The desktop app and VS Code extension normally start separate OpenCode servers. On Windows, some plugins, including opencode-mem, cannot open the same database in two processes. Point both apps at one server to avoid that conflict.
The shared server needs OpenCode 2.2.4 or newer. With an older version, both apps stop at the “update OpenCode” screen.
-
Quit OpenChamber Desktop and VS Code so their managed servers stop. Stop any other OpenCode server that uses the same plugin data too, such as one running in a terminal. The OpenCode TUI also starts a background server that keeps running after you close it. Check it with
opencode service statusand stop it withopencode service stop. -
Start one OpenCode server and leave it running:
Terminal window opencode serve --port 4096OpenCode prints the address it listens on in a
server listening online. Use that address wherever the steps below sayhttp://localhost:4096.If neither
OPENCODE_PASSWORDnorOPENCODE_SERVER_PASSWORDis set, OpenCode also prints a generatedserver password. If one of them is set, it prints no password and the server uses the one you set. Keep the password private and use it in the next steps. -
Start OpenChamber Desktop with
OPENCODE_HOST=http://localhost:4096,OPENCODE_SKIP_START=true, andOPENCODE_PASSWORDset to the server password. On Windows, launch it from a PowerShell window:Terminal window $env:OPENCODE_HOST = 'http://localhost:4096'$env:OPENCODE_SKIP_START = 'true'$password = Read-Host 'OpenCode server password' -AsSecureString$env:OPENCODE_PASSWORD = [System.Net.NetworkCredential]::new('', $password).Password& "$env:LOCALAPPDATA\Programs\@openchamberelectron\OpenChamber.exe"If you installed Desktop elsewhere, use the path to your
OpenChamber.exe. -
Start VS Code from the same PowerShell window with
code. In VS Code settings, setopenchamber.apiUrltohttp://localhost:4096, then run Developer: Reload Window.
Both apps now use the server at that address. Keep it running while using either app. Start both apps from PowerShell as in steps 3 and 4 every time: opened from the Start menu, Desktop starts its own server again and VS Code has no password for the shared one. If you restart the server without a password set, it prints a new one, so use that. The older OPENCODE_SERVER_PASSWORD name also works when OPENCODE_PASSWORD is unset. Do not expose the server to an untrusted network. You cannot use this setup with Desktop’s automatically managed server, which uses a changing port and password.
An external server does not receive OpenChamber’s managed plugins automatically; see Enable OpenChamber tools on an external local server to register the OpenChamber plugin in your global OpenCode config. See OpenCode connection if either app cannot connect.
Manage the server from the CLI
openchamber statusopenchamber logsopenchamber restartopenchamber stopopenchamber on its own starts the server in the background. Add --foreground to keep it attached to your terminal.
Start OpenChamber at login
Use startup enable to install a native user service. OpenChamber uses launchd on macOS, systemd --user on Linux, and Task Scheduler on Windows.
openchamber startup enableopenchamber startup statusopenchamber startup disableTo protect the UI, set the password when enabling the service:
OPENCHAMBER_UI_PASSWORD='secret' openchamber startup enableFor a headless server that starts at login and is meant for desktop or mobile clients, include --api-only and a reachable host:
openchamber startup enable --port 3000 --api-only --host 0.0.0.0 --ui-password secretstartup enable snapshots your current environment into the service so it behaves more like starting openchamber from the same shell. This keeps provider tokens, PATH, SSH agent settings, and other CLI auth/config variables available. Variables a running OpenChamber put into that shell, such as the desktop app’s own settings or the managed OpenCode’s password, are left out. Use --no-env-snapshot if you want a minimal service environment.
The startup service remembers --port, --host, --ui-password, and --api-only. CLI restart and update restart reuse those saved settings.
To create a connection link for another OpenChamber app, use:
openchamber connect-url --port 3000 --server http://your-host:3000 --qrRun openchamber connect-url --help to see all link options, including --name, --lan, --server, --api-only, --ui-password, and --qr.
You can still manage tunnels independently for that running service:
openchamber tunnel start --port 3000openchamber tunnel stop --port 3000Stopping the tunnel does not restart the service or the app.
”OpenCode is restarting”
While the server is starting or restarting, OpenChamber shows an “OpenCode is restarting” state and pauses requests until it’s ready. This is normal right after launch or a restart. If it never clears, see OpenCode connection.
Related
- Providers, Models & Agents — set up what the server talks to
- OpenCode connection — if it won’t connect