Linux command
opencode-web 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Start OpenCode
opencode web
Bind to all interfaces
opencode web --hostname 0.0.0.0 --port [4096]
Advertise the service over mDNS/Bonjour
opencode web --mdns
Enable CORS
opencode web --cors
Stream server logs
opencode web --print-logs --log-level debug
说明
opencode web starts a headless OpenCode server that exposes a web-based interface instead of the terminal TUI. This allows interacting with OpenCode through a browser, which can be useful for remote access, sharing sessions, or when a graphical interface is preferred over the terminal. When --mdns is enabled the service is discoverable on the local network without needing to know its IP.
参数
- --hostname _HOST_
- Interface to bind to (default 127.0.0.1).
- --port _PORT_
- TCP port (default 0 — pick an ephemeral port).
- --mdns
- Announce the server on the local network via mDNS.
- --mdns-domain _DOMAIN_
- Override the mDNS service domain (default .local).
- --cors
- Allow cross-origin requests from browsers.
- --print-logs
- Print server-side logs to the terminal.
- --log-level _LEVEL_
- Log verbosity: trace, debug, info, warn, error.
- -h, --help, -v, --version
- Display help or version information.
FAQ
What is the opencode-web command used for?
opencode web starts a headless OpenCode server that exposes a web-based interface instead of the terminal TUI. This allows interacting with OpenCode through a browser, which can be useful for remote access, sharing sessions, or when a graphical interface is preferred over the terminal. When --mdns is enabled the service is discoverable on the local network without needing to know its IP.
How do I run a basic opencode-web example?
Run `opencode web` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --hostname _HOST_ do in opencode-web?
Interface to bind to (default 127.0.0.1).