OpenCode: connect OpenAI provider on a headless Hetzner VM
- On the VM (SSH in)
opencode connect <provider>
Leave it running and copy the callback URL it prints (e.g. http://localhost:1455/auth/callback?...).
- On your local machine (new terminal)
ssh -L 1455:127.0.0.1:1455 root@<VM_IP>
Keep this tunnel open. If the callback uses a different port, replace 1455.
- On your local machine (browser)
Open the exact callback URL you copied. Auth completes on the VM via the tunnel.
Optional: attach to a VM server
VM:
opencode serve --hostname 127.0.0.1 --port 4096
Local:
ssh -L 4096:127.0.0.1:4096 root@<VM_IP>
opencode attach http://127.0.0.1:4096