---
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-TW/dsh.md
canonical: https://runapi.ai/zh-TW/dsh
locale: zh-TW
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-TW/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-TW/login)
- [瀏覽模型](https://runapi.ai/zh-TW/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-TW/.md)
### 產品
- [模型目錄](https://runapi.ai/zh-TW/models.md)
- [價格](https://runapi.ai/zh-TW/pricing.md)
- [提供商](https://runapi.ai/zh-TW/models#all-models)
### 開發者
- [文件](https://runapi.ai/zh-TW/docs/guides)
- [SDK](https://runapi.ai/zh-TW/sdk.md)
- [CLI](https://runapi.ai/zh-TW/cli.md)
- [MCP Server](https://runapi.ai/zh-TW/mcp.md)
- [x402](https://runapi.ai/zh-TW/x402.md)
### 指南
- [Claude Code 與 Cursor](https://runapi.ai/zh-TW/claude-code-vs-cursor.md)
- [Cursor API 設定](https://runapi.ai/zh-TW/cursor-api-setup.md)
- [RunAPI 與 OpenRouter](https://runapi.ai/zh-TW/openrouter-alternative.md)
### 公司
- [企業版](https://runapi.ai/zh-TW/contact.md)
- [聯絡我們](https://runapi.ai/zh-TW/contact.md)
### 法律
- [服務條款](https://runapi.ai/zh-TW/terms.md)
- [隱私權](https://runapi.ai/zh-TW/privacy.md)
- [Site index for agents](https://runapi.ai/llms.txt)

Contact: contact@runapi.ai

## Structured data

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-TW",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-TW",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/zh-TW/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-TW",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-TW",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/zh-TWicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-TW",
    "@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-TW/dsh"
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-TW",
    "@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-TW",
    "@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-TW",
    "@type": "BreadcrumbList",
    "itemListElement": [
      {
        "@type": "ListItem",
        "position": 1,
        "name": "首頁",
        "item": "https://runapi.ai/zh-TW"
      },
      {
        "@type": "ListItem",
        "position": 2,
        "name": "RunAPI for DeepSeek Harness",
        "item": "https://runapi.ai/zh-TW/dsh"
      }
    ]
  }
]
```
