> For the complete documentation index, see [llms.txt](https://docs.computesdk.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.computesdk.com/providers/opencomputer.md).

# OpenComputer

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

## Installation

```bash
npm install computesdk @computesdk/opencomputer
```

## Environment Variables

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

## Usage

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

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

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

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

await sandbox.destroy();
```

## Options

```typescript
opencomputer({
  apiKey: process.env.OPENCOMPUTER_API_KEY,
  apiUrl: process.env.OPENCOMPUTER_API_URL,
  template: 'base',
  timeout: 300_000,
  memoryMB: 4096,
  cpuCount: 2,
  diskMB: 20480,
  burst: true,
});
```

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:

```typescript
const snapshot = await compute.snapshot.create(sandbox.instanceId, {
  name: 'configured',
});

const clone = await compute.instances.create({ snapshotId: snapshot.id });

await compute.snapshot.delete(snapshot.id);
```

Snapshot IDs returned by this provider are formatted as `instanceId: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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.computesdk.com/providers/opencomputer.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
