dsh-provider-deepinfra: OpenAI-Compatible Inference via DeepInfra in DSH

Introduction

A common approach to integrating third-party models into DeepSeek Harness (DSH) involves manually writing provider configurations, maintaining your own model lists, or hardcoding context windows and capability tags within routing logic. Whenever a new model is released, configurations must be updated or you have to wait for a framework release. Furthermore, tool calling, reasoning tiers, and multimodal inputs often require separate adaptation logic for each.

The following introduces the community plugin deepinfra/dsh-provider-deepinfra (Maintainer: deepinfra; Category: Model Inference). It registers a deepinfra route within DSH, performs streaming conversations via DeepInfra’s OpenAI-compatible chat-completions API, and fetches available chat models from the online directory. It provides context length, vision, reasoning, and other capabilities to DSH’s compression and model selection logic.

About This Plugin

dsh-provider-deepinfra is a DeepInfra provider plugin designed for DeepSeek Harness. For source code and documentation, see GitHub: deepinfra/dsh-provider-deepinfra. Community directory page: skillhub.cn Plugin Entry.

The plugin adds a deepinfra route alongside existing routes without modifying built-in routes like llm-pi-ai, avoiding conflicts with your existing provider configurations. The DSH ecosystem emphasizes that “everything is a plugin”; skillhub.cn is a community directory site and has no official affiliation with DeepSeek or High-Flyer.

Key Features

Real-time Model Catalog

The model list is sourced from GET https://api.deepinfra.com/v1/openai/models. When DeepInfra adds new chat models, they appear in the selector without requiring a plugin upgrade (only chat-class models are listed). The catalog is cached for 10 minutes by default; if the fetch fails, the last successful result is used, or a built-in minimal list is used if no history exists, preventing an empty list on the routing side. Model IDs not present in the catalog (e.g., private deployments) can still be requested, but their context window will be marked as unknown rather than guessed.

Model Metadata and DSH Integration

Each model reports its own context window, image input support (vision), and reasoning-related tiers. Compression timing and the model selector rely on these fields, so manual configuration of window sizes in settings is generally unnecessary.

Tool Calling, Reasoning, and Images

Supports parallel tool calls and reasoning_content. This content is returned in subsequent turns to facilitate continuous reasoning for thinking models within tool loops. Vision models can accept image inputs. Images are sent inline as base64 data URLs, scaled to approximately 4 MP and 1 MiB per image; if the total image volume in a single request exceeds 20 MiB, DSH is prompted to offload older attachments.

Prompt Caching

The DSH session ID is sent as prompt_cache_key, allowing repeated multi-turn conversations to reuse cached prefixes.

Reasoning Tiers

Models tagged with reasoning_effort offer Off, Low, Medium, and High options; those tagged only with reasoning offer On/Off (mapped to none/high in the pipeline). Selection is transmitted via reasoning_effort; if unset, the model default is maintained. Some models (e.g., DeepSeek-V4.1-Flash) require explicit activation to enter thinking mode.

Errors and Retries

HTTP errors are mapped to DSH failure codes: 401 → INVALID_CREDENTIAL, 402 or quota-related messages → QUOTA, 429 → RATE_LIMIT (including Retry-After), context overflow 400 → CONTEXT_WINDOW_EXCEEDED, and 5xx → SERVER. Transient errors can be retried by dsh-llm-retry.

Installation and Setup

Environment requirements: Node ≥ 22.15, and a DeepInfra API token.

  1. Install the plugin (web profile):
dsh plugin --profile web add github:deepinfra/dsh-provider-deepinfra
  1. Configure the key (can also be saved via the Web Models page):
export DEEPINFRA_API_KEY=...
  1. Start the Web interface:
dsh web

If the API key is not configured, DeepInfra models will not appear in the selector because requests will fail.

The plugin runs with the permissions of the current dsh process. Before installation, it is recommended to review the repository source code and the MIT License to ensure that key and outbound request behaviors comply with your environment policies.

Typical Usage

Click to select a DeepInfra model in the model selector, or set a default model in the profile. The example path is $DSH_HOME/profiles/<profile>/cordis.patch.yml:

- id: agent-default-model
  config:
    provider: deepinfra
    model: deepseek-ai/DeepSeek-V4-Flash

Optional Configuration

Field Default Value Description
baseURL https://api.deepinfra.com/v1/openai Root path for the OpenAI-compatible API
apiKeyEnv DEEPINFRA_API_KEY Name of the environment variable for the key resolved via DSH credential service or environment variables

Example of customizing the key environment variable name:

- id: provider-deepinfra
  config:
    apiKeyEnv: MY_DEEPINFRA_TOKEN

Use Cases and Notes

This plugin is suitable for developers who are already using or planning to use DeepInfra for model hosting, while wishing to remain within the unified DSH session, tool, and Web workflows. It is more convenient than static configurations when coexisting with built-in llm-pi-ai or when requiring the model catalog to refresh automatically with DeepInfra updates.

Note: Only chat models appear in the catalog; reasoning and image capabilities depend on DeepInfra’s labeling of the models. For private or out-of-catalog models, you assume responsibility for compression behavior when the “window is unknown.” Do not commit keys to version control; prioritize using the DSH credential service or controlled environment variables.

Conclusion

dsh-provider-deepinfra connects DeepInfra’s real-time catalog, streaming completions, tool calling, reasoning, and image capabilities to the DSH deepinfra route, complete with prompt caching and unified error semantics. For documentation and issues, see the GitHub Repository. To browse the entry in the community directory, visit skillhub.cn/plugins/deepinfra/dsh-provider-deepinfra.

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

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

Xiaoye