본문으로 건너뛰기
M

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.

설치

dsh plugin --profile web add github:maxisoft-git/dsh-opencode-ai

README

OpenCode AI for DeepSeek Harness

English · Русский · 简体中文

License: MIT DSH >= 0.2.2-rc.1 Node >= 22.19

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

RowEffect
Provider route dsh-opencode-aiRegisters 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-freeDSH 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 discoveryAn llm-opencode-ai discovery registration for either gateway; the catalog is cached for refreshMinutes under $DSH_HOME/cache/dsh-opencode-ai/.
Host servicesopencodeAiModels, opencodeAiUsage, opencodeAiAccounts, opencodeAiAnalytics, the Typert remote services the browser half calls.
Typert packagedsh-opencode-ai, with remote ids dsh-opencode-ai#opencodeAiModels/read, #opencodeAiUsage/read, #opencodeAiUsage/readAccount, #opencodeAiAccounts/execute, #opencodeAiAnalytics/read, #opencodeAiAnalytics/exportCsv.
Settings sectionsettings.section entry opencode-ai, labeled OpenCode Go (order 20). Tabs: Overview (master switch, Free channel, accounts), Models, Appearance, Advanced settings.
Right-sidebar tabTab 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 pageA main panel opencode-ai plus a sidebar.panellist entry OpenCode (order 30) opening the same sections as a full page.
Conversation-input pillconversation.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

  1. 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.
  2. In a conversation's model picker, choose a model under DSH OpenCode AI. Agent presets and manual configuration use provider: dsh-opencode-ai.
  3. 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.
  4. To offer the platform's free models, turn on Enable the Free channel on Overview and save. The dsh-opencode-free route 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

KeyDefaultMeaningWhere it is stored
enabledtrueMaster switch for both routes; false withdraws them without unloading the settings pagePlugin row opencode-ai
freeEnabledfalseRegisters the dsh-opencode-free route and fetches its catalog; off means freeBaseURL is never contactedPlugin row opencode-ai
accountsnullUp to 20 accounts: id, name and the account's credential reference; the first entry is currentPlugin row opencode-ai (names and references only)
apiKeyEnvOPENCODE_API_KEYCredential reference of the current accountPlugin row opencode-ai
autoSwitchfalseOn 401/403/429 or an exhausted quota, try the next accounts before any output is emittedPlugin row opencode-ai
baseURLhttps://opencode.ai/inference/go/v1Go gateway: /models discovery, /usage quota and inferencePlugin row opencode-ai
freeBaseURLhttps://opencode.ai/inference/v1Free gateway discovery basePlugin row opencode-ai
proxyURLemptyhttp:, https: or socks5: proxy, optional credentials, no path or queryPlugin row opencode-ai
usageDisplayoffComposer quota pill: auto, always or offPlugin row opencode-ai
usagePillStylebadgePill appearance: badge or plainPlugin row opencode-ai
showSidebarQuotafalseQuota card in the right sidebar, independent of the pill; profile patch only, the settings page has no control for itPlugin row opencode-ai
appearanceThemenativenative follows DSH and third-party themes through Host tokens; classic keeps the plugin's own palette and fontsPlugin 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 valuePlugin row opencode-ai
refreshMinutes60Model catalog cache lifetime; an explicit refresh re-checks immediatelyPlugin row opencode-ai
streamIdleTimeoutMs300000Longest gap between two stream events before the request failsPlugin row opencode-ai
requestPreparationTimeoutMs60000Deadline for discovery and one attempt's credential and image preparationPlugin row opencode-ai
requestTimeoutMs1800000Whole dispatch deadline, including fallback and streamingPlugin row opencode-ai
maxImagesunsetRetained images per request; older images are replaced by a text placeholder above the capPlugin row opencode-ai
maxRequestImageBytes20971520Request-level budget for the base64 image payloadPlugin row opencode-ai
requestImagePixelBudget4194304Pixel budget for one request imagePlugin row opencode-ai
requestImageMaxBytes1048576Encoded-byte target for one request imagePlugin 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 protocolRequest path
OpenAI Chat Completionshttps://opencode.ai/inference/go/openai/v1/chat/completions
OpenAI Responseshttps://opencode.ai/inference/go/openai/v1/responses
Anthropic Messageshttps://opencode.ai/inference/go/anthropic/v1/messages
Googlehttps://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 to 1.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 reports MISSING_BUN_RUNTIME for Free.
  • The browser half is declared for the web platform; 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 ci installs the locked dependencies; npm run compile rebuilds lib/ — host bundle, browser factory and declarations.
  • npm test runs the Vitest suite in tests/ (26 spec files); npm run typecheck checks the host and browser TypeScript projects.
  • npm run check:dist compares an independent rebuild with every shipped artifact, npm run check:pack asserts the npm tarball contents, and npm run check:hygiene checks the tracked sources for UTF-8, LF, trailing whitespace and tabs.
  • npm run test:ci is check:dist followed by npm test; npm run verify runs the bundle self-check in scripts/verify-bundle.mjs (manifest fields, the profile patch, the shipped files).
  • npm run verify:installed -- /path/to/consumer exercises a built package through a consumer's Cordis resolver, npm run verify:headless -- /path/to/consumer adds the official CLI with an isolated profile and a loopback gateway, and npm run check:install:pnpm installs the real tarball in an isolated pnpm consumer.
  • Layout: src/index.ts and src/config.ts compose the plugin and its settings; adapter.ts, catalog.ts, conversion.ts, google.ts and sdk-types.ts handle requests, discovery, replay and protocol conversion; accounts.ts, analytics.ts and pricing.ts cover account commands, official history and tariffs; transport.ts, free-*.ts and migrate.ts cover HTTP/proxy transport, the Free worker and the legacy settings migration; src/client/ is the browser half, with the registration in index.ts, the sections in Section.tsx, UsagePill.tsx, AnalyticsDialog.tsx, SidebarPanel.tsx and page/, and the English/Chinese copy plus theme tokens in presentation.ts.
  • Packaging: npm pack produces the tarball. prepack re-runs check:dist, so a stale lib/ fails before a tarball exists, and prepublishOnly runs typecheck and test:ci. lib/build-info.json records the package version, so bumping package.json requires rebuilding lib/ before a release. A GitHub install uses the committed lib/, so run npm run compile before 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/.

관련 플러그인