Proxy to use Command Code Go subscription models from OpenCode through a local OpenAI-compatible bridge.
- Launches a local shim server on
127.0.0.1 - Synchronizes the
commandcodeprovider automatically in OpenCode - Maintains a dynamic catalog of Command Code models
- Protects the shim with an internal local token
- Includes watchdog auto-recovery, diagnostics, catalog refresh, and runtime control
node proxy.js # start server (foreground)
node proxy.js --background # start with watchdog
node proxy.js --stop # stop server
node proxy.js --status # show status
node proxy.js --logs --follow # live log tailing
node proxy.js --doctor # full diagnostics
node proxy.js --docs-models # scrape Open Source model capabilities from docs and apply
node proxy.js --edit-models # interactive TUI to toggle capabilities per modelnode proxy.js --setupnode proxy.js --refresh-models # sync catalog
node proxy.js --refresh-models --probe # validate real availability
node proxy.js --refresh-models --full # probe text, image, reasoning, tools
node proxy.js --refresh-models --full --yes # skip confirmationnode proxy.js --docs-modelsScrapes the Command Code documentation for Open Source models and applies their documented capabilities (vision, reasoning, etc.) to ~/.config/ocg/manual-capabilities.json, then syncs to OpenCode. The data survives catalog refreshes and is immediately visible in OpenCode (image input, reasoning badge, etc.).
All capabilities are tagged with source manual_override and can be verified or adjusted with --edit-models.
node proxy.js --edit-modelsRaw-mode TUI with arrow key navigation:
- ↑↓ — navigate between models and capabilities
- Enter — select a model to edit, or toggle a capability on/off
- Esc/q — go back to model list or exit
- ▣/□ — enabled/disabled capability indicator
Overrides are persisted to ~/.config/ocg/manual-capabilities.json, survive any catalog refresh, and are automatically synced to opencode.json on exit.
%APPDATA%\ocg\config.json%APPDATA%\ocg\secrets.json%APPDATA%\ocg\compatibility.commandcode.json
~/Library/Application Support/ocg/
${XDG_CONFIG_HOME:-~/.config}/ocg/
Runtime data:
compatibility.commandcode.json— cached model catalogmanual-capabilities.json— manual capability overrides (via--edit-modelsor--docs-models)usage.json— cached Command Code usage/balancesecrets.json— local tokenconfig.json— server configuration
Setup syncs the provider to:
~/.config/opencode/opencode.json
Provider IDs:
commandcode(canonical)ocg(legacy alias)
Base URLs:
http://127.0.0.1:4310/commandcode/v1http://127.0.0.1:4310/ocg/v1(legacy alias)
The shim writes an internal header so that only OpenCode is a valid client of the local provider.
On sync, the shim inspects existing providers in opencode.json and attempts to read metadata from the OpenCode Desktop sidecar. When a Command Code model matches another provider by normalized id, missing capabilities are enriched from the best match. Provenance is tagged as cross-provider-sidecar:<providerId> or cross-provider-config:<providerId> depending on the source.
The catalog is built dynamically at startup:
- Runs
cmd --list-modelsas the primary source - Falls back to
https://api.commandcode.ai/provider/v1/models - Filters to Open Source models (Go subscription scope)
- Infers capabilities (vision, multimodal, reasoning)
- Tests compatibility conservatively
- Avoids pruning the catalog due to transient quota errors
- Resynchronizes visible models in OpenCode
OpenCode badges are driven by:
modalities.input— upstream capabilities, with fallback registry only when upstream omits the datacapabilities.{vision,pdf,audio,video}— preserve the original sourcereasoning: true— controls the "Allows reasoning" badgevariants— only when a confirmed mapping exists
When an image is sent to a text-only model and the upstream accepts it (200 OK), the shim automatically promotes vision: true in the compatibility matrix and syncs OpenCode. Once promoted, it persists across catalog refreshes.
- Local loopback by default (
127.0.0.1) - Mandatory internal token between OpenCode and the shim
- No open CORS
- Upstream timeout and body size limits
node proxy.js --background— refreshes catalog, starts shim, launches watchdognode proxy.js --stop— attempts/shutdownendpoint, falls back to PID/port killnode proxy.js --logs— reads the shim lognode proxy.js --logs --watchdog— reads the watchdog lognode proxy.js --reset— deletes local config and secrets
- OpenAI-compatible shim, not a native OpenCode plugin
- Reasoning effort levels only exposed when a confirmed mapping exists
- Catalog hints may rely on fallback metadata when Command Code omits the data
- Only text and image are normalized; other structured media is passed through generically
- Depends on upstream endpoints which may change
node proxy.jsnode --testMIT