Create your first machine
Install the SDK, boot a machine, and drive it — from nothing to a running, driven computer.
Install
npm install @computer/sdk
The SDK authenticates with an API key, which you create under Keys in the dashboard. The plaintext is shown once, at creation, and never again.
export COMPUTER_API_KEY=sk_...
export COMPUTER_BASE_URL=https://api.example.com/v1
Create a machine
import { Client } from "@computer/sdk";
const client = new Client();
const machine = await client.machines.create({ name: "research", size: "small" });
// running is not the same as ready: a machine has a working shell before it
// has a working desktop.
const display = await machine.waitForDesktop();
Drive its computer
With display resolved, the machine has a working desktop. Drive it the same way a person
would:
await machine.browser.open("https://example.com");
await machine.keyboard.type("hello");
await machine.mouse.click({ x: 640, y: 400 });
const shot = await machine.screen.screenshot({ format: "png" });
const result = await machine.terminal.exec(["uname", "-sr"]);
shot is a screenshot of a real desktop your code just drove, and result is the output of
a command it just ran. That’s a complete round trip: a machine created, booted, and driven.
From here, see take input control for handing the keyboard back and forth with a person, or how machines behave for the reasoning behind sizes, readiness, coordinates, and exit codes.