Local OpenCode Sidebar is a Visual Studio Code extension that adds a native chat panel connected to a local OpenCode-compatible API endpoint (local or remote).
Prerequisites
- Docker installed and running
- OpenCode container available on port
4096 (or your configured endpoint)
Start OpenCode with:
docker run -d -p 4096:4096 --name Opencode ghcr.io/anomalyco/Opencode
Build and Package
Install dependencies:
npm install
Compile TypeScript checks:
npm run compile
Build bundle:
npm run build
Create a VSIX package:
npm run package
Usage
- Launch the extension host from VS Code/Visual Studio extension debugging.
- Open the Local OpenCode icon in the activity bar.
- Type a message in Local OpenCode AI and send it.
- The extension sends your messages to the configured
localOpencode.apiEndpoint.
Interactive questions
The model selector groups models by provider and shows Gratis when the server reports zero input and output cost. It uses the connected provider registry (GET /provider) used by the message API, omits disabled/unavailable models, and keeps provider identity when restoring history. An unavailable historical selection is shown disabled and must be replaced before sending. Availability reflects the server configuration; credentials and upstream service health are checked when a request runs. Default model lets OpenCode choose its configured default.
When OpenCode asks a question through its question tool, the chat displays a card with single or multiple selection, option descriptions, and a custom answer field when allowed. Answer every question in the card and select Send answer, or select Reject question. The running model can continue after the server accepts the response. Failed submissions remain editable for retry.
Pending questions are checked every 1.5 seconds while the panel is open and recovered when reopening or switching sessions. Only questions for the active session appear. The server must support GET /question, POST /question/:id/reply, and POST /question/:id/reject; otherwise the panel displays a compatibility or connection notice and text chat remains available. Plain-text lists from the model remain text.
Resolved cards remain visible until chat history is reloaded; they are not persisted as interactive cards. This release uses polling rather than the server event stream and does not add permission approval controls.
Run automated checks with npm test, TypeScript checks with npm run compile, and build with npm run build.
Provider errors returned inside a successful HTTP response (for example, info.error with an invalid API key) are displayed in chat and retained when loading history. HTTP errors show the server's reason and reference when supplied. Common API key and authorization token patterns are redacted before display. If the server only supplies a generic error and a reference, its internal cause must be checked in server logs.
Commands
After installing the extension, open the Command Palette and search for Local OpenCode to use the main commands:
Chat: Focus on Local OpenCode AI View
Local OpenCode: Open Settings
Local OpenCode: Clear Chat
Settings
localOpencode.apiEndpoint (default: http://localhost:4096)
localOpencode.apiTimeoutMs (default: 0)
Use Local OpenCode: Open Settings to change the API URL used by the extension. This also lets you point the extension to a local container running on a different port, for example:
"localOpencode.apiEndpoint": "http://localhost:4096"
By default, API requests wait indefinitely because some model responses can take longer depending on the prompt, selected model, and local resources:
"localOpencode.apiTimeoutMs": 0
Set localOpencode.apiTimeoutMs to a positive number of milliseconds if you prefer to enforce a request timeout. For example, this waits up to two minutes:
"localOpencode.apiTimeoutMs": 120000
If you change the local container port, make sure the Docker port mapping and localOpencode.apiEndpoint use the same port:
docker run -d -p 4096:4096 --name Opencode ghcr.io/anomalyco/Opencode