Introduction

The plugin mechanism of DeepSeek Harness (DSH) allows its functionality to be extended. When integrating Anthropic models, developers often encounter two specific issues: first, without an Anthropic API Key, Pro/Max subscription entitlements cannot be used; second, when DSH handles a 1 million-token context window, sessions can freeze due to excessive image sizes (over 2000px) or a failed /compact compression call. dsh-anthropic-membership is designed to address these two limitations.

Core Features

This plugin provides the following capabilities:

  1. OAuth login: Uses Anthropic’s membership OAuth grant to sign in to Pro/Max without entering an API Key.
  2. Image size limit: Downsamples the long edge of requested images to 2000px, avoiding rejection due to excessive size.
  3. Context compaction optimization: Streamlines /compact calls, discards images and reasoning content, truncates overly long tool text, and enables successful compaction in a 1 million-token context window.
  4. Configuration and credential management: Writes login credentials and model settings to DSH configuration files.
  5. Local control API: Provides a local control interface (127.0.0.1:8185) for managing login status and viewing plan usage.

Installation

This plugin depends on the DSH CLI. The installation command is as follows:

dsh plugin --profile web add github:antonio-mastropaolo/dsh-anthropic-membership

After installation, restart dsh web to load the plugin.

Usage

UI Operations

  1. Start dsh web and open the settings page.
  2. Go to Settings → Models.
  3. On the Anthropic model card, click Sign in with Claude Pro/Max.
  4. Select an anthropic or claude-* model to use.

Command-Line Operations

If the UI is unavailable, you can use the command-line scripts:

node login.mjs    # 登录
node logout.mjs   # 登出
node usage.mjs    # 查看使用情况

Configuration and Control API

Storage Location

The plugin writes configuration and credentials to the DSH configuration directory:

  • Settings: Writes llm-pi-ai.providers.anthropic (excluding apiKeyEnv) to ~/.dsh/settings.yaml or the path pointed to by the $DSH_SETTINGS environment variable.
  • Credentials: Writes llm-pi-ai/anthropic to ~/.dsh/.credentials.yaml (file permissions are 0600).

Local Control Interface

The plugin starts a local control service, listening on 127.0.0.1:8185 by default (modifiable via DSH_MEMBERSHIP_PORT, but the settings button expects the default port).

Request Requirements:
* Must include the Origin request header.
* Must include the x-dsh-membership: 1 request header.
* CORS does not support arbitrary Origin values; requests are normally initiated by the DSH UI.

Available Interfaces:

Method Path Description
GET /healthz Returns { ok: true }
GET /status Returns { signedIn, expiresAt, imageCap, compactionSlim }. If an Origin header is sent, it must be the DSH UI Origin
POST /login logs in. Requires the Origin header and the x-dsh-membership header
POST /logout Logs out

Notes

  1. Dependency: The DSH CLI must be installed and running.
  2. UI limitations: Message counts displayed in the UI are for DSH itself only; remaining messages, tokens, or dollar amounts are not shown.
  3. Concurrent logins: The /login endpoint returns a 409 error if a login request is already in progress.
  4. Authentication mode: The control API requires Origin header validation and does not support arbitrary CORS Origin values.