OpenCode
OpenCode is the default AI coding agent in RemoteLLM. It is
pre-installed in the agent image and is the primary interactive coding
tool used from make agent or the browser terminal.
Features
- Interactive terminal-based AI coding agent
- Reads, edits, and runs files directly in the workspace
- OpenAI-compatible API backend (connects to LiteLLM)
- Optional browser web UI mode on a dedicated port
- Session state and history persisted to
.local/volumes/opencode-home/ - Version-pinned via
OPENCODE_VERSIONbuild arg - Supports multi-turn conversations with code context
Functionalities
Running OpenCode (Terminal)
From the agent shell or browser terminal:
make agent # shortcut: exec into agent and run opencode
# or from inside the shell:
opencode
OpenCode connects to LiteLLM at http://litellm:4000/v1
using the OPENAI_API_KEY environment variable (set to
AGENT_VIRTUAL_KEY or LITELLM_MASTER_KEY).
Running the Web UI
OpenCode has a browser UI mode accessible on a separate port:
make up-opencode-web
Open:
http://127.0.0.1:4040/
Set OPENCODE_WEB_PORT in .env to change the
host port. Set OPENCODE_SERVER_PASSWORD from the default
before exposing beyond localhost.
The web UI runs under the opencode-web Compose profile.
It shares the same workspace mounts and environment as the terminal
agent.
State and History
OpenCode persists conversation history and config to
.local/volumes/opencode-home/, mounted at
/home/agent/.config/opencode. This volume survives
container restarts.
Switching Models
OpenCode uses whatever model LiteLLM serves under the
ollama-default alias. To switch models:
OLLAMA_MODEL=another-model:tag
Run make restart-litellm after changing the model.
MCP Integration
OpenCode supports MCP (Model Context Protocol) servers. The seeded
MCP config is at config/agent/opencode/opencode.jsonc. To
enable the Playwright MCP server for browser automation, uncomment the
relevant entry in that file and start the playwright
profile.
Limitations
- External account not required, but requires LiteLLM to be healthy. If LiteLLM is down, OpenCode cannot reach any model.
- Web UI password
(
OPENCODE_SERVER_PASSWORD) defaults tochange-me. Change it before usingmake up-opencode-webon a shared or LAN-exposed host. - Session state is local. OpenCode history in
.local/volumes/opencode-home/is not shared between the terminal and web UI modes. - Single concurrent session. Running
make agentand the web UI simultaneously on the same volume may cause state conflicts. - Version pinned at build time. Updating OpenCode
requires changing
OPENCODE_VERSIONin.envand runningmake build.
Hardware Requirements
OpenCode itself is a lightweight CLI. Its resource consumption is driven by the LiteLLM + Ollama backend.
| Metric | Value |
|---|---|
| RAM (opencode process) | ~50–100 MB |
| CPU (opencode process) | <0.5 cores |
Model inference (on the remote Ollama server) is not included in these figures.