- Home
- Plugin
- Modelli e provider
- dsh-opencode-ai
dsh-opencode-ai
maxisoft-git/dsh-opencode-ai
OpenCode model provider with its own provider route, services and right-sidebar panel, independent of dsh-opencode-go.
Installazione
dsh plugin --profile web add github:maxisoft-git/dsh-opencode-aiREADME
OpenCode AI for DeepSeek Harness
OpenCode AI is a model provider for DeepSeek Harness. It registers the LLM route dsh-opencode-ai, shown
as DSH OpenCode AI, discovers the chat models the gateway lists, and sends each DSH request through
the protocol that model declares: OpenAI Chat Completions, OpenAI Responses, Anthropic Messages or Google.
Requests go to the OpenCode Go subscription gateway by default, or to a compatible gateway that baseURL
points at. The plugin is independent of dsh-opencode-go: nothing at runtime depends on that package, and
the plugin brings its own route ids, Typert package and services, settings row (opencode-ai) and cache
directory, so both packages can be installed side by side. Its panel is a tab named OpenCode in the
right sidebar, beside the conversation; the same sections are also on an OpenCode page in the left
sidebar's panel list, and an optional quota pill sits next to the conversation input. It does not run or
wrap the OpenCode CLI, adds no agent tools and no slash commands, does not choose a default model by
itself, and exposes no OpenAI- or Anthropic-compatible API endpoint of its own: protocol conversion
happens only on the way out to the gateway.
What it adds
| Row | Effect |
|---|---|
Provider route dsh-opencode-ai | Registers DSH OpenCode AI with the LLM registry while at least one usable key is configured, and withdraws it when none is. Models come from baseURL/models. |
Provider route dsh-opencode-free | DSH OpenCode Free, opt-in through freeEnabled. While it is off, the route is not registered, freeBaseURL/models is not fetched and no Free model is offered anywhere. |
| Model discovery | An llm-opencode-ai discovery registration for either gateway; the catalog is cached for refreshMinutes under $DSH_HOME/cache/dsh-opencode-ai/. |
| Host services | opencodeAiModels, opencodeAiUsage, opencodeAiAccounts, opencodeAiAnalytics, the Typert remote services the browser half calls. |
| Typert package | dsh-opencode-ai, with remote ids dsh-opencode-ai#opencodeAiModels/read, #opencodeAiUsage/read, #opencodeAiUsage/readAccount, #opencodeAiAccounts/execute, #opencodeAiAnalytics/read, #opencodeAiAnalytics/exportCsv. |
| Settings section | settings.section entry opencode-ai, labeled OpenCode Go (order 20). Tabs: Overview (master switch, Free channel, accounts), Models, Appearance, Advanced settings. |
| Right-sidebar tab | Tab type opencode-ai, titled OpenCode, in sidebar.right.pane.tab and sidebar.right.pane.tab.title (sidebar guide order 30), with Quota, Models, History and Settings. |
| Left-sidebar page | A main panel opencode-ai plus a sidebar.panellist entry OpenCode (order 30) opening the same sections as a full page. |
| Conversation-input pill | conversation.input.right entry opencode-ai-usage (order 1000): the current account's quota and account switching. Hidden by default, because usageDisplay defaults to off. |
Two upstream names are kept deliberately: the wire provider id opencode-go in replay metadata, and the
DSH_OPENCODE_GO_ACCOUNT_ prefix of generated credential references, because stored keys are addressed by
those names. A one-time migration also reads the legacy opencode-go settings row. The browser half
registers English and Simplified Chinese copy only; no Russian dictionary is shipped.
Install
DSH 0.2.2-rc.1 or newer, Node.js 22.19 or newer.
In DSH. Plugins → Add plugin with the installation spec github:maxisoft-git/dsh-opencode-ai. The
plugin manager installs it for the whole profile; a new session picks it up. Web and Headless are separate
profiles, so each one that should use the provider needs its own install. This package ships its built
lib/ — host bundle, browser factory and type declarations — so a GitHub install needs no build step.
From a checkout. git clone https://github.com/maxisoft-git/dsh-opencode-ai.git, then install that
absolute directory with Plugins → Add plugin. Development builds (npm ci, npm run compile) are
described in docs/development.md.
Use
- Open Settings → OpenCode Go. On Overview, the Enable OpenCode Go switch is on by default; in the Accounts card press Add account, enter a name and the OpenCode Go subscription API key, and confirm. The key is written to DSH's credential service and the page does not show it again. Up to 20 accounts are kept: the first is current, and the list order is the order automatic fallback tries.
- In a conversation's model picker, choose a model under DSH OpenCode AI. Agent presets and manual
configuration use
provider: dsh-opencode-ai. - The Models tab lists the discovered models, with a visibility switch per model and Context window, Max output and thinking-budget overrides for the model you select.
- To offer the platform's free models, turn on Enable the Free channel on Overview and save. The
dsh-opencode-freeroute is registered at the next settings update, and its models then appear under DSH OpenCode Free in the picker.
The panel is the OpenCode tab of the right sidebar: Quota (five-hour, weekly and monthly windows
with reset times), Models, History (the official daily usage dashboard) and Settings. The
OpenCode entry in the left sidebar opens the same sections as a full page. The quota pill next to the
conversation input is off by default; choose Auto (only while a DSH OpenCode AI model is selected)
or Always in Settings → OpenCode Go → Appearance → Usage display, where Interface theme and
Input quota style (badge or plain) are set as well. The sidebar quota card is enabled by
showSidebarQuota (off by default), set in the profile patch — the settings page has no control for it.
A profile patch addresses the bundle's row by its id, opencode-ai:
- id: opencode-ai
config:
apiKeyEnv: OPENCODE_API_KEY
accounts:
- id: primary
name: Primary
apiKeyEnv: OPENCODE_API_KEY
- id: backup
name: Backup
apiKeyEnv: OPENCODE_GO_BACKUP_KEY
autoSwitch: true
modelVisibility:
deepseek-v4-pro: false
modelLimits:
deepseek-v4.1-flash:
maxTokens: 8192
examples/headless.patch.yml selects the provider and a model for headless
sessions. docs/advanced.en.md covers headless setup, proxies, manual gateway
configuration and the Free channel's error codes.
Configuration
| Key | Default | Meaning | Where it is stored |
|---|---|---|---|
enabled | true | Master switch for both routes; false withdraws them without unloading the settings page | Plugin row opencode-ai |
freeEnabled | false | Registers the dsh-opencode-free route and fetches its catalog; off means freeBaseURL is never contacted | Plugin row opencode-ai |
accounts | null | Up to 20 accounts: id, name and the account's credential reference; the first entry is current | Plugin row opencode-ai (names and references only) |
apiKeyEnv | OPENCODE_API_KEY | Credential reference of the current account | Plugin row opencode-ai |
autoSwitch | false | On 401/403/429 or an exhausted quota, try the next accounts before any output is emitted | Plugin row opencode-ai |
baseURL | https://opencode.ai/inference/go/v1 | Go gateway: /models discovery, /usage quota and inference | Plugin row opencode-ai |
freeBaseURL | https://opencode.ai/inference/v1 | Free gateway discovery base | Plugin row opencode-ai |
proxyURL | empty | http:, https: or socks5: proxy, optional credentials, no path or query | Plugin row opencode-ai |
usageDisplay | off | Composer quota pill: auto, always or off | Plugin row opencode-ai |
usagePillStyle | badge | Pill appearance: badge or plain | Plugin row opencode-ai |
showSidebarQuota | false | Quota card in the right sidebar, independent of the pill; profile patch only, the settings page has no control for it | Plugin row opencode-ai |
appearanceTheme | native | native follows DSH and third-party themes through Host tokens; classic keeps the plugin's own palette and fonts | Plugin row opencode-ai |
modelVisibility | {} | Picker switches by model id; Free models use dsh-opencode-free/<id> | Plugin row opencode-ai |
modelLimits | {} | Per-model contextWindow, maxTokens and extra thinkingBudgets; null keeps the catalog value | Plugin row opencode-ai |
refreshMinutes | 60 | Model catalog cache lifetime; an explicit refresh re-checks immediately | Plugin row opencode-ai |
streamIdleTimeoutMs | 300000 | Longest gap between two stream events before the request fails | Plugin row opencode-ai |
requestPreparationTimeoutMs | 60000 | Deadline for discovery and one attempt's credential and image preparation | Plugin row opencode-ai |
requestTimeoutMs | 1800000 | Whole dispatch deadline, including fallback and streaming | Plugin row opencode-ai |
maxImages | unset | Retained images per request; older images are replaced by a text placeholder above the cap | Plugin row opencode-ai |
maxRequestImageBytes | 20971520 | Request-level budget for the base64 image payload | Plugin row opencode-ai |
requestImagePixelBudget | 4194304 | Pixel budget for one request image | Plugin row opencode-ai |
requestImageMaxBytes | 1048576 | Encoded-byte target for one request image | Plugin row opencode-ai |
apiKeyEnv and every accounts[].apiKeyEnv are credential references — environment-variable-shaped
names that DSH's credential service resolves, falling back to the launch environment. The profile stores
the name, never the key; the settings page writes accounts through the same service and never re-displays
a stored key. The row id opencode-ai is the Loader entry from cordis.patch.yml, and this plugin's
settings live in the profile's row for it.
Data and network
Inference. Prompt text, tool results and attached images are sent to the gateway you configure:
baseURL (default https://opencode.ai/inference/go/v1) for the Go route, and freeBaseURL (default
https://opencode.ai/inference/v1) only while freeEnabled is on. Against the official gateway the plugin
uses the protocol endpoint of the protocol each model declares:
| Declared protocol | Request path |
|---|---|
| OpenAI Chat Completions | https://opencode.ai/inference/go/openai/v1/chat/completions |
| OpenAI Responses | https://opencode.ai/inference/go/openai/v1/responses |
| Anthropic Messages | https://opencode.ai/inference/go/anthropic/v1/messages |
https://opencode.ai/inference/go/google/v1beta/models/{model}:streamGenerateContent |
A custom baseURL keeps its own prefix and each protocol SDK appends its resource path; on the official
base, an endpoint URL declared by the model listing is used instead when present. Every request carries an
x-opencode-session header derived from the DSH conversation id — printable ASCII ids unchanged, other ids
as sha256 + base64url — for gateway cache affinity; neither form contains message content.
Metadata, quota, history. GET {baseURL}/models lists the Go models, and GET {freeBaseURL}/models is
requested only with freeEnabled. GET {baseURL}/usage reads the five-hour, weekly and monthly quota of
one account. The History section asks the Host for
https://opencode.ai/console/api/v2/usage/export?range=7d|30d|90d with the selected account's key, only
for the official gateway; the browser receives aggregate totals and provider/model/day rows, not the CSV.
Discovery requests are unauthenticated, quota requests carry the account key, and neither carries
conversation content.
Keys. Stored in the DSH credential service under the reference the profile names (OPENCODE_API_KEY by
default, DSH_OPENCODE_GO_ACCOUNT_<ID> for accounts created in the panel) or resolved from the launch
environment. The browser never receives a key, settings never re-display one, and HTTP failures and log
lines redact credential material.
Disk. $DSH_HOME/cache/dsh-opencode-ai/go.models.json and free.models.json hold the model catalog:
model metadata, protocol declarations, tariffs, the source URL and an ETag; DSH_HOME defaults to
~/.dsh. No prompt, image or key is written there.
Logs. Route registration and withdrawal, catalog refresh failures, model declarations that had to be skipped, dropped per-model settings, the origin of a Free endpoint whose saved keys are not reused, and account or migration failures. Prompts, images and key values are not logged, and the plugin writes no request traces or diagnostic files.
Turning it off. enabled: false withdraws both routes, and freeEnabled: false keeps the Free gateway
from being contacted at all. The model list can still be read from the cache, but inference and quota need
their gateway; there is no offline mode.
Security
SECURITY.md — how to report a vulnerability, which versions are supported, and the scope.
SECURITY-AUDIT.md — the per-plugin audit: data flow, hosts contacted, DSH services
used, findings and their fixes.
A model provider sits on the path of every conversation: the prompts, tool results and images you send are
transmitted to the gateway you configure, so that gateway has to be trusted as much as the model. A custom
baseURL, a proxyURL or a TLS-terminating middlebox moves that trust to another host. The Free channel
is off by default because it sends requests to the platform's public entry point identifying itself with the
OpenCode CLI user agent (opencode/latest/2.2.5/cli), which may violate upstream terms and may trigger
rate limits or account restrictions.
Requirements
- DeepSeek Harness 0.2.2-rc.1 or newer, as declared in
engines.dsh. DSH supplies the Host peers: Cordis^4.0.5, the@deepseek-ai/dsh-*packages and@deepseek-ai/schemastery. - Node.js 22.19.0 or newer, as declared in
engines.node. - No OpenCode CLI and no extra binary for the Go route. The Free route uses the official
@oven/bun-*runtime packages, pinned to1.4.4, which cover macOS, Linux (glibc, musl, Android), FreeBSD and Windows on x64 and arm64. They are optional dependencies: a machine without a matching package runs Go and reportsMISSING_BUN_RUNTIMEfor Free. - The browser half is declared for the
webplatform; a Headless profile uses the Host half only. - An optional HTTP, HTTPS or SOCKS5 proxy on the machine running DSH.
- Recorded acceptance results, including the checks still pending for the 0.2.2-rc.1 Web/client surface,
are in
docs/verification.md.
Development
npm ciinstalls the locked dependencies;npm run compilerebuildslib/— host bundle, browser factory and declarations.npm testruns the Vitest suite intests/(26 spec files);npm run typecheckchecks the host and browser TypeScript projects.npm run check:distcompares an independent rebuild with every shipped artifact,npm run check:packasserts the npm tarball contents, andnpm run check:hygienechecks the tracked sources for UTF-8, LF, trailing whitespace and tabs.npm run test:ciischeck:distfollowed bynpm test;npm run verifyruns the bundle self-check inscripts/verify-bundle.mjs(manifest fields, the profile patch, the shipped files).npm run verify:installed -- /path/to/consumerexercises a built package through a consumer's Cordis resolver,npm run verify:headless -- /path/to/consumeradds the official CLI with an isolated profile and a loopback gateway, andnpm run check:install:pnpminstalls the real tarball in an isolated pnpm consumer.- Layout:
src/index.tsandsrc/config.tscompose the plugin and its settings;adapter.ts,catalog.ts,conversion.ts,google.tsandsdk-types.tshandle requests, discovery, replay and protocol conversion;accounts.ts,analytics.tsandpricing.tscover account commands, official history and tariffs;transport.ts,free-*.tsandmigrate.tscover HTTP/proxy transport, the Free worker and the legacy settings migration;src/client/is the browser half, with the registration inindex.ts, the sections inSection.tsx,UsagePill.tsx,AnalyticsDialog.tsx,SidebarPanel.tsxandpage/, and the English/Chinese copy plus theme tokens inpresentation.ts. - Packaging:
npm packproduces the tarball.prepackre-runscheck:dist, so a stalelib/fails before a tarball exists, andprepublishOnlyrunstypecheckandtest:ci.lib/build-info.jsonrecords the package version, so bumpingpackage.jsonrequires rebuildinglib/before a release. A GitHub install uses the committedlib/, so runnpm run compilebefore committing source changes that affect it.
License
MIT © 2026 maxisoft-git. See LICENSE. Bundled third-party code — the pi-ai host bundle, the
@google/genai bridge, the TypeBox-derived rules in pi-schema and the Bun runtime packages — is attributed
with its licenses in THIRD_PARTY_NOTICES.md, reproduced in
lib/vendor-licenses.txt and scripts/licenses/.
Plugin correlati
dsh-our-free-model
ebony-vinyl/dsh-our-free-model
dsh-routing-suite
yjh051108/dsh-routing-suite
dsh-connect-workbuddy
dingminhua/dsh-connect-workbuddy
dsh-workbuddy-connect
corrinehu/dsh-workbuddy-connect