backrooms-yrc/dsh-openai-gateway

Expose DeepSeek Harness (dsh) as an OpenAI-compatible API server — /v1/chat/completions + /v1/models, backed by real agent sessions with tools and workspaces. 把 DeepSeek Harness 暴露为 OpenAI 兼容 API 服务端。

Project Overview项目介绍

dsh-openai-gateway is a DSH-native plugin that exposes DeepSeek Harness (dsh) as an OpenAI-compatible HTTP API. It is installed with dsh plugin --profile web add github:backrooms-yrc/dsh-openai-gateway#v0.1.1 and runs inside the dsh web process, but it spins up its own independent listener (default 127.0.0.1:41540) so that pure Bearer-token clients can reach the agent without being trapped behind the browser-session login gate that plugins such as @xgone/dsh-remote install. Endpoints include POST /v1/chat/completions (streaming and non-streaming), GET /v1/models, GET /v1/models/:id, and GET /healthz; non-standard response fields dsh_session_id and dsh_tool_calls are additive and do not break standard OpenAI clients.

The intended workflow is: install the plugin, restart dsh web (e.g. dsh web --host 127.0.0.1 --port 41539 --no-open), read the actual port from $DSH_HOME/openai-gateway/state.json and the auto-generated bearer key from api-keys.json, and then point any OpenAI SDK — Raycast, IDE plug-ins, Python or Node scripts — at http://127.0.0.1:<port>/v1. Sessions are stateless by default (all messages concatenated into one prompt), but X-DSH-Session: new or the dsh_session body field upgrades the call to a sticky session that survives across requests with continuous workspace and context, automatically resuming after dsh restarts.

It targets developers who want standard OpenAI tooling to drive a real dsh agent with tools and workspace. The plugin depends on @deepseek-ai/dsh-agent, dsh-llm, dsh-session, dsh-home-paths, and schemastery; link installs do not fetch peer dependencies and require manual symlinks into dsh's internal copies, and there is no build step — pure JavaScript. Known v0.1 limits: tool_calls are surfaced only as counts plus SSE comment frames, request-side tools/tool_choice are ignored, there is no per-key quota or rate limiting, maxSessions defaults to 16 with LRU eviction, timeoutSeconds defaults to 300 seconds, and the release is tested only against dsh 0.1.1-rc.2 with no compatibility promise; license is MIT.

dsh-openai-gateway 是一个面向 DeepSeek Harness(dsh)的原生插件,作用是把 dsh 暴露为兼容 OpenAI 的 HTTP API 服务。它由 dsh plugin --profile web add github:backrooms-yrc/dsh-openai-gateway#v0.1.1 安装并在 dsh web 进程内加载,额外自建独立 HTTP 监听(默认 127.0.0.1:41540),自管 Bearer 鉴权,避免与 @xgone/dsh-remote 这类登录门插件的浏览器会话冲突,提供 POST /v1/chat/completions(流式与非流式)、GET /v1/models、GET /healthz 等端点。

典型流程是:安装后用 dsh web --host 127.0.0.1 --port 41539 --no-open 重启,从 $DSH_HOME/openai-gateway/state.json 取端口、从 api-keys.json 取 key,再用任意 OpenAI SDK 把 base_url 指向本机端口即可驱动 dsh 的真实 Agent 会话(默认 stateless;可通过 X-DSH-Session 启用粘性会话并复用工作区)。面向需要让 Raycast、IDE 插件、脚本等标准 OpenAI 客户端复用 dsh 工具与工作区的开发者。

依赖 @deepseek-ai/dsh-agent、dsh-llm、dsh-session、dsh-home-paths、schemastery(link 模式需自行符号链接 dsh CLI 内部副本),纯 JS 无构建步骤;首次启动端口被占会记 FATAL 日志,端口冲突需改 cordis.patch.yml 后重启。v0.1 已知限制:tool_calls 不投影为 OpenAI 帧、无每 key 配额与限速、被逐出 maxSessions(默认 16,LRU)簿记的旧 Agent 由 dsh 注册表回收,单轮超时 timeoutSeconds 默认 300s;许可证 MIT,仅针对 dsh 0.1.1-rc.2 测试。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:backrooms-yrc/dsh-openai-gateway#v0.1.1

把 backrooms-yrc/dsh-openai-gateway 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-openai-gateway

Expose DeepSeek Harness (dsh) as an OpenAI-compatible API server — POST /v1/chat/completions (stream + non-stream) and GET /v1/models. Every API call is backed by a real agent session with tools and a workspace, so any OpenAI client (SDK, Raycast, scripts, IDE plugins…) can drive your agent by just filling in a base URL and an API key.

把 DeepSeek Harness 暴露为 OpenAI 兼容 API 服务端:每次 API 调用背后是带工具、带工作区的真实 Agent 会话。

Version dsh License

工作原理

OpenAI 客户端 ──(可选: 反向代理 /v1)──▶ 插件独立 HTTP 监听 ──▶ dsh Agent 会话
                                        (自带 Bearer 鉴权)      (模型+工具+工作区)

dsh 共享 Web 服务器的路由会被登录门插件(如 @xgone/dsh-remote)整体包装,纯 Bearer 的 API 客户端拿不到浏览器会话。因此本插件自建独立监听、鉴权完全自理——API 流量与 Web UI 的登录门互不干扰,可分别暴露。

安装(完整流程)

1. 安装插件

dsh plugin --profile web add github:backrooms-yrc/dsh-openai-gateway#v0.1.1

2. 重启 dsh web

首次新增包需要重启一次:

# 先停掉正在运行的 dsh web,再以你的原参数启动,例如:
dsh web --host 127.0.0.1 --port 41539 --no-open

3. 找到你的端口和 API key

端口:默认 127.0.0.1:41540(这只是本插件的默认值,与 dsh 本身的端口无关,完全可以改)。权威查询方式——监听成功后插件会把实际地址写进状态文件,port: 0(随机端口)场景同样适用:

cat $DSH_HOME/openai-gateway/state.json
# {"host": "127.0.0.1", "port": 41540, "pid": 12345, "startedAt": "..."}

API key:未配置时首次启动自动生成一个,0600 权限落盘:

cat $DSH_HOME/openai-gateway/api-keys.json
# {"keys": ["sk-dsh-..."]}

自检:

curl http://127.0.0.1:41540/healthz
# {"ok":true,"service":"dsh-openai-gateway"}

4. 发起第一次调用

KEY=$(python3 -c "import json;print(json.load(open('$HOME/.dsh/openai-gateway/api-keys.json'))['keys'][0])")
PORT=$(python3 -c "import json;print(json.load(open('$HOME/.dsh/openai-gateway/state.json'))['port'])")

curl http://127.0.0.1:$PORT/v1/chat/completions \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"model":"default","messages":[{"role":"user","content":"你好"}]}'

DSH_HOME 默认是 ~/.dsh;用环境变量 DSH_HOME 自定义过的以实际为准。

端口说明(重要)

  • 41540 是本插件的默认端口,不是 dsh 官方约定。它被占用时插件不会启动 dsh 崩溃,但会记录 FATAL: port ... already in use 日志,且 state.json 不会更新、/healthz 不通——此时换一个端口即可;
  • 修改端口(在 profile 的 cordis.patch.yml 或 $DSH_HOME/cordis.patch.yml 中):

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-tauri 下一个 Next dsh-ppt-composer →