dshbase

插件目录 / Developer / dsh-openai-api

dsh-openai-api

已验证 · 实测可装 paulalesius

✓ 持续维护

查看 GitHub ↗ ← 返回插件目录

0Stars
0Forks
0未关闭 issue
—语言
2026-08-24最近推送
跨平台平台

功能简介

OpenAI-compatible /v1/chat/completions (streaming and non-streaming) and /v1/models endpoint on the DSH web server.

✅
我们的评价
可用 — 实测通过,早期项目

OpenAI-compatible /v1/chat/completions (streaming and non-streaming) and /v1/models endpoint on the DSH web server. 实测能干净安装、正常启动。早期项目,但功能可用。

「已验证」表示我们的自动化 CI 在干净 profile 里实际执行了 dsh plugin add 并启动成功——仅此而已。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。

README

dsh-plugin-openai-api

dsh-plugin-openai-api banner

An OpenAI-compatible endpoint on a running dsh web server:

GET  /v1/models
POST /v1/chat/completions        (non-streaming and SSE streaming)

Installation

Install the plugin:

dsh plugin --profile web add /path/to/openai-api

(From a DSH source checkout, the same command is pnpm dsh plugin ….
A plain path links the source, so edits are picked up on restart. Fresh
checkout of this repo: recreate node_modules first —
ln -s /path/to/deepseek-harness/apps/cli/node_modules node_modules.)

Uninstall the plugin:

dsh plugin --profile web remove dsh-plugin-openai-api

Restart dsh web after either.

Configuration

Append to ~/.dsh/profiles/web/cordis.patch.yml (the install ships
disabled: true):

- id: openai-api
  disabled: false
  config:
    model: default
    apiKeys:
      - local-key

The config block replaces the plugin's defaults wholesale. Set
disabled: true to switch the endpoint off. Restart dsh web after
changes. All keys are optional:

key default what it does
model default The model id advertised at /v1/models. A request's model (absent, or this id) → the host's default model selection; any other id is passed through to the session.
provider host default The provider route created sessions use.
apiKeys unset (no auth) Non-empty array of client keys. When set, a request must present one of them (Authorization: Bearer <key>), else 401. A key identifies the caller; it does not select the preset.
cwd the dsh web process's working directory Working directory for created sessions. Must start with /.

Using the API

The contract is OpenAI's — it just works.

import OpenAI from 'openai'

const client = new OpenAI({
  baseURL: 'http://127.0.0.1:3080/v1',
  apiKey: 'local-key', // one of the config's apiKeys
})

// The agent preset rides a header; omit it for the default preset.
const preset = { 'X-Agent-Preset': 'custom-agent-preset' }

const reply = await client.chat.completions.create(
  {
    model: 'default',
    messages: [
      { role: 'user', content: 'What are you? ' },
      { role: 'assistant', content: "I'm a DSH agent." },
      { role: 'user', content: 'Write a haiku about that.' },
    ],
  },
  { headers: preset },
)
console.log(reply.choices[0].message.content)

The same, without an SDK (the Bearer header only when you set
apiKeys):

curl -s http://127.0.0.1:3080/v1/chat/completions \
  -H 'content-type: application/json' -H 'Authorization: Bearer local-key' \
  -H 'X-Agent-Preset: custom-agent-preset' \
  -d '{"messages":[{"role":"user","content":"hello"}]}'

Headers

X-Agent-Preset

The agent preset id the session joins — any id in
~/.dsh/.agent-presets/, plus the shipped presets.

  • Absent → the default preset (standard).
  • Unknown id → 400 with the roster; repeated or comma-joined → 400.
  • Resolved at session creation only: the same (key, preset) pair always
    resumes the same session; a different value is a different session.

安装

🧩 让 Agent 自动装(推荐)

装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:

dsh plugin add dshbase-catalog

然后对 agent 说「帮我装 dsh-openai-api」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包。

该插件是 GitHub 源码(未发 npm)——直接从仓库装:

Web profile:

dsh plugin --profile web add github:paulalesius/dsh-openai-api

Headless(CLI)profile:

dsh plugin --profile headless add github:paulalesius/dsh-openai-api

实测报告

验证通过:从 GitHub 源码完成 L1 安装 + L2 加载 + L3 运行(dsh 0.1.0-rc.6)。

安全:尚未扫描——我们的每日静态扫描将很快覆盖它。

分享徽章

Developer 里更多

浏览全部 7819 个插件 →