dsh-mistral-relay: A Mistral-compatible relay provider for DeepSeek Harness

Introduction

The DeepSeek Harness (dsh) plugin ecosystem embraces a “everything is a plugin” philosophy. Developers can mount providers on demand to extend supported model sources. Relay providers are a common type of plugin: they don’t hold models directly but forward requests to third-party endpoints. This type of plugin often encounters a configuration issue with model IDs: the model names in the plugin’s built-in snapshot don’t match the live model list actually returned by the endpoint, resulting in a 400 Invalid model error at runtime. dsh-mistral-relay is a Mistral-compatible relay provider plugin that fixes this issue. It maps selections to the endpoint’s actual live model IDs and rewrites the settings UI, supporting real-time model catalog fetching and reading of public billing APIs.

What It Is

dsh-mistral-relay is a provider plugin for DeepSeek Harness that connects to Mistral-compatible endpoints. It is forked from dsh-mistral-pro, fixes the 400 error when the endpoint only recognizes its live model list, and rewrites the settings UI. The plugin maintainer is Niangaol, licensed under MIT.

Core Features

The plugin performs a mapping before each request: if the model ID exists in the live list, it’s used as-is; if it’s an alias, the alias’s target ID is used; otherwise, a built-in ID-to-live-ID lookup table serves as a fallback. resolveModelInfo also fetches facts by live ID, and capabilities like input: ["text","image"] are taken directly from the endpoint’s capabilities field.

The plugin supports the following capabilities:

  • Multi-account failover: attempts accounts in order; the first one that responds successfully handles the request; failed accounts enter a cooldown period
  • Real-time model catalog: fetched from the endpoint’s /v1/models, with support for search, per-model enable/disable, and overriding context/output limits/default thinking level
  • Real subscription quota: reads Mistral’s public billing API (a regular API Key suffices, no Admin API / Enterprise required):
  • GET /v1/billing/subscription → plan_name, etc.
  • GET /v1/billing/budget → vibe_budget / api_budget (initial_budget, usage_percentage, reset_at)
  • Both the settings page and the input-box pill display percentage, used/total amount, and reset countdown
  • Modern settings page: four sections for Accounts / Models / Quota / Advanced; styles derived from theme color (color-mix + currentColor), automatically follows light/dark themes, includes prefers-reduced-motion fallback
  • Thinking chain support: this type of endpoint often places thinking content in an array within delta.content ([{"type":"thinking","thinking":[{"type":"text","text":"…"}]}]); the plugin splits by part and renders thinking correctly without showing [object Object]
  • Zero runtime dependencies: pure ESM, uses only Node built-in modules and host services

Installation & Activation

Install from local:

dsh plugin --profile desktop add /path/to/dsh-mistral-relay

Install from repository:

dsh plugin --profile desktop add github:Niangaol/dsh-mistral-relay

After installation, point the default model to it in the profile’s cordis.patch.yml:

- id: agent-default-model
  config:
    provider: mistral-relay
    model: deepseek-v4-1-flash-1017

Configuration

The plugin’s bundle patch inserts a mistral-relay entry; parameters are overridden in the profile’s cordis.patch.yml (the patch replaces config entirely, so keys you want to keep must be repeated):

- id: mistral-relay
  name: dsh-mistral-relay
  config:
    baseURL: https://api.mistral.ai/v1   # endpoint root
    accounts:
      - name: default
        apiKeyEnv: MISTRAL_API_KEY       # reference name in the credential service
        baseURL: ""                      # leave empty to use the baseURL above
        enabled: true
    usage:
      display: auto                      # auto | always | off
      refreshSeconds: 60
      adminCookieEnv: MISTRAL_ADMIN_COOKIE   # only needed for extra quota on admin site
      showCredits: true
    advanced:
      modelsRefreshMinutes: 30
      cooldownSeconds: 60
      maxTokensCap: 0                    # 0 = don't inject output limit
      requestTimeoutMs: 600000
      streamIdleTimeoutMs: 300000
      failover: true
      promptCacheKey: auto
    models:                              # per-model overrides
      mistral-large-4:
        visible: false
      deepseek-v4-1-flash-1017:
        contextWindow: 1000000
        maxTokens: 128000

Compatibility with billion-context

bili’s strict-echo appends an empty string reasoning_content to every assistant message containing tool_calls when the request body’s model name includes deepseek. This type of relay will reject the field with 422 extra_forbidden, causing the entire turn to fail.

The plugin’s bundle patch uses a conditional expression to disable bili-native (while retaining bili-compaction-gate—bili’s own documentation requires it to be always present, and disabling it would cause a missing service that the preset depends on). Profiles without bili installed are unaffected.

Because bundle patches are applied in the order of dsh.profile.bundles, this plugin must be placed last in that list (at minimum after billion-context); otherwise, when the disable entry executes, bili-native hasn’t been inserted yet, rendering the entry ineffective:

// ~/.dsh/profiles/<profile>/package.json
"dsh": { "profile": { "bundles": [ "...", "billion-context", "dsh-mistral-relay" ] } }

If you need to keep bili’s strict-echo, simply remove the last two lines from cordis.patch.yml.

Images in Tool Results

Tools like read_image and screenshot utilities place images in tool results. In the OpenAI-compatible wire format, tool messages can only carry text; images must be attached to the subsequent user message. Otherwise, the model only sees text and will honestly respond with “I can’t see the image.” The adapter now converts image blocks in tool results into data URIs and appends them as a following user message (Images attached to the tool result above:).

Known Limitations

  • This type of endpoint typically only accepts reasoning_effort, not thinking / reasoning / enable_thinking (results in 422 extra_forbidden); the thinking level may not include medium. Selecting an unsupported level will result in a 400 from the endpoint.
  • The billing API requires the Key to have the see_org_inference_usage permission; without it, the plan is still readable but quota will fall back to empty.
  • Extra quota on the admin site (admin.mistral.ai) requires a browser Cookie, which is not available on all accounts.

Use Cases

Ideal for developers who need to invoke models through Mistral-compatible endpoints and want access to real subscription quotas, a real-time model catalog, and multi-account failover. The plugin runs with the current dsh process permissions; review the source code and license before installation.

Conclusion

dsh-mistral-relay addresses the common model ID mapping issue in relay providers, providing practical features such as a real-time model catalog, real subscription quotas, and a modern settings page. The plugin maintainer is Niangaol, licensed under MIT. Directory page and GitHub repository below:
- https://www.skillhub.cn/plugins/Niangaol/dsh-mistral-relay
- https://github.com/Niangaol/dsh-mistral-relay

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

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

Xiaoye