dsh-nan-provider: Configure NaN in DSH and View Subscription Usage

Preface

When integrating external model routers like nan.builders into DeepSeek Harness (DSH), the common practice is to manually edit cordis.patch.yml, remember the API Key yourself, and check quotas on the webpage. Configurations easily become out of sync when switching between the TUI and Desktop entries; you also have to open a separate page to check usage.

The community plugin dsh-nan-provider (maintainer javipm) integrates “creating a nan provider, saving the key, pulling the model directory, and setting the default model” and “viewing periodic quotas and recent consumption in the interface” into a single workflow. The design references pi-nan-provider. It is published on npm as dsh-nan-provider, is MIT licensed, and requires DSH >=0.2.0-rc.2 (see engines.dsh in package.json). Categorically, it is a client-side plugin (TUI sidebar/footer, Desktop settings page, input area chips).

The DeepSeek Harness ecosystem expands on the principle of “everything is a plugin”; the SkillHub Directory is a community收录 site with no official affiliation with DeepSeek / Hypersphere. It is recommended to check the GitHub source code and license before installing—the plugin runs under the current DSH process permissions.

What is this

dsh-nan-provider is aimed at developers who have a subscribed NaN (nan.builders) account and work in both dsh-tui and DeepSeek Harness Desktop: use /nan-setup once to configure the provider and default model, and use the sidebar, footer, or Desktop chips to display the quota and the last 30 days of usage returned by GET {baseURL}/usage; the browser side does not touch the API Key, but uses the host loopback route /api/nan-provider/usage.

Core Features

/nan-setup: Provider and Directory

Executing /nan-setup creates or refreshes the provider with id nan: it prompts interactively and writes credentials to the credential store if the key is missing; it downloads the directory from {baseURL}/models and merges it with the existing directory—new chat-type models are stored with conservative defaults, while types like embedding, rerank, voice, and image are filtered; the default model is set to deepseek-v4-flash. Implementation-wise, it writes via DSH’s settings service (similar to /provider), does not delete existing openai configurations, and does not require manual YAML editing. After completion, it writes the shared state to ~/.dsh/nan-provider.json.

Usage Display: TUI and Desktop

TUI (dsh-tui)

  • Sidebar adds a new NaN usage tab (icon ◈, alongside Info / Todo / Jobs): periodic quota bar, remaining days, last 30 days model ranking, daily sparkline, and historical total.
  • /nan-usage opens the tab; /nan-usage text outputs a text report in the chat.
  • Status line footer chip (example format NaN 6,195 cr · 14d), hover to see details; config option footer: false can disable it.

Desktop

  • Permanent chip above the input area (refreshes approx every 5 minutes, click to refresh); the Settings page has a complete usage card.
  • /nan-usage returns a text report (no TUI-style sidebar and footer chip—determined by the seams of the host UI).

NaN will not appear in the host’s “External Model Providers” dropdown; this is intentional by the plugin: /nan-setup writes a complete providers.nan with a validated directory and compat, avoiding duplication with the assistant’s temporary discovery of /v1/models paths and less information.

Cross-configuration Sync

  • Keys: NAN_API_KEY in ~/.dsh/.credentials.yaml (can also be environment variable NAN_API_KEY); does not overwrite OPENAI_API_KEY etc.
  • Provider and Models: ~/.dsh/nan-provider.json; on Desktop, sync happens within ~3 seconds of the next startup, logs may show NaN provider synced, and a record is left in ~/.dsh/profiles/desktop/cordis.patch.yml. If Desktop is open while running /nan-setup, it needs to be restarted once.

Installation and Enablement

TUI

Add the plugin to the dsh-tui profile configuration in the shell:

dsh plugin --profile dsh-tui add dsh-nan-provider

Or execute inside TUI:

/plugin install dsh-nan-provider

Desktop

  1. Open Settings → Plugins → Add plugin.
  2. Enter dsh-nan-provider and confirm.
  3. Restart the application after installation finishes.

The desktop configuration is exclusively managed by the Electron app; dsh plugin --profile desktop will prompt that it can only be installed from within the app, do not rely on CLI to install plugins for desktop.

When you need the latest package version, you can check first:

npm view dsh-nan-provider version

If you pull an old version shortly after a new release, you can explicitly specify:

dsh plugin --profile dsh-tui add dsh-nan-provider@latest

Typical Usage

The installation order doesn’t matter (TUI, Desktop, or both). As long as you execute /nan-setup once in either entry, you can open the other entry.

  1. Execute /nan-setup in TUI or Desktop, provide the NaN API Key as prompted (if not yet saved).
  2. TUI: Use /nan-usage to open the ◈ panel, or /nan-usage text to get a report in the chat.
  3. Desktop: After restart, nan-provider.json is automatically applied; check usage in the settings page or the input area chip; /nan-usage outputs text.

Usage queries use GET {baseURL}/usage (OpenAPI see https://nan.builders/openapi.json), do not consume NaN quotas. If nan routing is not configured, /nan-usage will prompt to run /nan-setup first and will not fall back to a raw key or arbitrary URL.

Optional Configuration

In the nan section of ~/.dsh/profiles/dsh-tui/cordis.patch.yml, you can modify (all optional):

Key Default Description
provider nan Provider id for detection and configuration
apiKeyEnv NAN_API_KEY Credential reference used by /nan-setup
baseUrl https://api.nan.builders/v1 Base URL used by /nan-setup
windowDays 30 Usage statistics window (1-90)
autoRefreshSeconds 60 Auto-refresh when panel is open (0 to disable)
lowCreditsPercent 10 Low credit warning/error threshold
commandName usage Usage command name
panelId usage Internal panel id
panelTitle NaN usage Sidebar tab title
footer true Whether to show footer chip
footerRefreshMinutes 15 Footer chip refresh interval
cacheSeconds 20 Shared cache for panel and command
setupModel deepseek-v4-flash Default model set by /nan-setup
setupEffort max Effort level set by /nan-setup

Scenarios and Notes

Who is it for: Developers who already have a NaN subscription and want to share a set of nan providers between DSH TUI and Desktop, and monitor quotas and recent model consumption directly in the workspace rather than repeatedly opening a browser in the background.

Environment and Dependencies: Pure ESM, fetch implementation, no native bindings; default config directory ~/.dsh (Windows is %USERPROFILE%\.dsh), TUI state is in ~/.dsh-tui. package.json requires Node ^22.19 || >=24.

Resetting Configuration: The repository provides scripts/reset.sh / scripts/reset.ps1 (can first --dry-run / -DryRun), which backs up and clears credentials, nan-provider.json, cordis.patch.yml for each profile, and some TUI preferences, does not delete sessions and attachments; paths respect DSH_HOME, DSH_TUI_HOME. After resetting, the plugin needs to be reinstalled in each profile and /nan-setup run again.

Security and Trust: Keys are parsed by the harness credential store, and the plugin README states it does not expose the Key to the Web client; it is still recommended to read the source code and the NOTICE under the MIT license (including acknowledgments to pi-nan-provider) before installing.

Conclusion

Following the steps above, you can align the NaN provider and default model with a single /nan-setup in DSH, check subscription usage in the TUI sidebar, footer, or Desktop chip, and keep them synced between the two entries via nan-provider.json and NAN_API_KEY.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye