Introduction

When developing agents with DeepSeek Harness, model service calls provided by opencode.ai usually require specific request headers. Manually adding x-opencode-session to each request is both tedious and error-prone. This plugin aims to automate the process, ensuring that requests meet the server-side requirements and avoiding invocation failures caused by missing header information.

Plugin Introduction

This is a DeepSeek Harness plugin maintained by Coco-king and licensed under the MIT License. When model calls are sent to services whose URL contains opencode.ai (such as the OpenCode Go / Zen gateway), it automatically attaches the x-opencode-session request header.

Core Features

  • Automatic header attachment: Automatically adds this header to requests sent to opencode.ai.
  • Fixed within the same conversation: All model requests in the same conversation carry the same value.
  • Different across different conversations: Different conversations do not interfere with each other.
  • Unchanged after network disconnection or restart: The value comes from the conversation’s own persistent identifier, so it remains consistent after restarts, resumed conversations, and reconnecting after network disconnection.
  • Only affects opencode.ai requests: It does not maintain additional state and only modifies the target requests.

Installation and Activation

Install from GitHub:

dsh plugin --profile web add https://github.com/Coco-king/dsh-x-opencode-session.git#v0.1.0

Install from Gitee (available for users in mainland China; the code is automatically mirrored from GitHub to Gitee):

dsh plugin --profile web add https://gitee.com/kkcoco/dsh-x-opencode-session.git#v0.1.0

It takes effect after restarting the web service (or refreshing the page + HMR).

Usage Verification

  1. Start and use a conversation normally with a model provided by opencode-go.
  2. Confirm via packet capture or server-side logs that the request includes the x-opencode-session header.
  3. In the same conversation, multiple requests should carry a consistent value; starting a new conversation should yield a different value; after restarting the web service, sending another message should still use the same value as before.

Notes

  • No configuration is required; the value is automatically reused from the conversation’s own session identifier.
  • It does not maintain additional state and only affects opencode.ai requests.
  • We recommend checking the source code and license before installation.

Conclusion

This plugin resolves the session header issue in opencode.ai calls by reusing the conversation’s own identifier. For more details, refer to GitHub.