Run opencode as a hosted AI coding agent with the browser UI and opencode attach.
- A single Render Web Service running
opencode web - The built-in opencode web UI on your Render URL
- Remote TUI access with
opencode attach - A
standardinstance to avoid OOM loops on startup and active agent sessions - A 1 GB persistent disk for opencode state and your working tree
- Optional repo cloning into
/root/project-data/workspaceon first boot - The Render OpenCode plugin installed by default
Deploy the template, then open the Render service URL.
Log in with:
- Username:
opencode - Password: the generated
OPENCODE_SERVER_PASSWORDvalue in the Render Dashboard
Install opencode locally:
npm install -g opencode-aiAttach to your hosted backend:
opencode attach https://your-service.onrender.comUse the generated password when prompted. You can also pass it directly:
opencode attach https://your-service.onrender.com \
--username opencode \
--password "$OPENCODE_SERVER_PASSWORD"Set REPO_URL during deploy to clone a working tree into /root/project-data/workspace on first boot.
For a public repo:
REPO_URL=https://github.com/your-org/your-repo.gitFor a specific branch:
REPO_URL=https://github.com/your-org/your-repo.git
REPO_BRANCH=mainFor a private GitHub repo, also set GITHUB_TOKEN to a token that can read the repo.
The startup script only clones when /root/project-data/workspace is empty. If /root/project-data/workspace already has files, it leaves them alone.
If you do not set REPO_URL, the service creates a small default Git project in /root/project-data/workspace so the web UI has a project to open.
The template defaults to:
OPENCODE_SERVER_COMMAND=webThat starts opencode's web UI and API on the same Render URL.
If opencode attach returns HTML instead of API responses, switch to the headless server:
OPENCODE_SERVER_COMMAND=serveSet one or more provider keys in Render:
ANTHROPIC_API_KEYunlocks Anthropic models.OPENROUTER_API_KEYunlocks OpenRouter models.RENDER_API_KEYunlocks Render MCP tools.
The service writes these keys into /root/project-data/opencode/auth.json using opencode's API-key auth format.
Anthropic OAuth is not supported in this hosted setup. Use ANTHROPIC_API_KEY.
This template gives you a remote coding agent, not a hardened sandbox.
The agent can read and write files in its workspace, run shell commands, and use the environment variables you provide. Treat it like a single-tenant development box that can act with your credentials.
Be careful with RENDER_API_KEY. Render API keys are broad credentials today. If you set one, opencode can use Render MCP tools with whatever access that key has. Leave RENDER_API_KEY unset unless you want the agent to manage Render resources from this service. Remove it when you do not need Render MCP, and rotate it if you expose logs, transcripts, or the service password.
Do not use this template with untrusted users, untrusted prompts, or repos you do not want an AI agent to execute code from.
The template uses Render's standard plan by default.
opencode can exceed the memory available on starter, especially with the web UI, provider metadata, plugins, MCP tools, and active coding sessions.
The image installs the Render OpenCode plugin from GitHub. It adds:
render_validate_blueprint- automatic validation when an agent edits
render.yamlorrender.yml /deploy-to-render/check-render-status- the
@rendersubagent - bundled Render skills
The startup script also merges the Render MCP server into ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"render": {
"type": "remote",
"url": "https://mcp.render.com/mcp",
"enabled": true,
"oauth": false,
"headers": {
"Authorization": "Bearer {env:RENDER_API_KEY}"
}
}
}
}Set RENDER_API_KEY in Render before asking opencode to manage Render resources.
The template starts with a 1 GB persistent disk mounted at:
/root/project-dataThe startup script uses that disk for:
/root/project-data/opencodefor opencode auth, sessions, and SQLite state/root/project-data/workspacefor the repo or project files the agent edits
To resize it, edit render.yaml:
disk:
name: opencode-data
mountPath: /root/project-data
sizeGB: 5Then deploy the updated Blueprint.
- Anthropic OAuth login does not work for hosted opencode. Use
ANTHROPIC_API_KEY. - The opencode web UI fetches assets from opencode's CDN at runtime.
- This is single-tenant. Do not share one deployment with multiple users.
/root/project-data/workspacepersists across restarts and deploys, but you should still commit and push important work back to your repo.- The image preinstalls TypeScript language server only. Other language servers can be installed in your repo or a fork of this template.