# dsh-deepseek-balance

A [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) plugin that shows your live DeepSeek API account balance as a frame-wide badge in the top-right corner of the web GUI.

English | [中文](README.zh.md)

## What it does

- Host half: registers `GET /dsh-deepseek-balance`, reads `DEEPSEEK_API_KEY` from the harness credentials seam (falling back to the environment variable), and returns `GET https://api.deepseek.com/user/balance`.
- Browser half: registers a pill into the `shell.overlay` seat, polls on a configurable interval (default 60s), and refreshes immediately when clicked.

The API key never reaches the browser; it is resolved in the host process per request.

## Install

```sh
dsh plugin --profile web add dsh-deepseek-balance
```

Then restart your `web` profile and refresh the page. The badge appears in the top-right corner:

- green dot — balance available
- amber dot — funds exhausted
- gray dot — loading
- red dot — request failed (hover for the reason)

**Click the pill** to refresh immediately (hover shows the granted/topped-up split).

## Configure

The key is the same one the harness already uses for the model. Set it once in **Settings → Models** (the credentials seam), or export it:

```sh
export DEEPSEEK_API_KEY=sk-...
```

Optional overrides in the bundle row (`config:`):

```yaml
config:
  refreshIntervalMs: 30000   # poll interval in ms (default 60000)
  baseUrl: 'https://api.deepseek.com'
```

## Build from source

```sh
pnpm install
pnpm build
```

`pnpm build` emits `lib/index.js` (host half) and `lib/client.js` (browser half).

## License

MIT
