Skip to main content
Standalone class — not a property on Sandbox.

Constructor

import { Snapshots } from "@opencomputer/sdk";

const snapshots = new Snapshots();
// or with explicit config:
const snapshots = new Snapshots({ apiKey: "...", apiUrl: "..." });
apiKey
string
API key (falls back to OPENCOMPUTER_API_KEY env var)
apiUrl
string
API URL (falls back to OPENCOMPUTER_API_URL env var)

snapshots.create(opts)

Create a pre-built snapshot from a declarative image. HTTP API →
name
string
required
Unique snapshot name
image
Image
required
Declarative image definition
onBuildLogs
(log: string) => void
Build log streaming callback
Returns: Promise<SnapshotInfo>

snapshots.list()

List all snapshots. HTTP API → Returns: Promise<SnapshotInfo[]>

snapshots.get(name)

Get a snapshot by name. HTTP API →
name
string
required
Snapshot name
Returns: Promise<SnapshotInfo>

snapshots.delete(name)

Delete a snapshot. Existing sandboxes created from it are not affected. HTTP API →
name
string
required
Snapshot name
Returns: Promise<void>

Types

interface SnapshotInfo {
  id: string;
  name: string;
  status: string;       // "building" | "ready" | "failed"
  contentHash: string;
  checkpointId: string;
  manifest: object;
  createdAt: string;
  lastUsedAt: string;
}