@arker-ai/sdk

中文文档
1.3.0发布于 2026/10/20Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 6028

TypeScript SDK for the Arker virtual computer platform — spawn sandboxed VMs, run code, sync files.

原始使用文档
文档目录5 节
  1. Install
  2. Get started
  3. Documentation and examples
  4. License
  5. Pools v2

Arker TypeScript SDK

Use the Arker TypeScript SDK to fork VMs, run commands, and sync files.

npm

Install

bun add @arker-ai/sdk

The SDK requires Node.js 18 or later.

Get started

Sign up and get your API key at arker.ai/console.

ARKER_API_KEY, ARKER_PROVIDER, and ARKER_REGION must be set in the environment or passed directly to new Arker().

Fork a source VM, run a command, sync a file, and delete the VM:

import { Arker } from "@arker-ai/sdk";

const arker = new Arker();
const vm = await arker.fork({ source_vm_name: "ubuntu-coding" });

const result = await vm.run("python3 -c 'print(2 + 2)'");
if (result.type === "completed") {
  console.log(result.stdout);
}

await vm.sync("/tmp/hello.txt", "hello from Arker");
const data = await vm.sync("/tmp/hello.txt");
console.log(new TextDecoder().decode(data));

await vm.delete();

Documentation and examples

Read the Arker documentation and browse the runnable examples.

License

Apache-2.0

Pools v2

Pools require the per-organization pools flag; a disabled organization receives 404 not_found. The three pool types are managed (Arker's multi-cloud compute), byoc (workers Arker launches in your cloud account), and self_hosted (BLAST workers you run). This replaces pools v1 and the earlier BYOC API: quotes, fixed purchase terms, prices, and the purchase idempotency key are removed with no compatibility layer.

Configure a regional endpoint (or provider and region) for pool operations. Listing pools uses the control plane across regions; use each returned pool's region for subsequent operations. Fork with exactly one of pool_id or pool_name; names are case-insensitive within a region. A fleet VM cannot be forked into a pool: use a supported image source instead. Pool VMs do not support interactive shells; use run for commands.

managed and byoc pools request resources with all three quantities (vcpu, memory_mib, disk_mib), including zeros; a self_hosted pool's resources is an optional cap. Every pool reports resources_reserved (what its workers contribute) and resources_provisioned (what its VMs use). A pool is creating until its first worker is running (a managed pool starts running), then running; reason says what needs attention. A byoc pool (provider aws) needs setup: open byoc.setup_url in the specified AWS account and create the CloudFormation stack. A self_hosted pool's platform is set by its first worker; workers join with an API key limited to the pool, ar.createApiKey({ name, scopes: [{ pool_id: poolId }] }). Only managed pools take commitments.

Commitments last at least 24 hours, cannot overlap, and new commitments cannot start in the past. Started commitments must remain unchanged, including expired ones. The add-commitment helper reads the pool and appends to the entire list. Serialize commitment edits: the API has no conditional update or atomic append, so concurrent edits can overwrite unstarted commitments. Active commitments prevent shrinking or deletion; resizing to zero otherwise releases the reservation. Deleting a pool deletes every VM in it.

API errors retain their code, status, message, and server details. A 429 quota_exceeded is returned immediately; adjust the reservation/quota or remove unused pools instead of retrying. Ordinary rate limits keep the SDK's retry policy. capacity_unavailable means placement has no capacity; inspect the pool's reserved resources, workers, and state. Fleet-to-pool fork and unsupported shell refusals are surfaced without a fallback placement. Creation has no documented idempotency guarantee: after an ambiguous transport failure, inspect the pool list before creating again.

const pool = await arker.createPool({
  type: "managed", platform: "icelake",
  resources: { vcpu: 8, memory_mib: 32768, disk_mib: 102400 },
});
await arker.addPoolCommitment(pool.pool_id, {
  starts_at: "2027-01-01T00:00:00Z", ends_at: "2027-01-02T00:00:00Z",
});
await arker.fork({ image: "ubuntu", pool_id: pool.pool_id });

See the BYOC pool example for AWS setup and readiness.

版本与发布记录

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

版本发布日期距今
1.3.0latest2026/10/2019 天前
1.2.82026/09/151 个月前
1.2.72026/09/062 个月前
1.2.62026/09/052 个月前
1.2.52026/09/032 个月前
1.2.42026/09/022 个月前

关于 @arker-ai/sdk 的常见问题

@arker-ai/sdk 是什么?

TypeScript SDK for the Arker virtual computer platform — spawn sandboxed VMs, run code, sync files.

如何安装 @arker-ai/sdk?

在项目目录运行 npm install @arker-ai/sdk,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 arker,可以用 npx arker 直接运行。

@arker-ai/sdk 支持 TypeScript 吗?

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

@arker-ai/sdk 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@arker-ai/sdk 需要什么版本的 Node.js?

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

@arker-ai/sdk 可以商用吗?

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

@arker-ai/sdk 的下载量有多少?

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

@arker-ai/sdk 还在维护吗?

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