@computesdk/lelantos

中文文档
0.2.20发布于 2026/11/06MITTypeScriptESM + CJS近 30 天下载 9136

Lelantos provider for ComputeSDK - EU-native Firecracker microVM sandboxes (E2B-API-compatible) with full Linux environments, filesystem access, and per-port preview URLs

原始使用文档
文档目录18 节
  1. Installation
  2. Setup
  3. Quick Start
  4. Configuration
  5. Environment Variables
  6. Configuration Options
  7. Features
  8. API Reference
  9. Command Execution
  10. Filesystem Operations
  11. Preview URLs
  12. Sandbox Management
  13. Error Handling
  14. Best Practices
  15. Limitations
  16. Roadmap
  17. Support
  18. License

@computesdk/lelantos

Lelantos provider for ComputeSDK — execute code in secure, EU-native Firecracker microVM sandboxes with full filesystem and terminal support.

Lelantos is an E2B-API-compatible sandbox platform running on Hetzner bare-metal in the EU. Because the wire protocol is E2B-compatible, this provider wraps the same e2b npm SDK — but points it at a Lelantos control plane via domain / apiUrl and threads those options through every SDK call (create, connect, list, kill, snapshot, template), so lifecycle operations stay on Lelantos rather than falling back to api.e2b.app.

Installation

npm install @computesdk/lelantos

Setup

  1. Get your Lelantos API key from lelantos.ai
  2. Set the environment variable:
export LELANTOS_API_KEY=lel_your_api_key_here

Lelantos issues lel_… keys. The provider accepts both the lel_… and e2b_… forms of a Lelantos key: a native lel_<hex> key is transparently presented to the underlying e2b SDK as its e2b_<hex> alias (the e2b SDK validates the key prefix client-side since v2.27), and the Lelantos control plane resolves both forms to the same key.

Quick Start

Configure compute with the Lelantos provider and create a sandbox:

import { compute } from 'computesdk';
import { lelantos } from '@computesdk/lelantos';

compute.setConfig({
  provider: lelantos({ apiKey: process.env.LELANTOS_API_KEY }),
});

const sandbox = await compute.instances.create();

const result = await sandbox.runCommand(`python3 - <<'PY'
import platform
print("Hello from a Lelantos microVM")
print(platform.platform())
PY`);

console.log(result.stdout);
await sandbox.destroy();

Alternatively, call the provider factory directly when you only need one provider:

import { lelantos } from '@computesdk/lelantos';

const sdk = lelantos({ apiKey: process.env.LELANTOS_API_KEY });
const sandbox = await sdk.sandbox.create();

Configuration

Environment Variables

export LELANTOS_API_KEY=lel_your_api_key_here
# Optional — override the control-plane + sandbox domain (defaults to lelantos.ai)
export LELANTOS_DOMAIN=lelantos.ai
# Optional — explicit control-plane URL (overrides the domain-derived URL)
export LELANTOS_API_URL=https://api.lelantos.ai

The provider resolves credentials with the following fallback order so it is a drop-in for E2B-shaped configs:

  • API key: config.apiKey → LELANTOS_API_KEY → E2B_API_KEY
  • Domain: config.domain → LELANTOS_DOMAIN → E2B_DOMAIN
  • API URL: config.apiUrl → LELANTOS_API_URL → E2B_API_URL

Configuration Options

interface LelantosConfig {
  /** Lelantos API key (lel_… or e2b_… form). Falls back to LELANTOS_API_KEY then E2B_API_KEY. */
  apiKey?: string;
  /** Control-plane + sandbox domain, e.g. 'lelantos.ai'. Falls back to LELANTOS_DOMAIN then E2B_DOMAIN. */
  domain?: string;
  /** Explicit control-plane URL override. Falls back to LELANTOS_API_URL then E2B_API_URL. */
  apiUrl?: string;
  /** Execution timeout in milliseconds */
  timeout?: number;
}

Pointing the provider at a self-hosted or staging Lelantos slot is just a matter of setting domain (and optionally apiUrl):

const provider = lelantos({
  apiKey: process.env.LELANTOS_API_KEY,
  domain: 'staging.lelantos.ai',
});

Features

  • ✅ EU-native microVMs — Firecracker isolation on Hetzner bare-metal in the EU
  • ✅ Command Execution — Run shell commands in the sandbox, with real exit codes surfaced (non-zero exits are returned, not masked)
  • ✅ Filesystem Operations — Read, write, list, mkdir, exists, remove
  • ✅ Per-port Preview URLs — getUrl({ port }) returns https://{port}-{instanceId}.{domain}
  • ✅ Snapshots & Templates — Snapshot a running sandbox; list/delete templates
  • ✅ Domain / apiUrl threaded everywhere — control-plane calls always target your Lelantos slot

API Reference

Command Execution

// Run Python via heredoc
const result = await sandbox.runCommand(`python3 - <<'PY'
import json
print(json.dumps({"message": "Hello from Python"}))
PY`);

// List files
const ls = await sandbox.runCommand('ls -la');

// A non-zero exit is returned (not thrown) with the real exit code + stderr
const failed = await sandbox.runCommand('exit 3');
console.log(failed.exitCode); // 3

Filesystem Operations

await sandbox.filesystem.writeFile('/tmp/hello.py', 'print("Hello World")');
const content = await sandbox.filesystem.readFile('/tmp/hello.py');
await sandbox.filesystem.mkdir('/tmp/data');
const files = await sandbox.filesystem.readdir('/tmp');
const exists = await sandbox.filesystem.exists('/tmp/hello.py');
await sandbox.filesystem.remove('/tmp/hello.py');

Preview URLs

// Expose a server running on port 3000 inside the sandbox
const url = await sandbox.getUrl({ port: 3000 });
// => https://3000-<instanceId>.lelantos.ai

Sandbox Management

const info = await sandbox.getInfo();
console.log(info.id, info.status, info.createdAt);

await sandbox.destroy();

Error Handling

import { lelantos } from '@computesdk/lelantos';

try {
  const compute = lelantos({ apiKey: process.env.LELANTOS_API_KEY });
  const sandbox = await compute.instances.create();
} catch (error) {
  if (error.message.includes('Missing Lelantos API key')) {
    console.error('Set LELANTOS_API_KEY environment variable');
  } else if (error.message.includes('authentication failed')) {
    console.error('Check your Lelantos API key');
  } else if (error.message.includes('quota exceeded')) {
    console.error('Lelantos usage limits reached');
  }
}

Best Practices

  1. Resource Management — Always destroy sandboxes when done to free resources.
  2. Error Handling — Use try/catch around create/connect calls.
  3. Timeouts — Set an appropriate timeout for long-running tasks.
  4. API Key Security — Never commit API keys to version control.

Limitations

  • Template creation — Build templates via the E2B-compatible template build protocol / CLI, or snapshot a running sandbox with snapshot.create(). Direct template.create() is intentionally unsupported.
  • Region — Sandboxes run in the EU (single-region today).

Roadmap

Lelantos also offers browser sandboxes (CDP-controllable Firecracker browser microVMs). A follow-up release will add a Lelantos-only browser extension namespace to this provider. This initial package is intentionally compute-focused (portable sandbox / snapshot / template surface only) to keep it a clean drop-in alongside the other ComputeSDK providers.

Support

License

MIT

版本与发布记录

@computesdk/lelantos 共发布 21 个版本,首次发布于 2026/07/01;过去 12 个月发布了 21 个版本。

版本发布日期距今
0.2.20latest2026/11/064 天前
0.2.192026/11/046 天前
0.2.182026/10/2812 天前
0.2.172026/10/2318 天前
0.2.162026/10/2318 天前
0.2.152026/10/2218 天前

关于 @computesdk/lelantos 的常见问题

@computesdk/lelantos 是什么?

Lelantos provider for ComputeSDK - EU-native Firecracker microVM sandboxes (E2B-API-compatible) with full Linux environments, filesystem access, and per-port preview URLs

如何安装 @computesdk/lelantos?

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

@computesdk/lelantos 支持 TypeScript 吗?

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

@computesdk/lelantos 支持 ESM 还是 CommonJS?

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

@computesdk/lelantos 可以商用吗?

@computesdk/lelantos 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@computesdk/lelantos 的下载量有多少?

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

@computesdk/lelantos 还在维护吗?

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