---
title: "Compute · Tempo AI Platform docs"
description: "Sandboxes on E2B and Modal, GPUs and Browserbase cloud browsers, leased by the second from a Tempo Key or over MPP."
url: "https://gateway.tempo-dev.workers.dev/docs/compute"
---

> Every page of the Tempo AI Platform is Markdown at its URL with .md, or with Accept: text/markdown. The index of every page is https://gateway.tempo-dev.workers.dev/llms.txt, the API https://gateway.tempo-dev.workers.dev/openapi.json and the MCP server https://gateway.tempo-dev.workers.dev/mcp.

# Sandboxes, GPUs and browsers

Give an agent a Linux machine in three seconds, a GPU when it needs one, and a real browser to check its work. Pay by the second, and stop paying when you stop renewing.

[Get your Tempo Key](https://gateway.tempo-dev.workers.dev/key.md) · [Run it in a cloud agent](https://gateway.tempo-dev.workers.dev/docs/quickstart.md)

- **E2B first.** Sandboxes start on E2B, which costs less: base has 1 physical CPU core (2 vCPU) and 512 MiB for about $0.10 an hour.
- **Modal for GPUs.** T4 to B200, up to eight, any registry image with apt and pip layers, snapshots, wherever Modal has capacity or in a region you name.
- **Run anything.** exec for 120 s, stream for an hour, spawn for longer jobs with their logs, read and write files up to 8 MiB a call.
- **Leases.** Pay by the second at the provider's rate, and stop paying when you stop renewing.
- **Public ports.** ports gives a sandbox public HTTPS URLs, so it can serve a page or an API.
- **Cloud browsers.** Browserbase Chromium at $0.12 an hour, for Playwright or Puppeteer, with a live view for you.

## Use it

Use compute like any platform, with one API key for every route, or straight over MPP with a wallet and no account. Both pay the same prices.

### From your cloud agent

Give [your agent](https://gateway.tempo-dev.workers.dev/docs/quickstart.md) a turn. It already has these tools:

> Start a T4 sandbox on Modal with PyTorch, train a small character transformer on tiny-shakespeare for 1,500 steps in a spawned job, stream me the loss, and terminate it when it is done.

**Cloud agent**

```sh
curl https://gateway.tempo-dev.workers.dev/v1/agents/$AGENT/turns \
  -H "authorization: Bearer $TEMPO_KEY" \
  -H gateway-app:default \
  -H content-type:application/json \
  -H accept:text/event-stream \
  -d '{"prompt":"Start a T4 sandbox on Modal with PyTorch, train a small character transformer on tiny-shakespeare for 1,500 steps in a spawned job, stream me the loss, and terminate it when it is done."}'
```

### With your Tempo Key

Create a sandbox with your Tempo Key and run commands in it. The key pays E2B, Modal and Browserbase directly where it can, and sandboxes and browsers belong to its wallet and Gateway-App.

**Sandbox**

```sh
curl https://gateway.tempo-dev.workers.dev/v1/compute/create \
  -H "authorization: Bearer $TEMPO_KEY" \
  -H gateway-app:default \
  -H content-type:application/json \
  -d '{"lease":300}'

curl https://gateway.tempo-dev.workers.dev/v1/compute/exec \
  -H "authorization: Bearer $TEMPO_KEY" \
  -H gateway-app:default \
  -H content-type:application/json \
  -d '{"sandboxId":"<sandboxId>","command":["python3","-c","print(2 + 2)"]}'
```

**GPU**

```sh
curl https://gateway.tempo-dev.workers.dev/v1/compute/create \
  -H "authorization: Bearer $TEMPO_KEY" \
  -H gateway-app:default \
  -H content-type:application/json \
  -d '{"provider":"modal","gpu":"T4","image":"pytorch/pytorch:2.5.1-cuda12.4-cudnn9-runtime","cpu":1,"memory":2048,"timeout":600,"lease":600}'
```

**Browser**

```sh
curl https://gateway.tempo-dev.workers.dev/v1/browser/create \
  -H "authorization: Bearer $TEMPO_KEY" \
  -H gateway-app:default \
  -H content-type:application/json \
  -d '{"name":"research","minutes":10}'

const browser = await chromium.connectOverCDP(connectUrl);
```

**Terminate**

```sh
curl https://gateway.tempo-dev.workers.dev/v1/compute/terminate \
  -H "authorization: Bearer $TEMPO_KEY" \
  -H gateway-app:default \
  -H content-type:application/json \
  -d '{"sandboxId":"<sandboxId>"}'
```

### Over MPP, no account

The unpaid create answers 402 with the lease's price, quoted from the provider. Pay it with a session voucher and the sandbox is yours: another wallet's calls on its id answer not_found.

**tempo request**

```sh
tempo request --mach -X POST \
  -H gateway-app:default \
  --json '{"lease":300}' \
  https://gateway.tempo-dev.workers.dev/v1/compute/create

tempo request --mach -X POST \
  -H gateway-app:default \
  --json '{"sandboxId":"<sandboxId>","command":["uname","-a"]}' \
  https://gateway.tempo-dev.workers.dev/v1/compute/exec
```

**mppx**

```ts
import { Mppx, tempo } from "mppx/client";
import { createSqliteChannelStore } from "mppx/client/node";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const channelStore = createSqliteChannelStore({ namespace: "https://gateway.tempo-dev.workers.dev" });
const mppx = Mppx.create({ methods: [tempo({ account, channelStore, maxDeposit: "1" })], polyfill: false });

const created = await mppx.fetch("https://gateway.tempo-dev.workers.dev/v1/compute/create", {
  body: JSON.stringify({ lease: 300 }),
  headers: { "content-type": "application/json", "gateway-app": "default" },
  method: "POST",
});
const { sandboxId } = await created.json();
```

### As MCP tools

Every compute route is an MCP tool, and browser_create starts a browser.

`compute_create`, `compute_exec`, `compute_stream`, `compute_spawn`, `compute_logs`, `compute_read`, `compute_write`, `compute_renew`, `compute_terminate`, `browser_create`, `browser_close`

**Claude Code**

```sh
claude mcp add --transport http tempo https://gateway.tempo-dev.workers.dev/mcp \
  --header "authorization: Bearer $TEMPO_KEY"
```

**Codex**

```sh
curl -fsSL https://gateway.tempo-dev.workers.dev/codex | sh
```

## Sandboxes

A sandbox is a Linux machine leased by the second from E2B or Modal, at the provider's price. It belongs to the wallet and `Gateway-App` that created it, and every other wallet's or app's call on its id answers `not_found`.

- **Providers**\
  `provider: auto`, the default, picks E2B unless the request needs Modal: `gpu`, nonempty `apt` or `pip`, an `image`, a `snapshot`, `volumes`, `idleTimeout`, a `region` other than `auto` or `any`, or more CPU or memory than the template has. On E2B, `image` names a template: `base` (Debian 12, Python 3.11, Node 20, 1 physical CPU core / 2 vCPU, 512 MiB), `code-interpreter-v1`, `claude`, `codex`, `amp`, `opencode`, `openclaw` or `desktop`. On Modal it is any registry image, `python:3.12-slim` by default.
- **Resources**\
  Plain Modal sandboxes default to 0.125 physical CPU core and 128 MiB, with matching hard maxima. E2B base has 1 physical CPU core (2 vCPU) and 512 MiB. Supply both `cpu` (physical cores) and `memory` (MiB) explicitly for `gpu`, `snapshot`, nonempty `apt` or `pip`, or an explicit `image`; an E2B template with `provider: e2b` is exempt from the image requirement. Size resources for the workload rather than relying on plain-sandbox defaults.
- **GPUs**\
  `gpu` is T4, L4, A10G, L40S, A100-40GB, A100-80GB, H100, H200 or B200, and `gpuCount` up to 8. The T4 example explicitly requests 1 physical CPU core and 2048 MiB of host memory; these are example resources, not defaults.
- **Leases**\
  `create` pays `lease` seconds (300 by default, or the `timeout` if shorter), and `renew` pays more, up to the timeout of at most 24 hours. E2B ends at `paidUntil`; Modal is terminated asynchronously by the minute reaper after a 15-second grace. E2B runs a sandbox for at most an hour on one payment: a `lease` over 3600 on E2B answers 400 before anything is paid, and a renewal that would put `paidUntil` more than 3600 s from now answers 409 with the seconds it may add. `terminate` refunds the unused lease on Modal; E2B refunds nothing and charges a renewal from now, so renew an E2B sandbox near the end of its lease.
- **Commands and files**\
  `exec` runs for up to 120 s, `stream` for an hour, and `spawn` runs a job under `sh -c` for as long as the lease lasts. Every command takes `env` and `workdir`.
- **Network**\
  `blockNetwork` cuts the sandbox off the internet, and `ports` (up to 4) gives it public HTTPS URLs.
- **Regions**\
  On Modal, `region: auto` runs the sandbox near the Cloudflare location serving the request, and `any` lets Modal place it wherever it has capacity, at no multiplier. Every Modal sandbox defaults to `any`. A region costs Modal's multiplier: 1.15x for a broad one such as `us`, 1.75x for a narrow one such as `us-east`.
- **Hands**\
  `attach` on create, or `compute/hand` later, makes the sandbox a hand of the key's account, so agents run commands and edit files in it. [Machines](https://gateway.tempo-dev.workers.dev/docs/machines.md) covers hands.

Per-second rates for each provider, CPU, memory and GPU are on [Pricing](https://gateway.tempo-dev.workers.dev/docs/pricing.md#rates).

| Route                      | What it does                                                                               | Price                                         |
| -------------------------- | ------------------------------------------------------------------------------------------ | --------------------------------------------- |
| POST /v1/compute/create    | Start a sandbox on E2B, or on Modal for GPUs and container images, and pay its first lease | $0.001 (the lease per second, at least this)  |
| POST /v1/compute/renew     | Pay for more seconds of a sandbox, up to its timeout                                       | $0.001 (at the sandbox's rate, at least this) |
| POST /v1/compute/exec      | Run a command, up to 120 s, and answer its output and exit code                            | $0.00001                                      |
| POST /v1/compute/stream    | Run a command and stream its output as NDJSON, up to an hour                               | $0.00001                                      |
| POST /v1/compute/spawn     | Start a background job, with its output in logPath and its exit code in exitPath           | $0.00001                                      |
| POST /v1/compute/logs      | Stream a background job's log from an offset until it exits                                | $0.00001                                      |
| POST /v1/compute/read      | Read a file from an offset, 8 MiB at a time; gateway-file-size gives the whole size        | $0.00001                                      |
| POST /v1/compute/write     | Write the body to Gateway-Path in Gateway-Sandbox, Gateway-Size bytes, up to 8 MiB         | $0.00001                                      |
| POST /v1/compute/snapshot  | Save a Modal sandbox's filesystem as an image a later create starts from                   | $0.01                                         |
| POST /v1/compute/status    | Whether a sandbox is running, or terminated once it ended                                  | $0.00001                                      |
| POST /v1/compute/list      | Your running sandboxes in this app                                                         | $0.00001                                      |
| POST /v1/compute/terminate | Terminate a sandbox; a Modal sandbox's unused lease is refunded                            | $0.0001                                       |
| POST /v1/compute/hand      | Attach a running sandbox as a hand of the key's account; needs a Tempo Key                 | Free                                          |

## Volumes

A volume is a Modal Volume that outlives sandboxes, for data too large to download into each one, such as model weights. Mount it with `volumes: [{ name, path, readOnly }]` on `compute/create`, which then runs on Modal: download once into a read-write mount from a cheap CPU sandbox, and mount it `readOnly` into GPU sandboxes. Writes are committed every few seconds and when the sandbox terminates, and `sync <path>` in the sandbox commits at once.

Storage is prepaid at Modal's $0.09 per GiB-month for the whole `size` and `ttl`, and `delete` refunds what is left. A volume found storing more than its size has its size raised to what it stores and its expiry brought forward to match what was paid; once expired and unmounted, it is deleted with its data.

| Route                           | What it does                                                                                           | Price                                       |
| ------------------------------- | ------------------------------------------------------------------------------------------------------ | ------------------------------------------- |
| POST /v1/compute/volumes/create | Create a volume named name of size GiB (up to 10240) for ttl seconds (a day by default, up to 90 days) | $0.001 ($0.09 per GiB-month, at least this) |
| POST /v1/compute/volumes/renew  | Buy seconds more of a volume at size GiB, which becomes its quota                                      | $0.001 ($0.09 per GiB-month, at least this) |
| POST /v1/compute/volumes/list   | Your volumes with their size, bytes used, expiry and the sandboxes mounting them                       | $0.00001                                    |
| POST /v1/compute/volumes/files  | The files of a volume under path, recursively with recursive                                           | $0.00001                                    |
| POST /v1/compute/volumes/delete | Delete a volume no sandbox mounts, refunding its unused storage                                        | $0.00001                                    |

## Browsers

Browserbase cloud browsers (Chromium) for work that needs a real browser. Connect with `chromium.connectOverCDP(connectUrl)` in Playwright or `browserWSEndpoint` in Puppeteer, and watch it at `liveUrl`; both URLs are secrets. A browser is prepaid by the minute, and a key pays Browserbase itself.

| Route                   | What it does                                                                                                  | Price                                |
| ----------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| POST /v1/browser/create | Start a Chromium browser named name for minutes (5 to 360, 30 by default); answers its connectUrl and liveUrl | $0.01 ($0.12 an hour, at least this) |
| POST /v1/browser/status | A browser and its minutes paid, used and left                                                                 | $0.0001                              |
| POST /v1/browser/extend | Pay for more minutes of a browser                                                                             | $0.01 ($0.12 an hour, at least this) |
| POST /v1/browser/list   | Your browsers in this app                                                                                     | $0.0005                              |
| POST /v1/browser/close  | Close a browser and forget it                                                                                 | $0.0001                              |

[<- MCP tools](https://gateway.tempo-dev.workers.dev/docs/mcp.md) · [Machines ->](https://gateway.tempo-dev.workers.dev/docs/machines.md)
