dsh-llm-opencode

August 29, 2026 · View on GitHub

中文 | English

npm version License: MIT DSH Plugin

OpenCode Zen free model provider adapter for DeepSeek Harness (DSH).

Registers the opencode-zen provider route in DSH's LLM seam, giving your coding agent access to OpenCode Zen's free-tier models — no API key required for free models, no credit card, no setup friction.

Free Models

Built-in catalog (verified against the gateway + models.dev on 2026-08-29; refreshed automatically at startup and weekly via CI):

ModelIDContextMax OutputNotes
DeepSeek V4 Flash Freedeepseek-v4-flash-free200K128KDeepSeek's V4 Flash, SWE-bench ~79%
Nemotron 3 Ultra Freenemotron-3-ultra-free1M128KNVIDIA's flagship, huge context
Nemotron 3.5 Lightning Freenemotron-3.5-lightning-free128K128KNVIDIA's fast variant
MiMo V2.5 Freemimo-v2.5-free200K32KXiaomi's coding model
Hy3 Freehy3-free190K64KTencent HY3
Laguna S 2.1 Freelaguna-s-2.1-free256K32K
Muse Spark 1.2 Freemuse-spark-1.2-contributor-free128K128K
Ling 3.0 Flash Fin Freeling-3.0-flash-fin-free128K128KFinance-oriented free model (models.dev gives no context/output limit, falls back to 128K)
Big Picklebig-pickle200K32KStealth general-purpose model

Free models are served through OpenCode Zen's public gateway. Availability may change; the adapter auto-discovers models tagged free from the /models endpoint, and the built-in catalog is re-synced in the background on every startup (see Startup catalog sync below).

Install

# From npm (prebuilt, recommended)
dsh plugin --profile web add dsh-llm-opencode

# Or from GitHub directly
dsh plugin --profile web add "github:bobowsh/dsh-llm-opencode#main"

Quick Start

  1. Install the plugin into your DSH profile (see above).
  2. Open DSH Web Settings → Models → select OpenCode Zen as your provider.
  3. Pick a free model (e.g. deepseek-v4-flash-free) and start coding — no API key needed.

Paid models require an API key. Set OPENCODE_API_KEY in DSH credentials (Settings → Credentials) or as an environment variable.

How It Works

This plugin implements the LlmAdapter interface from @deepseek-ai/dsh-llm and registers a single provider route opencode-zen. When DSH routes a request to this provider:

  1. Serialization — harness messages are translated to OpenAI-compatible chat completions (text-only; images are rejected with UNSUPPORTED_CONTENT).
  2. Streaming — SSE responses are parsed via eventsource-parser and translated into harness StreamChunk events (block-start, text-delta, reasoning-delta, tool-call-delta, usage, finish).
  3. Identity — requests carry User-Agent: opencode/1.0.0 and related headers to satisfy OpenCode Zen's client identity check (the default deepseek-harness/... user-agent is rejected by the gateway).
  4. Credentials — resolves the API key from DSH's credential store (env var OPENCODE_API_KEY) or the ambient environment. Free models work without a key; paid models require one.
  5. Model discovery — registers a discovery handler that fetches /models from the gateway and filters for free-tagged entries.
  6. Startup catalog sync — on every plugin load the free model catalog is refreshed in the background from the gateway (membership) plus models.dev (name / limit.context / limit.output metadata). Failures keep the built-in catalog; a custom models: list in settings is never overwritten. Disable with autoSyncModels: false.

Configuration

Zero configuration required. The plugin registers itself when installed into a profile (see Bundle Patch), and every setting has a sensible default — you do not need to touch settings.yaml at all.

Only override what you actually want to change: prefer the DSH Web Settings → Models page, or override individual fields in the llm-opencode section of your profile's settings.yaml. Changes take effect immediately without restart.

SettingDefaultDescription
baseURLhttps://opencode.ai/zen/v1Gateway endpoint
apiKeyEnvOPENCODE_API_KEYCredential store key for the API token
maxTokens128000Default max output tokens per request
defaultContextWindow1000000Fallback context window for unknown models
streamIdleTimeoutMs300000Max idle time (ms) before stream is considered dead
models(built-in catalog)Override the model catalog
autoSyncModelstrueRefresh the free model catalog from the gateway + models.dev on every startup
retryPolicy(built-in)Retry behavior for transient errors

Example settings.yaml snippet (optional)

Only needed when overriding defaults:

llm-opencode:
  baseURL: "https://opencode.ai/zen/v1"
  maxTokens: 64000
  models:
    - id: deepseek-v4-flash-free
      name: DeepSeek V4 Flash Free
      contextWindow: 200000
      maxTokens: 128000

See settings.example.yaml for a full annotated example.

Bundle Patch

The included cordis.patch.yml registers the llm-opencode plugin row into the DSH bundle loader, so the plugin is auto-loaded when installed into a profile.

Development

npm install
npm test
npm run lint

Requirements

  • DeepSeek Harness >= 0.1.0-rc.7
  • @deepseek-ai/cordis ^4.0.1 (peer dependency)

License

MIT © bobowsh