@dvmkit/sdk

中文文档
0.37.0发布于 2026/11/13Apache-2.0TypeScriptES Module构建来源已验证近 30 天下载 1.8万

SDK for building Digital Vending Machines: pay-per-use HTTPS services AI agents can find, pay, and call with no account or API key

原始使用文档
文档目录10 节
  1. Requirements
  2. Install
  3. Quickstart: a free DVM
  4. What's in the package
  5. Next steps
  6. Contributing
  7. Security
  8. Support
  9. Trademarks
  10. License

@dvmkit/sdk

Build Digital Vending Machines: pay-per-use HTTPS services that AI agents can find, pay, and call with no account or API key.

Pre-1.0 alpha: pin the version you install; see the release notes for breaking changes and the compatibility policy.

Requirements

Node.js 22.18 or later for the TypeScript quickstart; see runtime support.

Install

Create a project and install the current release, recording its exact version:

mkdir hello-dvm && cd hello-dvm
npm init -y
npm pkg set type=module
npm install --save-exact @dvmkit/sdk

Quickstart: a free DVM

Save this as handler.ts:

import { configureDVM, z } from "@dvmkit/sdk";

export const inputSchema = z.object({ text: z.string().min(1) });

export default configureDVM({
  name: "hello",
  description: "Return the supplied text",
  capability: "echo",
  input: inputSchema,
  example: { text: "hello" },
  async onJob(ctx) {
    ctx.artifact({ mime_type: "text/plain", data: ctx.input.text });
    ctx.complete("Echoed the input");
  },
});

Save this as server.ts:

import { serve } from "@dvmkit/sdk/server";

import dvm from "./handler.ts";

const server = await serve(dvm, { devMode: true });

for (const signal of ["SIGINT", "SIGTERM"]) {
  process.once(signal, () => {
    void server.close().then(() => process.exit(0));
  });
}

Start the server:

node server.ts

Leave it running. In another terminal, submit a job:

curl -sS http://localhost:8080/v1/job \
  -H 'content-type: application/json' \
  --data '{"capability":"echo","data":{"text":"hello"}}'

The response includes a generated job_id and job_token, "status":"completed", and "summary":"Echoed the input". The server listens at http://localhost:8080; stop it with Ctrl-C. devMode lets this free example run without Postgres.

The files above are copied verbatim from examples/quickstart. See the runnable authenticated custom route and payments and lifecycle examples for the next step.

What's in the package

ImportPurpose
@dvmkit/sdkDVM descriptors, handler context, bundled Zod, pricing, signing, and safe-fetch helpers
@dvmkit/sdk/serverNode hosting, Postgres stores, signed-request auth, and payment infrastructure
@dvmkit/sdk/testingDeterministic handler contexts and in-memory stores

The generated API reference lists the supported declarations.

Next steps

  • SDK guide: add authentication, custom routes, payments, and persistence.
  • Protocol guide: understand the HTTP contract callers use.
  • Builder guide: scaffold and deploy a service; install the builder CLI with npm install --global @dvmkit/dvmctl.

Operating a DVM covers production setup, verified development payments, credit liabilities, diagnostics, retention, content holds, and financial exports. Protocol notes cover compatibility, job credentials, identity, terminal evidence, costs, and rate cards.

Contributing

Issues and discussions are welcome. Unsolicited pull requests are closed; read CONTRIBUTING.md and the Code of Conduct before participating.

Security

Report vulnerabilities privately as described in SECURITY.md.

Support

Use SUPPORT.md to find the right place for questions and bug reports.

Trademarks

The Apache License grants no rights in the dvmkit name or branding; identify your own products and forks without implying endorsement. Permission requests go through support; descriptive use of “digital vending machine” or “DVM” is not restricted.

License

Apache-2.0. See LICENSE and NOTICE.

版本与发布记录

@dvmkit/sdk 共发布 81 个版本,首次发布于 2026/09/02;过去 12 个月发布了 81 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.37.0latest2026/11/13今天
0.36.02026/11/13今天
0.35.22026/11/121 天前
0.35.12026/11/112 天前
0.35.02026/11/112 天前
0.34.02026/11/103 天前

其他发布通道:bootstrap → 0.0.0,next → 0.12.0-rc.1。

关于 @dvmkit/sdk 的常见问题

@dvmkit/sdk 是什么?

SDK for building Digital Vending Machines: pay-per-use HTTPS services AI agents can find, pay, and call with no account or API key

如何安装 @dvmkit/sdk?

在项目目录运行 npm install @dvmkit/sdk,或使用 pnpm add / yarn add / bun add。

@dvmkit/sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@dvmkit/sdk 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@dvmkit/sdk 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@dvmkit/sdk 可以商用吗?

@dvmkit/sdk 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@dvmkit/sdk 的下载量有多少?

根据 npm 官方下载统计,@dvmkit/sdk 在 2026/10/13 – 2026/11/11 这 30 天内被下载 18,252 次,日均约 608 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@dvmkit/sdk 还在维护吗?

最新版本 0.37.0 发布于 2026/11/13(今天);至今共发布 81 个版本,其中过去 12 个月发布了 81 个;首次发布于 2026/09/02。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。