Introduction¶
DeepSeek Harness (DSH) adopts an “everything is a plugin” architecture, allowing inference providers to be dynamically loaded at runtime. However, when using OpenCode’s free inference channels, common issues include: frequent 403 FreeTierError when calling the official API directly; difficulty recovering after a single IP triggers 429 rate limiting; and challenges in handling signature and protocol details via proxy approaches. OpenCode-Next is a native OpenCode OAuth and OpenCode Go Provider plugin for DSH. It connects directly to the official /inference/openai/v1 endpoint, uses personal OAuth tokens, and employs background probing and caching mechanisms to minimize the impact of rate limiting and unavailability.
What Is It¶
OpenCode-Next (package name opencode-next) is a DSH model inference plugin developed by maintainer kizaki-R. It provides DSH with a dual-track “OpenCode OAuth + OpenCode Go” authentication and inference channel, aimed at resolving 403 errors, single-IP rate limiting, and inconsistent model availability. The plugin features real-time catalog discovery, availability validation, and caching, allowing users to complete login, model filtering, and parameter viewing directly from the DSH settings page.
Core Capabilities¶
- Dual-track OAuth: Automatically inherits logged-in OAuth tokens from the local OpenCode Desktop (
~/.local/share/opencode/opencode.db), and also supports launching an independent browser-based device authorization flow (RFC 8628) viaopencode-next-login. - Official authenticated endpoint: Uses
https://opencode.ai/inference/openai/v1/chat/completionsfor API calls, rather than third-party relays. - Full reasoning stream passthrough: Converts upstream incremental
reasoning_contentinto DSH’sreasoning-deltachunks in real time, keeping the reasoning process visible. - Tool call compatibility: Works seamlessly with DSH’s agent tools (read, write, edit, pwsh, etc.).
- Real-time catalog and availability probing: Retrieves candidate model lists from
models.opencode.aiand uses background probes to distinguish truly available models from placeholder entries. - Elastic availability detection: New models only appear in the DSH selector after a successful probe; existing models are hidden after two consecutive probe failures; explicit 404/410 responses trigger immediate retirement; successful probes automatically restore a model.
- DSH settings page entry: Provides an “OpenCode-Next” tab in DSH settings with four sub-tabs (Account, Free Models, Advanced, OpenCode Go), supporting logout/login, filtering free or Go models, and viewing quota and probe status.
- v2 protocol alignment and Bun transport: Uses native Bun transport, auto-detects the
bun.exeenvironment, aligns upstream request headers (x-opencode-org-id, workspace SHA1,max_completion_tokens), and implements bidirectional tool name aliasing to avoid pseudo-429 errors. - Configuration and timeout controls: Supports catalog polling interval (default 15 minutes), full re-probe interval (default 6 hours), probe cache path (default
~/.dsh/opencode-next.models.json), stream idle timeout (default 60 seconds), and other configurable options.
Installation and Enablement¶
Install the plugin package via npm:
npm install opencode-next
Enable the package in DSH’s plugin configuration. Once enabled, the “OpenCode-Next” entry will appear on the DSH settings page.
Typical Usage¶
- Login: Complete login or logout on the “OpenCode-Next > Account” page in DSH settings.
- Select models: Filter the models you want to appear in the DSH selector on the “Free Models” or “OpenCode Go” page.
- Invoke inference: Select any supported tool in DSH (e.g.,
writeorpwsh) and use a model provided by OpenCode-Next. - View quota and status: Check the current quota reset time and most recent probe status at the bottom of the settings page.
Use Cases and Notes¶
Ideal for users who need to develop or debug using OpenCode’s free inference channels, especially those looking to avoid 403 errors and single-IP rate limiting, or who require full reasoning streams and tool call support.
Note: The plugin runs with the permissions of the current DSH process. Before installation, review the source code and license (MIT) to ensure it meets your use case and security requirements.
In Summary¶
OpenCode-Next integrates OpenCode’s official inference capabilities into DSH through native OAuth and Go Provider, while using probing and caching to mitigate rate limiting and availability issues. For the plugin directory and source code, refer to:
- Plugin directory: https://www.skillhub.cn/plugins/kizaki-R/OpenCode-Next-for-DSH
- GitHub: https://github.com/kizaki-R/OpenCode-Next-for-DSH