dsh-import-newapi: Import New API Connection into DeepSeek Harness

In the development workflow of DeepSeek Harness (DSH), configuring third-party providers (such as New API) typically requires manually editing configuration and credential files. This is error-prone and tedious. The dsh-import-newapi plugin solves this problem by allowing developers to extract connection data directly from JSON information copied from New API and adapt it into the @deepseek-ai/dsh-llm-pi-ai adapter, while managing keys automatically.

Plugin Overview

Maintained by Deanyu148, this plugin falls under the networking tools category. Its core function is to write the New API site address and key into DSH’s cordis.patch.yml, and write the key reference into .credentials.yaml, achieving one-click import of provider configurations.

Installation and Activation

Install using the DSH CLI:

dsh plugin --profile desktop add dsh-import-newapi

After installation, refresh the page. A “New API Import” option will appear under “Models” in the DSH settings panel.

Usage Workflow

  1. Connection Info
    Paste the JSON information copied from New API into the input box (e.g., {"_type":"newapi_channel_conn","key":"sk-…","url":"https://…"}). Upon successful recognition, the plugin automatically fills in the site address and key, though manual entry is also fully supported.

  2. Provider Configuration
    Fill in the Provider ID, Display Name, and Protocol. The plugin automatically derives the baseURL based on the site address and protocol:

    • OpenAI Chat Completions / OpenAI Responses: Automatically appends /v1
    • Anthropic Messages: Does not append /v1 (handled by the SDK)
    • The baseURL can also be manually modified.
  3. Model Management
    Click “Get Model List”, use the search bar to filter models, and select them individually. For each model, you can set:

    • Name: The display name for the model. If left blank or identical to the ID, it will not be written to the configuration.
    • Capacity: Supports notations like 256K or 1.05M (1K=1000). If left blank, it will not be written.
    • Input Format: Check for text or image support.
    • Thinking Intensity: Sets reasoningEfforts. Offers six levels, with customizable keys and values.
  4. Import
    Click “Import”. The plugin writes the provider information to cordis.patch.yml and the key to .credentials.yaml. Before importing, you can expand the preview box to review the data that will be written.

Rules and Limitations

  • Provider ID Rules: Must start with a lowercase letter and contain only lowercase letters, numbers, and hyphens. Hyphens cannot be at the start, end, or consecutive. Import is rejected for existing IDs; the plugin only adds and does not overwrite.
  • Key Naming Convention: The key reference name is derived from the Provider ID. The format is ALL CAPS, hyphens replaced with underscores, and a _API_KEY suffix. For example, example-api → EXAMPLE_API_API_KEY.
  • Environment Variable Handling: If the key is already provided by an environment variable (writable: false), writing to .credentials.yaml will be skipped during import.
  • Dependency Requirements: The plugin requires Node.js version ^22.19.0 || >=24.0.0, and depends on @deepseek-ai/cordis (^4.0.2) and React (^18.3.1).

Summary

This plugin standardizes the tedious configuration process for New API, making it suitable for developers who need to frequently connect to or manage multiple New API sites. It replaces manual YAML file editing with a graphical interface operation while retaining strict format validation.

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

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

Xiaoye