For the complete documentation index, see llms.txt. This page is also available as Markdown.

OpenComputer

OpenComputer provides persistent cloud VMs with command execution, filesystem access, preview URLs, and checkpoints.

Installation

npm install computesdk @computesdk/opencomputer

Environment Variables

export OPENCOMPUTER_API_KEY=your_api_key_here
# Optional
export OPENCOMPUTER_API_URL=https://app.opencomputer.dev

Usage

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

compute.setConfig({
  provider: opencomputer({ apiKey: process.env.OPENCOMPUTER_API_KEY }),
});

const sandbox = await compute.sandbox.create({ templateId: 'base' });

const result = await sandbox.runCommand('node --version');
console.log(result.stdout);

await sandbox.destroy();

Options

Per-create options such as templateId, timeout, envs, metadata, memory, memoryMB, cpuCount, diskMB, secretStore, burst, previewAuth, and webhooks are forwarded to OpenComputer where supported.

Snapshots

ComputeSDK snapshots map to OpenComputer checkpoints:

Snapshot IDs returned by this provider are formatted as sandboxId:checkpointId because OpenComputer deletes checkpoints under their source sandbox. Raw OpenComputer checkpoint IDs are also accepted when creating a sandbox from a checkpoint.

Snapshots default to OpenComputer disk_only checkpoints with promoteToFull: true. Override with metadata: { kind: 'full' } or metadata: { promoteToFull: false } when needed.

Last updated

Was this helpful?