Solari

TypeScript SDK

The official TypeScript clients for the three Solari products: browsers (a connected Playwright Browser in the cloud), VMs (GUI desktops you drive with mouse, keyboard, and screenshots), and sandboxes (headless microVMs for commands, code, and files). Each product ships as its own package; install only what you use, or take @solarisdk/sdk for all three.

Installation

PackageProductClasses
@solarisdk/browserCloud browsersSolari, BrowserSession
@solarisdk/desktopVMs (GUI desktops)DesktopClient, Desktop
@solarisdk/sandboxSandboxes (headless)SandboxClient, Sandbox
@solarisdk/sdkAll three (unified)SolariClient + the solari CLI
npm install @solarisdk/browser    # browsers
npm install @solarisdk/desktop   # VMs
npm install @solarisdk/sandbox   # sandboxes
npm install @solarisdk/sdk       # all three + the solari CLI
ESM only
Every package is type: "module" and exposes only an import condition. There is no CommonJS build. @solarisdk/browser needs Node >=20; the others need >=18. await using needs TypeScript 5.2+ (uncompiled, Node 24).

Getting Started

Launch a browser

import { Solari } from "@solarisdk/browser";

const solari = new Solari({ apiKey: process.env.SOLARI_API_KEY! });
const browser = await solari.launch({ stealth: true, proxy: "us" });

const page = await browser.newPage();
await page.goto("https://example.com");
console.log(await page.title());

await browser.close();  // closes the browser AND releases the session

Create a VM

import { DesktopClient } from "@solarisdk/desktop";

const client = new DesktopClient({ apiKey: process.env.SOLARI_API_KEY! });
const vm = await client.create({ template: "workstation", resolution: "1280x720" });

await vm.keyboard.type("hello");  // the control channel opens on first use
const png = await vm.screenshot();
await vm.kill();

Create a sandbox

import { SandboxClient } from "@solarisdk/sandbox";

const client = new SandboxClient({ apiKey: process.env.SOLARI_API_KEY! });
const sbx = await client.create({ template: "base" });

const r = await sbx.commands.run("echo", { args: ["hi"] });
console.log(r.stdout);  // "hi"
await sbx.kill();

All three at once

SolariClient from @solarisdk/sdk wraps a DesktopClient, a SandboxClient, a TemplateClient, and a VolumeClient behind one API key. Browsers keep their own client. Reach for SolariClient when one script needs more than one of these; use SandboxClient or DesktopClient directly when you only need one product. All of them default baseUrl to https://api.getsolari.com.

import { SolariClient } from "@solarisdk/sdk";

const solari = new SolariClient({ apiKey: process.env.SOLARI_API_KEY! });

const vm  = await solari.desktops.create({ template: "workstation" });
const sbx = await solari.sandboxes.create({ template: "base" });
const vol = await solari.volumes.create({ name: "datasets" });
Volumes are live (Beta)

Volumes work on both sandboxes and desktops. Attach them at create time with volumes: [{ volumeId, path }]. On isolation: "shared" sandboxes the path is a short name, not an absolute path. Volumes are not available with isolation: "hardened" (outbound network blocked, and a volume is network storage): create answers 400 naming volumes; use "dedicated". See Volumes for the full explanation.

Configuration

Every client takes its options as one constructor object. apiKey is always required.

OptionTypeDefaultClientNotes
apiKeystringrequiredallSent as Authorization: Bearer. Throws if empty.
baseUrlstringsee notesallSolari: resolved from region; setting it ignores region. DesktopClient, SandboxClient and SolariClient: optional, defaults to https://api.getsolari.com. An empty string throws.
regionSolariRegion"us-west"SolariOnly "us-west" today. Unknown region throws.
timeoutMsnumber90_000SolariPer attempt, not per call.
maxAttemptsnumber2SolariTotal attempts. 2 means one retry.
backoffMsnumber500SolariFixed sleep between attempts, not exponential.
callTimeoutMsnumbertransport defaultDesktopClient, SandboxClient, SolariClientPer-RPC timeout given to handles this client creates.
fetchtypeof fetchglobalDesktopClient, SandboxClient, SolariClientOverride for tests or non-standard runtimes.
No environment variables are read
No SDK constructor reads process.env. Pass apiKey (and baseUrl, if you do not want production) explicitly. The process.env.SOLARI_API_KEY above is your code, not the SDK’s. Only the solari CLI reads SOLARI_API_KEY and SOLARI_BASE_URL.
Retry policy (@solarisdk/browser)
HTTP requests retry on 502, 503, 504, and 507 (and on transport errors), with a fixed backoffMs pause, unless the gateway marks the response retryable: false. A retryable: true hint on any other status is honoured for GET/HEAD/PUT/DELETE and for requests carrying an idempotency key. A 500 is not retried. launch()’s own retries option is separate: it re-creates the session with linear 100ms × attempt backoff and does not govern sessions.create().
Retry policy (desktops and sandboxes)
GET and DELETE requests, and creates (which carry an idempotency key automatically), are retried up to 5 times with exponential backoff (150 ms doubling, capped at 8 s, plus jitter). A request is retried on 502, 503, 504, or 507, on network errors, or when the gateway sets retryable: true(honouring its Retry-After when it is short). A 500 is never retried, and neither is a 429 unless the gateway marks it retryable. Other writes are never retried automatically.

Reference

ClassPackagePurpose
Solari@solarisdk/browserBrowser entry point: sessions, profiles, replays.
BrowserSession@solarisdk/browserA live browser + its session. Returned by launch().
DesktopClient@solarisdk/desktopVM entry point: create, connect, pause, resume, destroy.
Desktop@solarisdk/desktopA live GUI session: mouse, keyboard, screenshots, apps.
SandboxClient@solarisdk/sandboxSandbox entry point: create, list, snapshots, volumes.
Sandbox@solarisdk/sandboxA live headless session: commands, code, files, git. Shared base of Desktop.
SolariClient@solarisdk/sdkUnified wrapper: .desktops, .sandboxes, .templates, .volumes.