Getting Started
Start the web interface by running:127.0.0.1 with a random available port and automatically opens OpenCode in your default browser.
If
OPENCODE_SERVER_PASSWORD is not set, the server will be unsecured. This is fine for local use but should be set for network access.Configuration
You can configure the web server using command line flags or your OpenCode config file.Port
By default, OpenCode picks an available port. Specify a port:Hostname
By default, the server binds to127.0.0.1 (localhost only). To make OpenCode accessible on your network:
0.0.0.0, OpenCode displays both local and network addresses:
mDNS Discovery
Enable mDNS to make your server discoverable on the local network:0.0.0.0 and advertises the server as opencode.local.
Customize the mDNS domain name to run multiple instances:
CORS
Allow additional domains for CORS (useful for custom frontends):Authentication
Protect access with a password using environment variables:opencode but can be changed:
Config File
Configure server settings in youropencode.json config file:
Using the Web Interface
Once started, the web interface provides a comprehensive view of your OpenCode sessions and workspace.Sessions
The homepage displays your sessions with key information:- Active sessions with recent activity
- Session titles and timestamps
- Quick access to start new sessions
Chat Interface
The main chat interface includes:- Message Timeline - View the full conversation history
- Composer - Write and submit messages to the AI
- File References - Add files to context using
@mentions - Command Palette - Access slash commands like
/compact,/share, etc. - Model Selector - Switch between available AI models
- Agent Selector - Choose different agent modes
File Explorer
The file tree panel allows you to:- Browse your project files
- Open files in the editor
- View file changes made during the session
- Add files to the conversation context
Review Panel
The review panel shows all changes made during the session:- Session Changes - All file modifications in the current session
- Turn Changes - Changes from the most recent AI response
- Unified/Split Diff - Toggle between diff viewing modes
- Line Comments - Add comments to specific code sections
Terminal Panel
Access an integrated terminal for running commands:- Run shell commands
- View command output
- Execute build scripts and tests
- Debug and explore your codebase
Context Management
Manage conversation context efficiently:- Context Tab - View all files and information in the current context
- Add/Remove Files - Control what the AI can see
- Context Usage - Monitor token usage and context limits
- Comments - Add notes and instructions to specific code sections
Server Status
Click “See Servers” on the homepage to view:- Connected servers and their status
- Server URLs and connection information
- Health and availability indicators
Keyboard Shortcuts
The web interface supports keyboard shortcuts for efficient navigation:Cmd/Ctrl + K- Open command paletteCmd/Ctrl + Enter- Submit messageCmd/Ctrl + N- New sessionCmd/Ctrl + /- Focus chat inputCmd/Ctrl + B- Toggle file treeCmd/Ctrl + Shift + R- Toggle review panel
Mobile Support
The web interface is fully responsive and works on mobile devices:- Touch-optimized interface
- Mobile-friendly navigation
- Swipe gestures for panels
- Tab-based layout for session and changes
Attaching a Terminal TUI
You can attach a terminal TUI to a running web server:Session Management
Creating Sessions
Start a new session from the homepage or use the “New Session” button in the interface. You can also create sessions with specific configurations:- Choose a starting model
- Select an agent mode
- Set a working directory
Sharing Sessions
Share sessions with team members:- Click the share button or use
/sharecommand - Copy the generated link
- Share the link with others
Forking Sessions
Create a fork of an existing session to explore alternative approaches:- Open the session you want to fork
- Click the fork button in the session header
- Continue from that point with a new session ID
Collaborative Features
Multiple Windows
Open the same session in multiple browser windows or tabs. All instances stay synchronized:- Messages appear in real-time across all windows
- File changes are reflected immediately
- Tool execution shows progress everywhere
Cross-Device Access
With network access enabled, access your OpenCode server from any device on your network:http://<your-ip>:4096 on another device.
Performance Optimization
Session Compaction
As conversations grow, compact them to reduce context usage:- Use the
/compactcommand - Or click “Compact” in the session menu
Context Limits
Monitor context usage in the session header:- Token usage indicator shows current usage vs. model limits
- Warning appears when approaching the limit
- Compact or start a new session when needed
Advanced Features
MCP Servers
The web interface supports Model Context Protocol (MCP) servers configured in your OpenCode settings. MCP servers provide additional tools and capabilities to the AI.Custom Commands
Custom slash commands defined in your OpenCode configuration are available in the web interface command palette.Themes
The web interface supports multiple themes:- Light and dark modes
- Automatic theme switching based on system preferences
- Custom theme configurations
Language Support
The interface includes internationalization support for multiple languages. Language settings follow your browser preferences.Troubleshooting
Server Won’t Start
If the server fails to start:- Check if the port is already in use
- Try a different port:
opencode web --port 4097 - Check firewall settings for blocked ports
Can’t Access from Network
If other devices can’t connect:- Ensure you’re using
--hostname 0.0.0.0 - Check firewall rules allow the port
- Verify network connectivity between devices
Authentication Issues
If authentication isn’t working:- Verify
OPENCODE_SERVER_PASSWORDis set - Check username if using custom
OPENCODE_SERVER_USERNAME - Clear browser cookies and try again
Performance Issues
If the interface feels slow:- Compact long sessions to reduce history
- Close unused tabs and file previews
- Check network latency if using remote access
- Consider starting a new session for fresh performance