Skip to content
Raster
Esc
navigateopen⌘Jpreview
On this page

SDKs

TypeScript and Python over one API — installation, configuration, and where the two differ.

Two clients, one API. Each authenticates with an organization API key and speaks the same vocabulary: machines, screens, keyboards and terminals. Neither depends on a model provider or an agent framework, and neither can reach a route your own API key cannot.

Every page in this section shows both languages. Naming follows the host language — waitForDesktop in TypeScript is wait_for_desktop in Python — and nothing else moves.

Install

npm install @raster/sdk
uv add raster
pip install raster

Python is 3.11 or newer, and realtime is an optional extra: pip install "raster[realtime]". Most callers are agent loops that screenshot and click over ordinary HTTP and never open a socket, so the websocket dependency is opt-in rather than paid for by everybody.

Configure

Variable Meaning
RASTER_API_KEY an organization API key, created under Keys in the dashboard
RASTER_BASE_URL where the API answers, including the /v1 prefix
export RASTER_API_KEY=sk_...
export RASTER_BASE_URL=https://api.raster.sh/v1

There is deliberately no built-in default base URL. A wrong-but-plausible hostname baked into a published SDK sends a customer’s API key somewhere nobody chose, so the deployment names its own API or the constructor refuses.

Hello, machine

import { Client } from "@raster/sdk";

const client = new Client();
const machine = await client.machines.create({ name: "research", size: "small" });
await machine.waitForDesktop();

await machine.browser.open("https://example.com");
const shot = await machine.screen.screenshot({ format: "png" });

await machine.close();
from raster import Client

client = Client()

with client.machines.create(name="research", size="small") as machine:
    machine.wait_for_desktop()

    machine.browser.open("https://example.com")
    shot = machine.screen.screenshot(format="png")

The surface

Where the two differ

Both SDKs are the same design, but they are not identical. These are the gaps worth knowing before you port code between them:

TypeScript Python
Concurrency async/await throughout synchronous
Responses typed objects and interfaces TypedDict — index with [...]
Cleanup await machine.close() with machine: or machine.close()
Lists for await (… of …) async iterables ordinary iterators
usage.series client.usage.series(…) not wrapped; use client.api.usage.series(…)
error.quota present on quota_exceeded not surfaced; read error.message
Realtime included raster[realtime] extra

Was this page helpful?