---
title: 在 DeepSeek Harness 中使用 RunAPI — Custom model API 配置指南 | RunAPI
description: 在 DeepSeek Harness（dsh）中将 RunAPI 配置为基于 OpenAI Chat Completions 的 Custom model API，把密钥保存在 RUNAPI_API_KEY 中，并用 gpt-5.4-nano 发送第一条文本消息。
url: https://runapi.ai/zh-CN/dsh.md
canonical: https://runapi.ai/zh-CN/dsh
locale: zh-CN
site: RunAPI
image: https://runapi.ai/assets/opengraph-bfaaa0f0.png
alternates:
  en: https://runapi.ai/dsh
  zh-CN: https://runapi.ai/zh-CN/dsh
  es: https://runapi.ai/es/dsh
  ja: https://runapi.ai/ja/dsh
  de: https://runapi.ai/de/dsh
  fr: https://runapi.ai/fr/dsh
  pt-BR: https://runapi.ai/pt-BR/dsh
  ko: https://runapi.ai/ko/dsh
  it: https://runapi.ai/it/dsh
  nl: https://runapi.ai/nl/dsh
  pl: https://runapi.ai/pl/dsh
  tr: https://runapi.ai/tr/dsh
  zh-TW: https://runapi.ai/zh-TW/dsh
  zh-HK: https://runapi.ai/zh-HK/dsh
  ar: https://runapi.ai/ar/dsh
  x-default: https://runapi.ai/dsh
---

> HTML version: https://runapi.ai/zh-CN/dsh
> Site index for agents: https://runapi.ai/llms.txt


# 在 DeepSeek Harness 中使用 RunAPI。

在 dsh 中将 RunAPI 添加为 Custom model API，通过 OpenAI Chat Completions 连接 https://runapi.ai/v1，即可在网页界面或无界面运行模式下与 gpt-5.4-nano 对话。

- [获取 API 密钥](https://runapi.ai/zh-CN/login)
- [浏览模型](https://runapi.ai/zh-CN/models.md)

> 已使用 dsh 0.2.1-rc.2 对本地桩服务进行检查 · 未发起上游付费调用

## 一个模型，一次文本对话

- **目标** — 让 DeepSeek Harness 用户使用自己的基础 URL 和 API 密钥，通过 RunAPI 转发聊天请求，无需原生供应商插件。
- **最小可用配置** — 一个名为 runapi 的 Custom model API 供应商、一个 gpt-5.4-nano 模型，以及一条能收到回复的文本消息。
- **固定版本** — 配置和命令已使用 @deepseek-ai/dsh 0.2.1-rc.2 检查。在自行检查较新版本之前，请通过 npx 固定使用此版本。
- **无付费调用的检查范围** — dsh 的加载、请求格式、回复和错误消息均通过 RunAPI 端点的本地桩服务进行了检查。本页面未向上游供应商发起任何付费请求。

## runapi.patch.yml

```yaml
- id: llm-pi-ai
  config:
    providers:
      runapi:
        apiKeyEnv: RUNAPI_API_KEY
        api: openai-completions
        baseURL: https://runapi.ai/v1
        models:
          - id: gpt-5.4-nano
- id: agent-default-model
  config:
    provider: runapi
    model: gpt-5.4-nano
```

## 命令

```bash
export RUNAPI_API_KEY="runapi_xxx"
npx @deepseek-ai/dsh@0.2.1-rc.2 --version
npx @deepseek-ai/dsh@0.2.1-rc.2 headless --patch runapi.patch.yml "Reply with one short sentence."
npx @deepseek-ai/dsh@0.2.1-rc.2 web --patch runapi.patch.yml
```

## 三步将 dsh 连接到 RunAPI

1. **导出 RunAPI 密钥** — 在启动 dsh 的 shell 中设置 RUNAPI_API_KEY。补丁从环境变量中读取密钥，因此密钥不会写入文件。 `export RUNAPI_API_KEY="runapi_xxx"`
2. **添加 Custom model API** — 保存 runapi.patch.yml 供 --patch 使用，或在 Settings → Models → Add model provider → Custom model API 中添加配置。界面保存独立配置，API 密钥存入凭据存储；--patch 会让 Settings 中的这些字段只读。 `api: openai-completions`
3. **发送一条文本消息** — 使用补丁运行一次无界面任务，或打开网页界面。界面用户聊天前先在模型选择器中选择 runapi/gpt-5.4-nano。终端或聊天中出现回复，表示 dsh 已连接到 RunAPI。 `npx @deepseek-ai/dsh@0.2.1-rc.2 headless --patch runapi.patch.yml "Reply with one short sentence."`

## Custom model API 字段

| 字段 | 值 | 用途 |
| --- | --- | --- |
| 供应商 ID | `runapi` | 会话、默认设置和凭证引用使用的固定 ID。 |
| 基础 URL | `https://runapi.ai/v1` | 将请求发送到 RunAPI 的 OpenAI 兼容端点。 |
| API 协议 | `openai-completions` | RunAPI 在 /v1/chat/completions 提供的 OpenAI Chat Completions 协议。 |
| 凭证 | `RUNAPI_API_KEY` | 通过 apiKeyEnv 从环境变量读取，或通过 Models 页面保存。 |
| 模型 | `gpt-5.4-nano` | RunAPI 目录中的低成本同步文本模型。 |

## 使用 dsh 前先检查密钥和模型

此同步请求使用与补丁相同的基础 URL、密钥和模型，并将回复限制为 64 个 token。如果能返回消息，则 dsh 失败的原因在于 dsh 配置，而不是 RunAPI 账户。

```bash
curl https://runapi.ai/v1/chat/completions \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-5.4-nano", "max_tokens": 64, "messages": [{"role": "user", "content": "Reply with one short sentence."}]}'
```

## DeepSeek Harness 错误

### dsh 因 MISSING_CREDENTIAL 停止。缺少什么？

启动 dsh 的 shell 中未设置 RUNAPI_API_KEY。请导出该变量，或在 Models 页面保存密钥，然后重新运行同一条命令。
### dsh 报告 404 或连接错误。基础 URL 是否有误？

通常是。基础 URL 必须严格为 https://runapi.ai/v1；dsh 会自行追加 /chat/completions。连接错误则表示根本无法连接到主机。
### URL 正确，但 dsh 报告 404 Resource not found。应该检查什么？

请对照 RunAPI 模型目录核实模型 ID，例如 gpt-5.4-nano，并确认 agent-default-model 使用匹配的供应商 runapi 和模型 ID。
### 需要原生 RunAPI 供应商插件吗？

不需要。dsh 内置支持 OpenAI Chat Completions 的 Custom model API，而 RunAPI 提供该协议，因此文本对话只需此补丁即可。

## 官方来源

- [DeepSeek Harness model configuration](https://github.com/deepseek-ai/deepseek-harness/blob/master/docs/user/guide/providers.md#add-a-custom-model-api)
- [DeepSeek Harness README](https://github.com/deepseek-ai/deepseek-harness#run)

创建或登录 RunAPI 账户，创建 API 密钥，并在启动 dsh 前将其导出为 RUNAPI_API_KEY。


---

## More from RunAPI

- [Home](https://runapi.ai/zh-CN/.md)
### 产品
- [模型目录](https://runapi.ai/zh-CN/models.md)
- [定价](https://runapi.ai/zh-CN/pricing.md)
- [提供方](https://runapi.ai/zh-CN/models#all-models)
### 开发者
- [文档](https://runapi.ai/zh-CN/docs/guides)
- [SDK](https://runapi.ai/zh-CN/sdk.md)
- [CLI](https://runapi.ai/zh-CN/cli.md)
- [MCP Server](https://runapi.ai/zh-CN/mcp.md)
- [x402](https://runapi.ai/zh-CN/x402.md)
### 指南
- [Claude Code 与 Cursor](https://runapi.ai/zh-CN/claude-code-vs-cursor.md)
- [Cursor API 设置](https://runapi.ai/zh-CN/cursor-api-setup.md)
- [RunAPI 与 OpenRouter](https://runapi.ai/zh-CN/openrouter-alternative.md)
### 公司
- [企业版](https://runapi.ai/zh-CN/contact.md)
- [联系](https://runapi.ai/zh-CN/contact.md)
### 法律
- [服务条款](https://runapi.ai/zh-CN/terms.md)
- [隐私政策](https://runapi.ai/zh-CN/privacy.md)
- [Site index for agents](https://runapi.ai/llms.txt)

Contact: contact@runapi.ai

## Structured data

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-CN",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/zh-CN/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-CN",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/zh-CNicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "SoftwareApplication",
    "name": "RunAPI for DeepSeek Harness",
    "applicationCategory": "DeveloperApplication",
    "description": "在 DeepSeek Harness（dsh）中将 RunAPI 配置为基于 OpenAI Chat Completions 的 Custom model API，把密钥保存在 RUNAPI_API_KEY 中，并用 gpt-5.4-nano 发送第一条文本消息。",
    "url": "https://runapi.ai/zh-CN/dsh"
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "FAQPage",
    "mainEntity": [
      {
        "@type": "Question",
        "name": "dsh 因 MISSING_CREDENTIAL 停止。缺少什么？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "启动 dsh 的 shell 中未设置 RUNAPI_API_KEY。请导出该变量，或在 Models 页面保存密钥，然后重新运行同一条命令。"
        }
      },
      {
        "@type": "Question",
        "name": "dsh 报告 404 或连接错误。基础 URL 是否有误？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "通常是。基础 URL 必须严格为 https://runapi.ai/v1；dsh 会自行追加 /chat/completions。连接错误则表示根本无法连接到主机。"
        }
      },
      {
        "@type": "Question",
        "name": "URL 正确，但 dsh 报告 404 Resource not found。应该检查什么？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "请对照 RunAPI 模型目录核实模型 ID，例如 gpt-5.4-nano，并确认 agent-default-model 使用匹配的供应商 runapi 和模型 ID。"
        }
      },
      {
        "@type": "Question",
        "name": "需要原生 RunAPI 供应商插件吗？",
        "acceptedAnswer": {
          "@type": "Answer",
          "text": "不需要。dsh 内置支持 OpenAI Chat Completions 的 Custom model API，而 RunAPI 提供该协议，因此文本对话只需此补丁即可。"
        }
      }
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "HowTo",
    "step": [
      {
        "@type": "HowToStep",
        "position": 1,
        "name": "导出 RunAPI 密钥",
        "text": "在启动 dsh 的 shell 中设置 RUNAPI_API_KEY。补丁从环境变量中读取密钥，因此密钥不会写入文件。"
      },
      {
        "@type": "HowToStep",
        "position": 2,
        "name": "添加 Custom model API",
        "text": "保存 runapi.patch.yml 供 --patch 使用，或在 Settings → Models → Add model provider → Custom model API 中添加配置。界面保存独立配置，API 密钥存入凭据存储；--patch 会让 Settings 中的这些字段只读。"
      },
      {
        "@type": "HowToStep",
        "position": 3,
        "name": "发送一条文本消息",
        "text": "使用补丁运行一次无界面任务，或打开网页界面。界面用户聊天前先在模型选择器中选择 runapi/gpt-5.4-nano。终端或聊天中出现回复，表示 dsh 已连接到 RunAPI。"
      }
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "BreadcrumbList",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "name": "首页",
        "item": "https://runapi.ai/zh-CN"
      },
      {
        "@type": "ListItem",
        "position": 2,
        "name": "RunAPI for DeepSeek Harness",
        "item": "https://runapi.ai/zh-CN/dsh"
      }
    ]
  }
]
```
