# 在 DeepSeek Harness 里使用 AnyRouter

> DeepSeek Harness 是 DeepSeek 的开源智能体应用，目前是预览版。把 AnyRouter 添加为自定义模型 API，只需一个 Base URL 和一把 key，再按任务挑选 anyrouter/* 路由模型。

- Date: November 2, 2026
- Category: guides
- HTML: https://anyrouter.dev/blog/zh/deepseek-harness-anyrouter

## DeepSeek Harness 是什么

DeepSeek Harness（`dsh`）是 DeepSeek 开源的智能体 harness，采用 MIT 许可证。产品页说它可以用来做日常任务、写代码，或者搭建你自己的 harness。它的每个部分都是插件，你也可以让智能体帮你写新插件。

它有 macOS（Apple 芯片）和 Windows（64 位）桌面版，也可以用 `npx @deepseek-ai/dsh web` 启动 Web UI。Harness 目前是预览版。DeepSeek 说核心插件和 API 仍在变化，README 也提醒会有不兼容的改动。

![DeepSeek Harness 首页，标题为 Into the Unknown，带 Preview 标记。侧栏有 New Session、Plugins、Automation tasks 和 Workspaces。输入框显示 Default workspace、Standard mode、Workspace Write 权限选择和 Select model 下拉框。](https://cdn.anyrouter.dev/screenshots/deepseek-harness-home-2026-11.webp)

_Harness 首页。先选工作区、模式和权限，再选模型。_

应用里能看到工作区、会话、插件、自动化任务和智能体预设。会话用的模型在输入框的 Select model 下拉框里选。

## 把 AnyRouter 添加为自定义模型 API

Harness 把内置提供商放在 Third-party model provider 下。其他端点放在 Custom model API 下，它接受兼容 OpenAI 和兼容 Anthropic 的端点，AnyRouter 就是其中之一。

1. 在 anyrouter.dev/keys 创建一把 AnyRouter API key，以 `sk-ar-` 开头。
2. 在 Harness 里打开 Settings，进入 Models，选择 Add model provider，切换到 Custom model API 标签。
3. Provider ID 填 `anyrouter`。Harness 会在请求、已保存的会话和凭据名里使用这个 id，之后不能改名。
4. Base URL 填 `https://anyrouter.dev/api/v1`，API protocol 选 OpenAI Chat Completions。
5. 把 `sk-ar-` key 粘贴到 API key。
6. 选择 Fetch available models，勾选需要的 `anyrouter/*` 模型，然后保存。

![DeepSeek Harness 的 Settings、Models、Custom model API 标签。Provider ID 为 anyrouter，Base URL 为 https://anyrouter.dev/api/v1，API protocol 为 OpenAI Chat Completions，API key 已遮盖。模型列表有 anyrouter/byok、anyrouter/coding、anyrouter/agent 和 anyrouter/hermes。](https://cdn.anyrouter.dev/screenshots/deepseek-harness-custom-model-api-2026-11.webp)

_填好的自定义模型 API 表单。key 已遮盖，模型列表来自 Fetch available models。_

Harness 说模型发现只是便利功能，不保证一定成功。如果 Fetch available models 什么都没列出，手动输入模型 id 即可，效果一样。

Harness 把 key 存在 `$DSH_HOME/.credentials.yaml`，其余设置写进配置的 `cordis.patch.yml`。在 Settings 顶部选择 Open configuration file 可以直接编辑。下面是同一个提供商，从环境变量 `ANYROUTER_API_KEY` 读取 key：

```yaml
- id: llm-pi-ai
  config:
    providers:
      anyrouter:
        apiKeyEnv: ANYROUTER_API_KEY
        api: openai-completions
        baseURL: https://anyrouter.dev/api/v1
        models:
          - id: anyrouter/coding
          - id: anyrouter/agent
          - id: anyrouter/hermes
          - id: anyrouter/auto
```

Harness 应用覆盖配置时会替换整个条目配置。编辑这段时，保留你的其他提供商。

## 也可以用 Anthropic Messages

API protocol 有三个选项：OpenAI Chat Completions、OpenAI Responses 和 Anthropic Messages。一个 Harness 提供商只用一种协议。想用 Anthropic Messages，就再加一个提供商，比如 `anyrouter-messages`，协议选 Anthropic Messages，Base URL 填 `https://anyrouter.dev/api`。

这个 Base URL 不要带 `/v1`。Anthropic 客户端会自己加上 `/v1/messages`，AnyRouter 的 Messages 端点是 `https://anyrouter.dev/api/v1/messages`。同一把 `sk-ar-` key 两种协议都能用。Chat Completions 更简单，建议先用它。

## 该选哪个 anyrouter/* 模型

在这个配置里，Fetch available models 拉取了全部 AnyRouter 路由模型。`anyrouter/byok`、`anyrouter/coding` 和 `anyrouter/agent` 要在账号于 anyrouter.dev/byok 添加了提供商 key 之后才会出现。每个都是一条路由规则，而不是单个模型。AnyRouter 每次请求挑选一个真实模型，上游失败时自动切到下一个。

![DeepSeek Harness 模型选择器在 anyrouter 提供商下展开，列出 AnyRouter BYOK、Coding、Agent、Hermes、Cowork、Free、Auto（已勾选）、Decision 和 Latest。输入框显示 Full access 和 AnyRouter Auto。底部显示 1 turns 7 steps、198 tok/s、146K tok、Cache hit 69%。](https://cdn.anyrouter.dev/screenshots/deepseek-harness-model-picker-2026-11.webp)

_拉取后的 Harness 模型选择器。这个会话用的是 AnyRouter Auto。_

| 模型 | 路由范围 | 计费方 |
| --- | --- | --- |
| `anyrouter/coding` | 你自己的 key 能用的工具调用模型，编程能力强的优先 | 你的提供商 |
| `anyrouter/agent` | 你自己的 key 能用的工具调用模型，最好的优先 | 你的提供商 |
| `anyrouter/byok` | 你自己的 key 能用的所有模型，不筛选工具调用 | 你的提供商 |
| `anyrouter/hermes` | 顶尖工具调用模型，每个上游提供商一个 | AnyRouter 额度 |
| `anyrouter/cowork` | 适合助手工作的工具调用模型，支持视觉，每个提供商一个 | AnyRouter 额度 |
| `anyrouter/auto` | 使用量高且稳定的模型，免费和付费混合，按健康度路由 | 按每跳价格，免费跳为 $0 |
| `anyrouter/latest` | 正在服务流量的最新稳定聊天模型 | 按每跳价格 |
| `anyrouter/free` | AnyRouter 以 $0 提供的模型 | 不计费 |

编程会话里，有自己的提供商 key 就选 `anyrouter/coding`，没有就选 `anyrouter/hermes`。Harness 智能体几乎每一步都调用工具，这两个只路由到支持工具的模型。

`anyrouter/auto` 适合作为通用默认。Harness 的智能体步骤会带上工具。请求带有工具时，AnyRouter 只把它路由到支持工具的模型。想要针对编程或工具调用的排序，就选 `anyrouter/coding` 或 `anyrouter/hermes`。

不要选 `anyrouter/decision`。它用于 Decisions API（`/api/v1/decisions`），返回是或否、选项和分数这类结构化答案，不是给智能体循环用的聊天模型。

底部的数字是单个会话的。上图这个会话里，Harness 显示 1 轮、7 步、198 tok/s、146K token、69% 缓存命中。这只是一个会话，不是基准测试。

## 用 BYOK 跑在你自己的 key 上

`anyrouter/byok`、`anyrouter/coding` 和 `anyrouter/agent` 只在你自己的提供商 key 之间路由。由你的提供商计费，AnyRouter 不会为这些请求扣额度。在 anyrouter.dev/byok 添加一次 key，这些模型马上就能用上。

没有保存任何提供商 key 时，这三个模型不会列出，也无处可路由。添加 key 之前，先用 `anyrouter/hermes` 或 `anyrouter/auto`。

添加一次提供商 key，就能在 Harness 里使用。

[添加 key](https://anyrouter.dev/byok)

## 获取 key，选择套餐

在 anyrouter.dev 注册，然后在 anyrouter.dev/keys 创建 key。Free 套餐包含免费模型和决策模型的 5 次试用请求、用购买额度调用付费模型，以及照常使用你自己的 BYOK key。Go 套餐每月 $2，捐赠一把有效、唯一且共享池可用的提供商 key 也能免费获得。它开放所有模型，每月附带 $4 额度。

Harness 发出的每个请求都会出现在你的 AnyRouter 请求日志里。

带同样截图的分步配置。

[打开使用场景](https://anyrouter.dev/use-cases/deepseek-harness)
