dsh-opencode-freeaccess: Using OpenCode Free Models in DSH

Introduction

When configuring the Provider to opencode.ai in DeepSeek Harness (DSH) and sending messages using free models, a common error is 403 FreeTierError: OpenCode's free tier can only be used from within OpenCode. The API key, model ID, and the Harness itself are often configured correctly; the issue arises because OpenCode’s free tier only accepts requests containing a session id, which DSH does not include in outbound requests by default. Possible workarounds include moving the entire task to the OpenCode CLI, purchasing a paid Key, or routing through a proxy/aggregation layer—all of which increase costs or operational overhead. The following introduces the community plugin dsh-opencode-freeaccess (maintainer: mubaid, category: Networking Tools), which supplements session-related headers for requests matching OpenCode routes, enabling the free tier to be used directly within DSH.

What is this

dsh-opencode-freeaccess is a DeepSeek Harness plugin with a narrow responsibility: it writes session identifiers (session id) and headers similar to those of the official client into requests sent to OpenCode. It does not alter the request body, URL, method, credentials, or response content; requests to other hosts are forwarded as-is.

DSH already possesses session information internally, but the adaptation layer previously failed to transmit it to the network. This plugin bridges this gap at the network-accessible layer, eliminating the need to create new Provider blocks or additional gateways.

Core Features

The following features are derived from the project README and package description. For boundaries not independently verified, please refer to the “Notes” section at the end.

  1. Unlock OpenCode Free Tier
    After installation and profile restart, the same Provider and free model can stream responses normally within DSH, instead of returning 403 FreeTierError.

  2. Session-Stable IDs
    The ID is derived from the conversation creation time and conversation uuid, following OpenCode’s format: ses_ + 12 hex digits (time) + 14 digits (uuid derived). One DSH conversation corresponds to one ID, remaining consistent across restarts; parallel conversations do not share IDs.

  3. Concurrency & Sub-agents
    Session scoping utilizes async context, ensuring parallel conversations do not cross-contaminate IDs; sub-agents generate IDs derived from their parent conversations.

  4. Header-Only Modification
    The project includes tests: a diff between matched requests and control requests asserts that only headers differ. Prompt and reply logic are not rewritten by the plugin.

  5. Host-Scoped by Default
    Only processes configured OpenCode-related hosts; the scope can be adjusted via profile patches.

  6. Observability
    When verbose: true is configured, the ID sent in each request can be output to the logs.

  7. No Build Step
    Pure ESM, installed directly from GitHub; the README claims no additional permissions are required.

The injected headers (see README for the full list) include: x-opencode-session, x-session-affinity, x-opencode-session-id, x-session-id, x-opencode-client: cli, x-opencode-project: global, and User-Agent: opencode/latest/<version>/cli.

Installation and Activation

First, install the plugin, then restart the corresponding profile service. The official Quick start is as follows:

dsh plugin --profile web add github:mubaid/dsh-opencode-freeaccess
systemctl restart dsh-web

The README explains: The default configuration already aligns with opencode.ai and common routes, so Provider configuration generally does not need to be changed. If you use a self-hosted gateway or proxy, you can point existing baseURLs to that path, and the plugin will still inject headers on matching hosts.

To observe if the plugin is running:

journalctl -u dsh-web -f | grep opencode-freeaccess

Typical Usage and Expected Phenomena

Before Installation (using the same opencode2 / space-bunny-free, etc. free models):

403 FreeTierError: OpenCode's free tier can only be used from within OpenCode

After Installation and Profile Restart (same Provider, same model, same Key):

streaming normally

Scenario examples from the README (not independent case data, but capability demonstrations):

  • Long-running Agent sessions: The conversation ID remains unchanged throughout the process, allowing upstream to maintain prompt cache affinity rather than generating a new ID per request.
  • Parallel sub-agents: Multiple subtasks each have their own IDs without interfering with each other.
  • When direct connection from dsh to OpenCode is desired without aggregation proxies, while retaining the free tier.
  • Migration from proxy: Removes the intermediate hop while preserving model and free tier behavior.

Advanced configuration is located in the profile’s patch layer. The plugin ID is opencode-freeaccess, with fields including providers, hosts, baseURLs, headers, extraHeaders, userAgent, sessionIdEnv, verbose, seedSessionId, disableFetchInjection; default values are detailed in the repository’s docs/design.md.

Use Cases and Notes

Who is it for

  • Users who have already configured the OpenCode Provider in DSH, want to use its free models, and prefer not to migrate their entire workflow to the OpenCode CLI.
  • Users who require session-level stable IDs (for cache affinity, routing) and want the scope of changes limited to request headers.
  • Users employing protocol stacks based on fetch, such as openai-completions, openai-responses, anthropic-messages.

Comparison with other approaches (excerpted from the README comparison table)

OpenCode CLI Proxy/Aggregation This Plugin
Harness OpenCode Only Any DeepSeek Harness
Free Tier Yes Depends on Upstream Yes
Extra Hop None Yes None
Self-hosted Infrastructure None Yes None

Limitations to be aware of

  • WebSocket transport does not go through fetch, so it is not supported.
  • OpenCode’s free tier expects a tool named read to exist in the request (the official client sends read + shell); DSH includes a tool with the same name by default. Disabling it may cause gateway rejection.
  • Individual free models may occasionally fail upstream; the README explains this may be unrelated to credentials and is considered upstream behavior.
  • The project describes itself as being in an early stage with a narrow scope of responsibility; for unverified items, see VERIFICATION.md.

Security and Trust

The plugin runs with the current DSH process privileges and appends headers to matching outbound requests. Before installation, please read the source code and the MIT license to ensure the host matching scope and patch configuration comply with your environment. Community catalog sites (such as SkillHub) have no official affiliation with DeepSeek / High-Flyer. This plugin comes from community maintainer mubaid and is not an official app store entry.

Conclusion

dsh-opencode-freeaccess addresses the gap where “DSH knows the session id but does not write it into the OpenCode request”: a single installation command and profile restart allow you to continue using OpenCode’s free models within the Harness, without the need for proxies or paid Keys. Details, tests, and configuration defaults are subject to the GitHub repository.

  • Catalog Page: https://www.skillhub.cn/plugins/mubaid/dsh-opencode-freeaccess
  • GitHub: https://github.com/mubaid/dsh-opencode-freeaccess
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye