@nullspace/sdk) gives you on-demand Linux
machines from Node or the browser. Its public surface follows the same
Python SDK primitives with TypeScript-friendly
resource namespaces and camelCased fields. Generated OpenAPI types stay
private; exported signatures use stable hand-written SDK types.
Install
WebSocket, which Node 22+ and all browsers provide.
On Node 18-20, install a WebSocket implementation such as ws and assign it
to globalThis.WebSocket before using those streaming surfaces.
Configure
Authentication resolves from explicit options first, then the environment:NULLSPACE_API_KEY— required API key.NULLSPACE_API_URL(aliasNULLSPACE_BASE_URL) — base URL.
NULLSPACE_API_KEY, NULLSPACE_API_URL, and NULLSPACE_BASE_URL from
the environment when process.env is available. It does not read .env,
XDG config, or ~/.nullspace/config.json; use the Python CLI for saved local
auth config.
Quickstart
Create → exec → file → destroy, in under 10 lines:Surface Map
| Surface | Use |
|---|---|
Machine.create, Machine.connect | One-off machine create/connect with explicit or env auth. |
client.machines | Shared-client create, get, list, and destroy. |
machine.commands | Foreground, streaming, and background command/process control. |
machine.files | Machine file read/write/list/move/remove/upload/download. |
machine.git | Clone, status, log, branch, checkout, add, commit, pull, and push inside a machine. |
machine.pty | Interactive terminal sessions over WebSocket. |
machine.code | Stateful code interpreter runs and contexts. |
machine.lifecycle | Per-machine lifecycle history and live subscription. |
client.snapshots | Get, list, delete, and resume snapshots. |
client.volumes | Create, get, list, and delete shared volumes. |
client.templates | Build, list, get, and delete templates. |
client.functions | Invoke deployed Function jobs/services and manage schedules/webhooks. |
Machines
AMachine exposes namespaced resources, mirroring Python:
machine.commands—run(withonStdout/onStderrstreaming),list,kill,sendStdin,getLogs.machine.files—read,write,list,exists,info,makeDir,remove,rename,upload/downloadwith progress callbacks.machine.pty—open()returns a handle (send input, resize, async-iterate output,wait(),kill()).machine.code—run()streams Jupyter-style execution events over SSE.machine.lifecycle—list()history andsubscribe()live events.
await using for short-lived work. Pass { keepAlive: true } as the
second argument to Machine.create(...) or client.machines.create(...) when
scope exit should leave the machine running.
Commands, Files, Git, PTY, Code
Commands can run in simple or streaming mode:Volumes, Snapshots, Templates
Volumes are metadata-managed throughclient.volumes and mounted through a
machine. Direct volume file operations are currently covered by the Python SDK,
CLI, and HTTP API.
Functions
The SDK invokes deployed Functions; authoring and deploy use the sharedfunction.py descriptor plus the Python-owned CLI.
max_concurrency in function.py to cap concurrent job runs. Sync
run/invoke calls return 429 capacity_exceeded with a Retry-After hint
when saturated; detached spawn calls expose queuedReason and
retryAfterSeconds when admitted to the bounded backlog.
Function deploy, rollback, checkpoint/branch, retained-machine shell access,
proxy-auth token management, named secrets, and environments are CLI/Python
management surfaces today.
Exported Types
Use the exported public types instead of generated OpenAPI types:CreateMachineOptions, RunOptions,
FileOptions, PtyOpenOptions, RunCodeOptions, BuildOptions, and the
Function option types exported from @nullspace/sdk.
Errors
Every failure is a typed subclass ofMachineError with a stable code,
matching the Python hierarchy: NotFoundError, AuthError, ConflictError,
QuotaExceededError, RateLimitError, TimeoutError, BuildError,
FileUploadError, and more.
Browser support
The REST, file transfer, and SSE core work in browsers; WebSocket-backed surfaces (PTY, exec streaming, lifecycle) need a globalWebSocket. WebSocket
routes authenticate with the nullspace-api-key subprotocol so browsers work
without setting headers. Use signed transfer URLs when browser code should move
file bytes directly.
Not included
The MCP server and CLI remain Python-owned (nullspace-sdk[cli,mcp]). Some
advanced REST domains the Python SDK exposes are not yet wrapped in the
TypeScript surface; the per-operation coverage manifest lives in
specs/client-surfaces/typescript-sdk.yaml.