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:
- OAuth login: Uses Anthropic’s membership OAuth grant to sign in to Pro/Max without entering an API Key.
- Image size limit: Downsamples the long edge of requested images to 2000px, avoiding rejection due to excessive size.
- Context compaction optimization: Streamlines
/compactcalls, discards images and reasoning content, truncates overly long tool text, and enables successful compaction in a 1 million-token context window. - Configuration and credential management: Writes login credentials and model settings to DSH configuration files.
- 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¶
- Start
dsh weband open the settings page. - Go to Settings → Models.
- On the Anthropic model card, click Sign in with Claude Pro/Max.
- Select an
anthropicorclaude-*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(excludingapiKeyEnv) to~/.dsh/settings.yamlor the path pointed to by the$DSH_SETTINGSenvironment variable. - Credentials: Writes
llm-pi-ai/anthropicto~/.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¶
- Dependency: The DSH CLI must be installed and running.
- UI limitations: Message counts displayed in the UI are for DSH itself only; remaining messages, tokens, or dollar amounts are not shown.
- Concurrent logins: The
/loginendpoint returns a 409 error if a login request is already in progress. - Authentication mode: The control API requires
Originheader validation and does not support arbitrary CORSOriginvalues.