Skip to content
| Marketplace
Sign in
Visual Studio Code>AI>OpenCode Models for CopilotNew to Visual Studio Code? Get it now.
OpenCode Models for Copilot

OpenCode Models for Copilot

Mark Fenderov

|
375 installs
| (2) | Free
Automatically sync OpenCode Zen & Go models to GitHub Copilot in VS Code
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

OpenCode Copilot Sync Icon

OpenCode Models for Copilot (opencode-copilot-sync)

CI CRAP License: MIT GitHub Release

A lightweight VS Code extension that automatically synchronizes model catalogs from OpenCode Go and OpenCode Zen into GitHub Copilot in VS Code under a single unified provider with smart cost-optimized routing. Its HTTP client is bundled into the extension package.


✨ Features

  • Unified model catalog: Automatically syncs OpenCode Go and Zen models under one OpenCode provider, preferring the Go flat subscription when a model is covered.
  • Secure credentials: Stores API keys in VS Code's encrypted SecretStorage and supports OPENCODE_API_KEY for automation.
  • Lean chat adapter: Registers enriched models with VS Code, adds OpenCode's required conversation header, and delegates protocol encoding and stream parsing to the official provider SDKs.
  • Usage at a glance: Shows Go subscription quotas and reset timers in the OpenCode sidebar.
  • Safe mirroring: Preserves unrelated providers and destination-local secrets when syncing VS Code profiles and the associated WSL distro.

🚀 Quick Install

Install from the VS Code Marketplace (Recommended)

Search for OpenCode Models for Copilot in the Extensions view, or run:

code --install-extension mfenderov.opencode-copilot-sync

For a manual install, download a .vsix from the Latest Release and choose Install from VSIX... in the Extensions view.

Build from Source

git clone https://github.com/mfenderov/opencode-copilot-sync.git
cd opencode-copilot-sync
npm ci
npm run package
code --install-extension opencode-copilot-sync-*.vsix

Dependencies

  • This local spike targets VS Code 1.142 or later (the latest stable version at build time).
  • Building, testing, and packaging from source requires Node.js and npm. npm ci installs the locked runtime and development dependencies, including undici and the build/test tools.
  • npm run package bundles the HTTP client into the VSIX; end users do not need to install a separate runtime package.

⚙️ Configuration Settings

Customize behavior via VS Code Settings (Cmd+, / Ctrl+, search for opencode):

Setting Default Description
opencode.autoSyncOnStartup true Automatically sync models on VS Code launch or window reload.
opencode.includeGoModels true Include models from the OpenCode Go subscription catalog.
opencode.includeZenModels true Include OpenCode Zen catalog models as announced upstream.
opencode.additionalSyncTargets [] Additional absolute chatLanguageModels.json paths to mirror to. Use this to opt in to another user profile or a sibling WSL distro.
opencode.streamDiagnostics false Log per-request stream summaries ([Stream] lines with part counts, timing, and finish reason) to the output channel. Never includes prompt text, reasoning content, tool arguments, or credentials.

🕹️ Commands, Status Bar & Sidebar

  • Activity Bar View: Click the OpenCode hubot icon in the left Activity Bar to see:
    • 📊 Real-time Go subscription quotas (rolling 5-hour, weekly, monthly limits & reset timers)
    • 🏷️ Active model counts (OpenCode Go flat-rate vs OpenCode Zen)
    • ⚡ Quick actions to sync models, update API key, and open config
  • Status Bar Indicator: Click $(hubot) OpenCode in the bottom-right status bar to trigger a live sync with spin animation.
  • Command Palette (Cmd+Shift+P / Ctrl+Shift+P):
    • OpenCode: Sync Models to Copilot: Manually fetch models and refresh Copilot.
    • OpenCode: Refresh Usage: Refresh Go subscription limits in status bar and sidebar view.
    • OpenCode: Set API Key: Update your OpenCode API key securely.
    • OpenCode: Open Copilot Models Config: Open chatLanguageModels.json in editor.

Model registration and chat transport

The extension fetches the Go and Zen catalogs, enriches models with metadata, and registers them under the native OpenCode provider. The last synced catalog is cached for reloads. The primary profile's old OpenCode Custom Endpoint entry is removed to avoid offering a duplicate path that cannot supply conversation headers; unrelated providers and optional profile mirrors are preserved.

A small adapter adds x-opencode-session, translates VS Code message parts to SDK messages, and forwards SDK response parts. For Responses models that support thinking, it requests reasoning summaries and forwards both SDK summary deltas and OpenCode's legacy reasoning deltas as VS Code thinking parts. Chat Completions reasoning fields (reasoning_content, thought, reasoning, reasoning_details[]) are mapped the same way, since the SDK chat parser otherwise drops them. If no text delta arrives, it recovers text from the terminal response; output-limit truncation and streams that close without a completion event are surfaced in chat instead of appearing to finish normally. The adapter times out if response headers take over 5 minutes or if no body chunk arrives for 15 minutes; each received chunk resets the idle timer, and there is no default overall request deadline. A protocol finish completes the chat response even if HTTP body cleanup is delayed. On timeout, the adapter retries up to three times (four attempts total) with bounded exponential backoff. If a timed-out attempt emitted partial text, the text is kept in the next prompt as an assistant message, followed by a separate user message with the exact instruction: “The previous response was interrupted. Continue from where you left off without repeating completed content.” The adapter does not emit the prior text again; it asks the model to continue without repeating it. Complete tool calls are returned to VS Code and are not retried; VS Code runs the tool and sends its result in the next model turn. Cancellation comes from VS Code. When opencode.streamDiagnostics is enabled, every request logs stream summaries ([Stream] request ... and [Stream] completed ...) recording part counts, the last raw event type, timing, and the terminal finish reason; message text, reasoning content, tool arguments, and credentials are never logged. The official OpenAI and Anthropic provider SDKs handle wire formats and stream parsing.

To capture evidence for a stop, enable opencode.streamDiagnostics in Settings, reproduce the stop, then copy the [Stream] request ... and [Stream] completed ... lines from View → Output → OpenCode Copilot Sync (never send your prompt text or API key).

Where VS Code supplies modelOptions._conversationId, that ID is used unchanged. Current stable Agents sessions require the approved history-based fallback: bounded message-hash chains and UUIDs are persisted, without message text. Identical histories cannot be distinguished until they diverge; truncated or rewritten history can also lose continuity. This is an approximation, not an exact host session identity. It is not a profile-wide shared UUID. Responses requests send full history with store: false and no previous_response_id.

Go and Zen models remain subject to OpenCode's access restrictions; this extension does not bypass them.

🪟 Windows & WSL Usage

  • The active extension stores its API key in that VS Code extension host's encrypted SecretStorage. An explicitly supplied OPENCODE_API_KEY environment variable is also supported (commonly for CI); the extension and E2E tests do not scan OpenCode auth.json files.
  • Automatic compatibility targets are limited to the current OS user's existing VS Code profiles and the WSL distro explicitly associated with the current VS Code remote window. Other user homes and sibling distros are not discovered. Add exact absolute config-file paths to opencode.additionalSyncTargets to opt in to more targets.
  • A compatibility mirror never receives the extension's raw API key. VS Code resolves custom endpoint keys through a target-local SecretStorage reference such as ${input:chat.lm.secret.<id>}. A profile without its own VS Code-generated reference is skipped and reported in the OpenCode Copilot Sync output channel. To enable that mirror, configure OpenCode in that profile through Manage Language Models and enter the key there; the next sync will preserve and reuse that profile's reference.

Remote-SSH, Dev Containers & GitHub Codespaces

The extension's extensionKind: ["ui", "workspace"] setting asks VS Code to activate it on the same host as Copilot Chat in every remote topology, so Remote-SSH, Dev Containers, and Codespaces are expected to work the same way as WSL. These topologies aren't part of the automated test matrix yet (only WSL is), so treat them as best-effort: if sync doesn't pick up your models, run OpenCode: Sync Models to Copilot manually and check the OpenCode Copilot Sync output channel (View → Output → OpenCode Copilot Sync) for the logged Remote: <name> line, which confirms which host the extension actually activated on.

Known limitation: Agents window under Remote-WSL

OpenCode models show up correctly in Manage Language Models and work fine in the regular Copilot Chat view under Remote-WSL. However, they currently do not appear in the model picker inside the Agents window (the standalone agentic session UI) when the workspace is opened via Remote-WSL.

This is a confirmed upstream VS Code limitation, not a bug in this extension: under Remote-WSL, the Agent Host process communicates over a remote path where the BYOK (Bring-Your-Own-Key) bridge is currently hardcoded as unavailable, regardless of which extension registers the model. It affects every BYOK/custom-endpoint provider under WSL, not just OpenCode. Tracked upstream in microsoft/vscode#332085 — a VS Code team member confirmed "Support for WSL is added to the backlog," with no ETA. Plain Windows and Dev Containers are unaffected.


🛠️ How It Works Under the Hood

The extension registers the native OpenCode provider through a thin SDK adapter and maintains optional chatLanguageModels.json mirrors for profile compatibility. Unrelated providers are preserved, and raw API keys are never copied between profiles. Protocol classification and catalog enrichment remain separate from this transport experiment.


Troubleshooting repeated progress messages or premature stops

Check View → Output → OpenCode Copilot Sync for catalog-fetch and registration errors, and VS Code's Copilot logs for request failures. If models are missing, run OpenCode: Sync Models to Copilot and select a model under the native OpenCode provider, not the headerless Custom Endpoint experiment.

The original premature-stop cause remains unconfirmed. Responses turns show a visible notice when the model reaches its output limit or the stream closes without a completion event. Stream timeouts use the recovery behavior described above; output-limit truncation and streams ending without completion are surfaced, not retried. Successful registration and mock requests do not prove live-stream reliability.

To capture evidence for a stop, enable opencode.streamDiagnostics in Settings, reproduce the stop, then copy the [Stream] request ... and [Stream] completed ... lines from View → Output → OpenCode Copilot Sync (never send your prompt text or API key).


CI & Releases

CI runs lint, coverage, complexity checks, tests, and packaging on pull requests and pushes to main. On main, the quality job also commits refreshed CRAP badges. After the checks pass, the release job fast-forwards its checkout to include that badge commit before bumping the version and pushing the release tag. It never force-pushes; divergent history stops the release. The release job then dispatches the GitHub release and Marketplace publishing workflow for that tag.

The release synchronization regression tests use disposable local Git repositories and run with node --test test/ci-release.test.js (also included in npm test).


📄 License

MIT © Mark Fenderov

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