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.
SmolVM class is still the shortest path.
Start the server
Install the web dependencies:Core endpoints
| Method | Path | What it does |
|---|---|---|
POST | /sandboxes | Create, boot, and register a sandbox |
GET | /sandboxes | List sandboxes on the host |
GET | /sandboxes/{id} | Get one sandbox’s state |
POST | /sandboxes/{id}/exec | Run a command inside a sandbox |
DELETE | /sandboxes/{id} | Stop and delete a sandbox |
Create a sandbox with curl
SmolVM(...) constructor.
Guest operating system. Omit it for the default Linux sandbox.
Image reference to boot, such as an S3 image URI,
file:// URI, or local Windows qcow2 path.Guest memory in MiB.
Guest disk size in MiB.
Runtime backend override.
Run a command
Command to run inside the sandbox.
Maximum seconds to wait for the command.
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 namedSmolvm. In a project where that TypeScript package is available, point it at the local server:
smolvm-client.ts
smolvm.sandbox:
| Method | HTTP call |
|---|---|
smolvm.sandbox.create(...) | POST /sandboxes |
smolvm.sandbox.list() | GET /sandboxes |
smolvm.sandbox.get(id) | GET /sandboxes/{id} |
smolvm.sandbox.exec(id, body) | POST /sandboxes/{id}/exec |
smolvm.sandbox.delete(id) | DELETE /sandboxes/{id} |
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:Troubleshooting
The server says dashboard dependencies are missing
The server says dashboard dependencies are missing
Install the web extra, then start the server again:
The port is already in use
The port is already in use
Pick another port:
A command exits non-zero
A command exits non-zero
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.Related
smolvm server
CLI reference for the local API server
SmolVM Python API
Use SmolVM directly from Python
