OpenCode 2 for VS Code
A VS Code sidebar client for OpenCode, the AI coding agent. Prompt it, watch it work, review what it changed, and keep its sessions, permissions and background service in view. Features
Requirements
The extension checks at most once every four hours whether that CLI is current. When a newer release exists the header shows a CLI 2.0.x → 2.0.y pill with an update action; there is no separate update bar and no skip, so an available update stays visible until you take it. Run Set If you still have the pre-release Flatpak Linux users: install the CLI on the host, not in the sandbox. The extension reads the host's service registration through The extension builds against Getting started
The
A prompt can start with Commands
Settings (
|
| Setting | Default | Description |
|---|---|---|
server.autoStart |
false |
Start a background service automatically when none is found |
server.mode |
own |
own starts a hidden service, discover finds a running one |
cli.checkForUpdates |
true |
Offer to update the CLI when a newer release exists |
cli.autoUpdate |
false |
Install newer CLI releases without asking |
models.default |
opencode/big-pickle |
Default model for new sessions as providerID/modelID |
permissions.mode |
askFirst |
Ask first or auto allow |
ui.theme |
dark |
Sidebar theme preset |
sessions.autoTitle |
false |
Generate a title after the first completed turn |
agent.autoCompactThreshold |
0 |
Send a manual compact at this context percent, 0 disables |
server.listenEnabled |
false |
Host the companion server for remote clients |
server.listenGlobal |
false |
Keep the companion running (tray icon) after VS Code closes |
server.startAtLogin |
false |
Start the companion automatically when you log in |
Companion server
Optional and off by default. It serves the same OpenCode to remote clients (the Android app, a browser, Tailscale) behind one stable address with its own username and password, so you can chat, review sessions and use a terminal from your phone. Turn it on in the Mobile & Companion panel, where you set the bind address, port and auth and where every address your phone can reach is listed with a Copy button.
The Android client is OC2 Companion, a paid app: the phone features are included and the landscape tablet workspace is a one-time in-app purchase. It is in closed testing today, and the Mobile & Companion panel carries the link to join the test, or to get it once it is on Google Play. It is an independent project, not affiliated with or endorsed by Anomaly, the makers of OpenCode.
server.listenGlobal keeps it running (with a tray icon) after VS Code closes, and server.startAtLogin brings it up when you log in. Both are off by default.
Voice sessions (optional)
Voice is off by default. Turn on opencode2.voice.enabled and a microphone button appears in the sidebar header (the OpenCode 2: Open Voice Session command does the same thing). It opens a voice page in your browser, where you press Start voice session and talk; the model answers with speech.
Why a browser page: a VS Code panel cannot reach a microphone. Webviews are sandboxed without microphone permission, so a voice session runs in a real browser tab, served by the companion server, and the audio goes straight from that tab to the provider.
What you say becomes work, not just text. With Send requests to the agent on (the default), each finished request goes into the session you have open as a Voice message, and the agent starts on it, exactly as if you had typed it, with the same model, permissions and history. It does not touch the composer: a draft you are typing stays where it is, and a spoken request never picks it up. Turn that switch off and the call becomes dictation: the transcript is staged in the composer as an editable draft and nothing is sent for you. Messages sent this way are marked Voice in the conversation, so you can still tell them apart from typed prompts afterwards. If a request needs your approval, the ask appears in VS Code while the call keeps running.
What it needs:
- The companion server running, because it serves the page.
- An API key stored on the server for the provider whose model you use. A ChatGPT sign-in is not enough; voice needs
OPENAI_API_KEYor a stored OpenAI key (orXAI_API_KEYforgrok-voice). - A voice-capable model:
gpt-live,gpt-realtime(OpenAI, over WebRTC) orgrok-voice(xAI, over WebSocket). Leaveopencode2.voice.modelempty to use the first one the server offers.
opencode2.voice.session is an advanced setting: a JSON object sent with the session request. Providers only transcribe your own speech when asked, so the assistant's words arrive on every model while your side needs this. For OpenAI that is:
{ "audio": { "input": { "transcription": { "model": "gpt-4o-transcribe" } } } }
A wrong shape makes the provider reject the session, and its message is what the page shows.
Troubleshooting
OpenCode ships its own diagnostics for the shared background service. From a terminal:
opencode service status # is the daemon up, and on which URL
opencode api get /api/status # the API's own status answer, using service discovery and auth
opencode service restart # restart the daemon
opencode --version # the CLI build you are running
Logs are at ~/.local/share/opencode/log/opencode.log. Every line carries a run id, and role=server marks session, provider, permission and tool activity, which makes grep 'role=server' the fastest way to see what the service did.
Inside VS Code, the extension writes to its own OpenCode 2 output channel, and OpenCode 2: Restart Background Service (also in the header ⋯ menu) reconnects and starts a fresh service. When reporting a problem, include opencode --version and opencode service status.
Workspaces
New sessions use your open folder. The header shows the folder and git branch. Change session scope between this folder and all projects in the sessions drawer, and read the list three ways: Recent for a plain newest-first list, Projects for one collapsible drawer per project folder with the open folder pinned first, or Activity for Today, Yesterday, the last 7 and 30 days, and Older. Archiving a session takes it out of the list on every client, including the phone companion, and the archived scope restores it; that needs OpenCode 2.1 or newer.
License
Free to use, including for commercial purposes. The source is not available. It is proprietary: copying, modification, redistribution, and reverse-engineering are reserved. The full terms ship in the LICENSE file bundled with the extension.