Skip to content
| Marketplace
Sign in
Visual Studio Code>AI>OpenCode CompanionNew to Visual Studio Code? Get it now.
OpenCode Companion

OpenCode Companion

Preview

Umberto Manganiello

|
3 installs
| (0) | Free
A chat interface for OpenCode with model selection capabilities
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

OpenCode Companion

Tests

A VS Code sidebar chat for OpenCode. Pick a model configured in OpenCode and chat with it without leaving the editor.

This is an unofficial, community-made extension. It is not affiliated with or endorsed by the OpenCode project.

Chat sidebar: picking a model, sending a message, approving a permission request and opening the history

Features

  • Modern chat interface similar to Copilot
  • Real-time model selection with search capability
  • Integrated history management
  • Permission request handling
  • Form input support
  • Connection status indicators
  • Responsive design

Requirements

  • OpenCode installed, with at least one provider configured
  • An OpenCode server running locally:
    opencode serve
    
    It prints the URL and a password. Keep it running while you chat.

Installation

Install OpenCode Companion from the VS Code Marketplace: open the Extensions view (Ctrl+Shift+X or Cmd+Shift+X), search for "OpenCode Companion", and click Install.

To install a .vsix file instead, download it from the releases page, open the Extensions view, click the three dots in the top right corner, select "Install from VSIX", and pick the file.

Setup

Open the VS Code settings and set the following. serverUrl and ollamaUrl can only be set in your user settings, not in a project's .vscode/settings.json, so a project can't redirect the chat (and your saved password) to another server.

Setting Default Description
opencode-chat-ui.serverUrl http://127.0.0.1:4096 URL of the OpenCode server. Change it if you start opencode serve --port with another port.
opencode-chat-ui.ollamaUrl http://127.0.0.1:11434 URL of Ollama. Ollama models that are not installed there are hidden from the model list.
opencode-chat-ui.sendTimeoutSeconds 60 How long to wait for OpenCode to accept a message before showing a timeout error (1–3600).
opencode-chat-ui.askBeforeActions ["websearch"] Actions that OpenCode must ask you about before running, in new chats. Answers appear in the permission banner. Set to [] to turn this off. Applies only to chats started from this extension.
opencode-chat-ui.serverPassword empty Deprecated. Stored in plain text. Use the password command below instead.

Server password

Run OpenCode: Set Server Password from the Command Palette and paste the password printed by opencode serve. VS Code keeps it in the operating system's keychain. Run the same command with an empty value to remove it.

The extension looks for the password in this order: the saved password, the deprecated setting, then the OPENCODE_SERVER_PASSWORD environment variable.

opencode serve generates a new password each time it starts, unless OPENCODE_SERVER_PASSWORD is set. If you set that variable before starting the server, the password stays the same, and you only need to save it once.

The extension warns if the server URL is not on this machine and uses plain http://, because the password would travel unencrypted. Use https:// for remote servers.

Usage

  1. Click the OpenCode icon in the Activity Bar, or run "OpenCode: Start Chat" from the Command Palette.
  2. Pick a model. Click the search box at the top of the chat and type part of a model name or provider (for example ollama, gpt 5 or claude). Use the arrow keys and Enter, or click, to choose. The list comes from your OpenCode server.
  3. Type a message and press Enter, or click Send.
  4. Use the + button in the chat header, or "OpenCode: New Chat", to start a new conversation. To see earlier chats, click History in the chat header. Click a chat to continue it.
  5. If OpenCode wasn't running, or you added models to its configuration, click the reload button (↻) in the chat header. This reconnects and refreshes the model list without restarting the server.

Under the header, a line shows the session's totals: input and output tokens, cached tokens, cost, and how full the context window was for the last reply (for example 1.0k in · 50 out · 200 cached · $0.01 · context 4%). Hover over it for the details. The percentage is missing when OpenCode doesn't know the model's context size. Local models (Ollama) show $0.00 because they have no cost, and the figures appear after each reply finishes.

Each chat is one OpenCode session. Sessions live on the OpenCode server, so you can see them there too. The transcript is kept while VS Code is open, including when you close and reopen the sidebar. Reloading VS Code starts a new chat.

Permission requests

OpenCode asks before the model runs a command or changes a file, depending on your OpenCode permission settings. When it asks, a banner appears above the message box, showing the action and the resources it wants (for example a command). Choose Allow once, Always allow, or Deny. The reply continues after your answer. Time spent waiting for you doesn't count towards the reply timeout.

Only requests from the open chat can be answered from the banner.

Questions from the model

When the model asks a question, a form appears above the message box. Fill it in and choose Send answers, or Cancel if you don't want to answer. The form supports text (including email, link and date fields), numbers, true/false choices, multiple choices, and links to open in the browser. Fields that depend on another answer appear only when that answer matches. Required fields are checked before anything is sent.

UI Features

  • Model Selection: Search through available models with the model picker
  • History Management: Access past chats using the history button
  • Real-time Status: Connection status and session statistics displayed
  • Permission Handling: Visual banners for permission requests
  • Form Support: Interactive forms when models request additional information
  • Stop Functionality: Cancel ongoing replies with the stop button

Security

  • The server password is kept in the OS keychain (see Server password above).
  • Replies are sanitised before display, and only web and mail links open.
  • Dependabot checks npm packages and GitHub Actions each week and opens pull requests for updates. npm audit reports known vulnerabilities in the dependencies.
  • The Markdown renderer and HTML sanitiser are copied from node_modules into media/vendor on every compile. To update them, run npm update marked dompurify, then npm test, then package a new release.

Limitations

  • The extension doesn't start OpenCode for you.
  • While a reply runs, the chat shows the model's thinking, tool calls and answer as they arrive. Once the reply is finished, the answer replaces that view, and the thinking stays in a collapsed "Thinking" section.
  • Restored chats show the messages only, without thinking or tool calls.

Development

You need Node.js 24 or newer and npm. (The tests also pass on Node 26.)

npm install          # install dependencies (once, and after changing package.json)
npx playwright install chromium   # browser for the UI tests (once)
npm run compile      # compile TypeScript to extension/out and copy the Markdown and sanitiser files to media/vendor
npm test             # compile, then run the Node tests in test/*.test.js
npm run test:ui      # run the browser tests in test/ui with Playwright
npm run package      # compile, then build opencode-chat-ui-<version>.vsix in the project folder

Try a development build in VS Code

  1. Open the project folder in VS Code.
  2. Run npm run compile once, or leave npm run watch running in a terminal while you edit.
  3. Press F5 (Run > Start Debugging). A second VS Code window opens, the "Extension Development Host", with the extension loaded from this folder.
  4. In that window, open the OpenCode icon in the Activity Bar, or run "OpenCode: Start Chat".

After changing code, recompile, then run Developer: Reload Window in the Extension Development Host. Changes to media/ files also need the window reloaded.

To chat for real you need opencode serve running, as described under Requirements. The tests don't need it.

Install a local build

npm run package
code --install-extension opencode-chat-ui-0.0.1.vsix --force

Then reload VS Code. Use the version number from package.json in the file name.

Tests

npm test runs the tests in test/*.test.js. They use a fake OpenCode server and a simulated VS Code, so they don't need OpenCode or Ollama running.

npm run test:ui runs the browser tests in test/ui/. They load the real chat page in headless Chromium, using the same fake OpenCode server, so they check layout and the page's behaviour that the Node tests can't see.

Contributing

Issues and pull requests are welcome at github.com/vanatallin/opencode-chat-ui. Before opening a pull request, run npm test and npm run test:ui, and make sure both pass. Tests must not call a real OpenCode or Ollama server.

Publisher

This extension is published by vanatallin.

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft