127.0.0.1, so only processes on the same machine can reach it.opencode web, or opencode attach to talk to that same server. Bind it to 0.0.0.0, pick a stable port, and set a password.12OPENCODE_SERVER_PASSWORD=replace-me \ kimaki --opencode-hostname 0.0.0.0 --opencode-port 4096
1opencode attach http://YOUR_VPS_IP:4096 --password replace-me
VPS Laptop ┌────────────────────────────────────┐ ┌─────────────────────┐ │ kimaki │ │ │ │ --opencode-hostname 0.0.0.0 │ │ opencode attach │ │ --opencode-port 4096 │ │ http://VPS:4096 │ │ OpenCode serve │◄──────────│ --password secret │ │ 0.0.0.0:4096 + basic auth │ │ │ └────────────────────────────────────┘ └─────────────────────┘
127.0.0.1 unless you set KIMAKI_INTERNET_REACHABLE_URL.0.0.0.0 without a password. The OpenCode HTTP API can start sessions, run shell commands, and edit files. Kimaki refuses to start if --opencode-hostname is not loopback and OPENCODE_SERVER_PASSWORD is missing.Authorization header.| Variable | Role | Default |
OPENCODE_SERVER_PASSWORD | Enables basic auth. Required when --opencode-hostname is not loopback. | unset |
OPENCODE_SERVER_USERNAME | Basic-auth username | opencode |
123OPENCODE_SERVER_PASSWORD=replace-me \ OPENCODE_SERVER_USERNAME=opencode \ kimaki --opencode-hostname 0.0.0.0 --opencode-port 4096
123opencode attach http://YOUR_VPS_IP:4096 \ --username opencode \ --password replace-me
--password and --username on opencode attach also read OPENCODE_SERVER_PASSWORD and OPENCODE_SERVER_USERNAME if you omit the flags.| Flag | What it does |
--opencode-hostname <host> | Address OpenCode listens on. Default is OpenCode's 127.0.0.1. |
--opencode-port <port> | Port OpenCode listens on. Default is a random free port. Use a fixed port on a VPS so you can attach after restart. |
127.0.0.1, even when the process binds 0.0.0.0. That is correct: 0.0.0.0 means "listen on every interface", including localhost.CMD.1234567891011121314151617181920212223242526272829services: kimaki: build: . restart: unless-stopped ports: - "4096:4096" environment: NODE_ENV: production KIMAKI_DATA_DIR: /data OPENCODE_SERVER_PASSWORD: ${OPENCODE_SERVER_PASSWORD} command: [ "kimaki", "--gateway", "--data-dir", "/data", "--projects-dir", "/data/projects", "--auto-restart", "--opencode-hostname", "0.0.0.0", "--opencode-port", "4096", ] volumes: - kimaki-data:/data volumes: kimaki-data:
docker compose up:12export OPENCODE_SERVER_PASSWORD=replace-me docker compose up -d
.env file next to docker-compose.yml, or in your process supervisor.KIMAKI_LOCK_PORT, default 29988).12# example: allow 4096 from your laptop only ufw allow from YOUR_LAPTOP_IP to any port 4096 proto tcp