> ## Documentation Index
> Fetch the complete documentation index at: https://vetta.sh/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# computers

> Sandboxed machines — lifecycle, shell, filesystem, snapshots — client.computers.

A computer is a sandboxed machine a session works on. Ten methods; objects parse with the core `ComputerSchema`. API detail: [Computers](https://vetta.sh/docs/api/computers.md).

## create

```ts theme={"system"}
client.computers.create(body: ComputerCreate): Promise<Computer>
```

`POST /v1/computers`. Every field is optional — an empty body gets the defaults.

**name** `string`

Display name.

**vcpu** `integer`

Virtual CPUs.

**memory\_mb** `integer`

Memory in MiB.

**disk\_gb** `integer`

Disk in GiB.

**browser** `object`

Browser policy, e.g. `{ allowed_domains: ["*.example.com"] }`.

**snapshot\_id** `string`

A `snp_` snapshot to restore from.

## list

```ts theme={"system"}
client.computers.list(query?: ListQuery): Promise<Page<Computer>>
```

`GET /v1/computers`, cursor-paginated.

## get

```ts theme={"system"}
client.computers.get(id: string): Promise<Computer>
```

`GET /v1/computers/{id}`.

## exec

```ts theme={"system"}
client.computers.exec(id: string, command: string, timeoutMs?: number): Promise<ExecResult>
```

`POST /v1/computers/{id}/exec`. Runs a shell command and answers when it exits:

```json theme={"system"}
{ "stdout": "...", "stderr": "", "exit_code": 0, "duration_ms": 412 }
```

`timeoutMs` maps to the `timeout_ms` body field; the command is killed when it elapses.

## pause / resume

```ts theme={"system"}
client.computers.pause(id: string): Promise<Computer>
client.computers.resume(id: string): Promise<Computer>
```

`POST /v1/computers/{id}/pause` and `POST /v1/computers/{id}/resume`. Paused bills **storage only** — the first efficiency lever. Resume brings the same disk back.

## snapshot

```ts theme={"system"}
client.computers.snapshot(id: string): Promise<Snapshot>
```

`POST /v1/computers/{id}/snapshot`. Captures the filesystem for fast restore; pass the returned `snapshot_id` to `create`.

## fs

```ts theme={"system"}
client.computers.fs(id: string, op: FsOp, body: Record<string, string>): Promise<unknown>
```

One method parameterized over the five `/v1/computers/{id}/fs/*` routes — `FsOp` is `"read" | "write" | "list" | "mkdir" | "remove"`. Splitting it would produce five near-identical methods with no added type safety. The reply differs per op (`{content}`, `{entries}`, `{created}`, …), so it comes back unparsed.

Every op takes an absolute `path`, **inside the computer's home directory** — the `home` that `computers.inspect(id)` reports, written here as `/home/user`; a path outside it is refused by the machine. `read` and `write` also take `encoding` (`"text"` default, `"base64"` for binary) and `write` takes `content`:

```ts theme={"system"}
await client.computers.fs(id, "write", { path: "/home/user/hello.txt", content: "hi\n" });
const file = await client.computers.fs(id, "read", { path: "/home/user/hello.txt" });
const dir = await client.computers.fs(id, "list", { path: "/home/user" });
```

Bodies and per-op replies are specified in the [filesystem API reference](https://vetta.sh/docs/api/computers.md#filesystem).

## build3d

```ts theme={"system"}
client.computers.build3d(id: string, body: Build3dRequestInput): Promise<Build3dResult>
```

`POST /v1/computers/{id}/build-3d`. Runs a build123d (`engine: "cad"`, millimetres) or Blender (`engine: "blender"`, metres) script in the computer, checks it, renders previews and publishes the exports:

```ts theme={"system"}
const build = await client.computers.build3d(id, {
  engine: "cad",
  name: "plate",
  script: "from build123d import *\nresult = Box(60, 40, 4)",
  export: ["step", "stl"],
  render: { views: ["iso", "top"] },
});
if (!build.ok) console.log(build.error?.message, build.error?.line);
```

A failing script resolves with `ok: false` and `error: { message, line }`; it does not throw. Both types are exported: `import type { Build3dRequestInput, Build3dResult } from "@usenaive-sdk/vetta"`. Fields, limits and the checks are in the [API reference](https://vetta.sh/docs/api/computers.md#build-a-3d-model).

## delete

```ts theme={"system"}
client.computers.delete(id: string): Promise<Deleted>
```

`DELETE /v1/computers/{id}`. Destroys the machine and its disk. Snapshots survive.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.