Skip to main content
SmolVM can run a local HTTP server so another process can create sandboxes and run commands without importing Python. This is useful for web apps, local tools, TypeScript services, and agent runtimes that already speak HTTP.

When to use the HTTP API

Use the HTTP API when:
  • A JavaScript or TypeScript process needs to create and control sandboxes.
  • A local service needs a stable REST interface instead of Python objects.
  • You want to generate clients from the OpenAPI spec.
  • You want to keep one SmolVM server process alive while several tools make requests.
For Python-only workflows, the SmolVM class is still the shortest path.

Start the server

Install the web dependencies:
Start the local server:
You should see:
Keep the server bound to 127.0.0.1 unless you have added your own network controls. The local API can create sandboxes and run commands on your machine.

Core endpoints

Create a sandbox with curl

Example response:
The request body mirrors the auto-config options of the Python SmolVM(...) constructor.
"alpine" | "ubuntu" | "windows"
Guest operating system. Omit it for the default Linux sandbox.
string
Image reference to boot, such as an S3 image URI, file:// URI, or local Windows qcow2 path.
integer
Guest memory in MiB.
integer
Guest disk size in MiB.
"firecracker" | "qemu" | "libkrun"
Runtime backend override.

Run a command

Example response:
string
required
Command to run inside the sandbox.
integer
default:"30"
Maximum seconds to wait for the command.
"login" | "raw"
default:"login"
Use login for the guest login shell, or raw to run the command without shell wrapping.

Use the TypeScript client

The SmolVM repository includes a generated TypeScript client and a small wrapper class named Smolvm. In a project where that TypeScript package is available, point it at the local server:
smolvm-client.ts
The wrapper groups operations under smolvm.sandbox:

Get sandbox desktop connection details

Use sandbox.desktop(id) to get the details you need to open a sandbox’s desktop viewer from a Node or TypeScript app. This is the SDK equivalent of the smolvm sandbox desktop CLI command, so you can wire the same workflow into a service or agent instead of shelling out.
sandbox-desktop.ts
The returned DesktopResponse has:
  • protocol — the desktop protocol, currently "vnc".
  • host — the loopback host the desktop is bound to.
  • port — the port the desktop is listening on.
  • viewer_url — a URL you can hand to a desktop viewer to open the session.
Point your viewer at viewer_url, or build your own connection from host and port. The method throws if the sandbox has no desktop or the server rejects the request.
The docs intentionally avoid an npm install command here. The release source includes the ts/ package and generated client, but package publication should be verified before documenting a registry install path.

Generate clients from OpenAPI

The server publishes its OpenAPI spec at:
Use that URL with your client generator of choice when you need another language or a custom TypeScript client.

Troubleshooting

Install the web extra, then start the server again:
Pick another port:
A command that runs and returns a non-zero exit code still produces a successful HTTP response. Check exit_code, stdout, and stderr in the response body.

smolvm server

CLI reference for the local API server

SmolVM Python API

Use SmolVM directly from Python
Last modified on August 7, 2026