# DeepSeek Harness plugin

The Liquid Inference plugin for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (`dsh`) adds the exchange to the harness. It adds a `liquid` model route and four read-only market tools. The source is [architect-xyz/liquid-dsh-plugin](https://github.com/architect-xyz/liquid-dsh-plugin).

To use the exchange without the plugin, see [DeepSeek Harness](https://inference.ai.exchange/docs/connect-deepseek-harness.md). That guide writes a patch file by hand. The [Liquid CLI](https://inference.ai.exchange/docs/cli.md) can also start `dsh` for you.

## Before you start

- A workspace with a balance and a `spend` key. See [API keys](https://inference.ai.exchange/docs/keys.md).
- DeepSeek Harness with a profile, for example `web`.

The package is not on npm yet. Install it from GitHub or from a packed tarball.

## 1. Export the buyer key

```bash
export LIQUID_API_KEY=sk-liquid-...
```

The plugin reads the key for each request. It reads the credential store of the profile first, and then `LIQUID_API_KEY`. It never writes the key to a config file. A headless profile has no credential store, so it needs the variable.

## 2. Install the plugin

Install from GitHub. The package builds itself when you install it:

```bash
dsh plugin --profile web add github:architect-xyz/liquid-dsh-plugin
```

The first run fails with `ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED`, because pnpm blocks the build script. To fix it, add the package to `allowBuilds` in `$DSH_HOME/profiles/web/pnpm-workspace.yaml`, then run the command again:

```yaml
allowBuilds:
  dsh-liquid-inference: true
```

This setting lets the package run its build script on your computer, outside a sandbox. Pin a commit, for example `github:architect-xyz/liquid-dsh-plugin#<sha>`, so a later push cannot change what runs.

### Install without a build permission

Pack the plugin and install the tarball:

```bash
git clone https://github.com/architect-xyz/liquid-dsh-plugin.git
cd liquid-dsh-plugin && pnpm install && pnpm pack
dsh plugin --profile web add ./dsh-liquid-inference-0.1.0.tgz
```

Restart the profile. Choose **Liquid Auto** (`liquid.auto`) in the model picker.

## What the plugin adds

### The `liquid` model route

The plugin needs no adapter code. It patches the stock `llm-pi-ai` adapter with `api: openai-completions`, the exchange base URL with `/v1`, and `apiKeyEnv: LIQUID_API_KEY`. The patch sets these values:

| Setting   | Value                                                                                                             |
| --------- | ----------------------------------------------------------------------------------------------------------------- |
| Cap       | Each request sends `x-liquid-cap-usd`. The default is 1 USD. Set `LIQUID_CAP_USD` before you start to change it.  |
| Models    | `liquid.auto`, the ranking variants `:cheapest`, `:economy`, `:balanced` and `:premium`, and `deepseek-v4-flash`. |
| Reasoning | The levels `low`, `medium` and `high` go to the exchange as `reasoning_effort`.                                   |

To add a model, add an entry under `models` in the `cordis.patch.yml` of your profile. Use a name from the **Market** page. See [Market data](https://inference.ai.exchange/docs/market.md).

The exchange does not check the reasoning level. If the winning provider refuses the level, that request fails.

### Market tools

| Tool                 | Endpoint                   | Key      |
| -------------------- | -------------------------- | -------- |
| `liquid_get_book`    | `GET /v1/exchange/offers`  | Not used |
| `liquid_get_markets` | `GET /v1/exchange/markets` | Not used |
| `liquid_get_routers` | `GET /v1/exchange/routers` | Not used |
| `liquid_get_job`     | `GET /v1/jobs/{id}`        | Used     |

Chat, image, speech and video purchases are not tools. The model route is the only place where the harness spends money.

## Data handling

The harness sends full prompts and tool results to the exchange. The exchange sends them to the provider that wins the auction. See [Data handling](https://inference.ai.exchange/docs/data-handling.md).

## Notes

- The patch replaces the whole `config` of the `llm-pi-ai` row. If another bundle also configures pi-ai providers, write their settings again in your `cordis.patch.yml`.
- The cap limits each request. To limit the total spend, set a spending limit on the key. See [API keys](https://inference.ai.exchange/docs/keys.md).

## Next steps

- [DeepSeek Harness](https://inference.ai.exchange/docs/connect-deepseek-harness.md): set up the harness by hand, with no plugin.
- [Apps](https://inference.ai.exchange/docs/apps.md): the other plugins and tools.
- [Skills](https://inference.ai.exchange/docs/skills.md): teach a coding agent to use the exchange.
