# DSH Claude Subscription

[![npm version](https://img.shields.io/npm/v/dsh-claude-subscription?logo=npm&label=npm)](https://www.npmjs.com/package/dsh-claude-subscription)
[![License: MIT](https://img.shields.io/badge/license-MIT-111111.svg)](LICENSE)

[繁體中文](README.md)

Sign in to a Claude Pro / Max subscription directly in DeepSeek Harness, with
no Anthropic API key required. Sign-in and token refresh use the official
Anthropic OAuth flow (the same one Claude Code uses). Credentials stay in
DSH's host credential service: no token extraction, no resale, no extra billing.

[Agent install](#let-an-agent-install-it-recommended) · [Manual install](#manual-install) · [Update and uninstall](#update-and-uninstall)

## What it does

- Uses your Claude Pro / Max subscription directly inside DSH, with no Anthropic API key required;
- Signs in to claude.ai from the Anthropic card under **Settings -> Models** or from **Settings -> Claude subscription**, using the official OAuth flow and keeping credentials on the host;
- Refreshes the access token automatically with the refresh token;
- Shows sign-in status and token expiry;
- Shows the **subscription quota**: remaining percentage and reset time for the 5-hour, 7-day, Opus, and Sonnet windows;
- Adds a **composer quota** toggle (off by default) that shows the current model's remaining quota next to the message input;
- Fails visibly when subscription routing is unavailable instead of silently using another paid route.

## Prepare DSH

This plugin currently supports only DeepSeek Harness `0.1.2-alpha.5` and
requires a Claude Pro, Max, Team, or Enterprise subscription. DSH remains a
developer preview; an npm `latest` or `next` release other than
`0.1.2-alpha.5` is outside this plugin version's supported range.

Run `dsh --version` before installation. Do not merely ignore peer dependency
warnings.

## Install

### Let an Agent install it (recommended)

Send the following URL directly to your Agent. The guide contains install,
update, uninstall, and verification steps. It preserves the DSH profile and
sign-in and never restarts DSH without permission:

[Open the Agent installation guide](https://raw.githubusercontent.com/x5427876/dsh-claude-subscription/main/AGENTS.md)

```text
https://raw.githubusercontent.com/x5427876/dsh-claude-subscription/main/AGENTS.md
```

### Manual install

When the `dsh` command is available:

```sh
dsh plugin --profile web add dsh-claude-subscription
dsh plugin --profile web list dsh-claude-subscription --depth 0
dsh --profile web --dump-config
```

For DSH Desktop, put the `pnpm pack` tarball into
`~/.dsh/profiles/<profile>/`, add the `file:` dependency and the
`dsh.profile.bundles` entry in that profile's `package.json`, run
`pnpm install` there, then restart DSH. After install:

1. Open **Settings -> Models** and find Anthropic. Full quota details remain
   under **Settings -> Claude subscription**.
2. If not signed in, click **Browser sign-in** and authorize on claude.ai.
3. Pick a Claude model under the `anthropic` provider in the model picker.
4. Turn on **Composer quota** on the same page when you want it.

## Quota display

The model picker shows only models returned by the Anthropic Models API. The
**Subscription quota** card in **Settings -> Claude subscription** shows only
windows and labels returned by the Anthropic usage API. The host reads them,
and the access token never leaves the machine. Results are cached for 60
seconds, and **Refresh** reads them again immediately.

With **Composer quota** on, the input shows the tightest API window explicitly
marked as global or applicable to the current model. A window without API scope
metadata is not used for composer quota.

## Update and uninstall

```sh
dsh plugin --profile web update dsh-claude-subscription
dsh plugin --profile web remove dsh-claude-subscription
```

## Usage note

- Subscriptions are for the subscriber's own use; usage from this plugin
  counts against your subscription quota.
- Anthropic terms allow third-party access "at Anthropic's discretion" and
  reserve the right to charge such usage against usage credits instead of
  subscription limits. Follow [Anthropic's terms](https://support.claude.com/en/articles/13189465-log-in-to-your-claude-account).
- This plugin never extracts Claude Code's local OAuth token; sign-in always
  goes through browser authorization.

## License

MIT License