Run OpenCode In Your Browser

Run OpenCode in Your Browser: Self-Hosted Web UI with Claude

OpenCode is an open-source AI coding agent, looking like Claude Code, that normally runs in your terminal, but you can also host it yourself as a web UI and use Claude (or other models) behind it.


1. Install OpenCode (package manager or script)

Use one of these:

# Install via script (Linux/macOS/WSL)
curl -fsSL https://opencode.ai/install | bash

Or via a package manager, for example:

# Node.js
npm install -g opencode-ai

# macOS / Linux (Homebrew)
brew install opencode



2. Connect Claude (or another provider)

Run the auth helper once:

opencode auth login

Then in the TUI popup:
 1. Select provider → choose Anthropic / Claude (or your preferred provider).
 2. Paste your API key (Claude API or Claude Pro/Max via a supported route).

You only need to do this once per machine / config.


3. Start the self-hosted web UI

From your project directory:

cd /path/to/project

# Self-hosted OpenCode web UI
opencode web --hostname 0.0.0.0 --port 4096

 • opencode web → starts the visual web interface.
 • --hostname 0.0.0.0 → listen on all interfaces (so you can reach it from other devices on your LAN if your firewall allows it).
 • --port 4096 → pick any open port you like.

Then open in your browser:

http://localhost:4096

(or http://<your-machine-ip>:4096 from another device).


4. (Optional) API-only mode

If you later want a headless HTTP API, use:

opencode serve --hostname 0.0.0.0 --port 4099

 • opencode serve = API server only, no UI.


5. One-liner after Claude is configured

Once you’ve already run opencode auth login and set up Claude:

curl -fsSL https://opencode.ai/install | bash && opencode web --hostname 0.0.0.0 --port 4096

That’s it: self-hosted OpenCode web UI, powered by Claude, in your browser.

Comments

Popular posts from this blog

Crazy Rich: Literally - On Money, Transhumanism, and the Brain Damage of Having Too Much

Project: Build a Mobile AI Assistant Using Termux (+Python)

Free Alternatives to Squibler.io