use.computer

SDK & API

Python SDK and the raw HTTP surface for api.use.computer.

Python SDK

The Python SDK lives at josancamon19/use-computer-python. pip install use-computer to get it.

from use_computer import Mmini
client = Mmini(api_key="mk_live_...")

Opening a sandbox

# macOS — uses the warm pool, returns in ~1s
mac = client.create()

# iOS — boots a simulator (~45s the first time)
ios = client.create(type="ios")

DSL

Each platform exposes a slightly different surface — most things share names, a few are platform-specific (e.g. exec is macOS-only; button("home") is iOS-only). The columns mark which client supports each call.

MethodmacOSiOSNotes
screenshot()Returns PNG bytes.
mouse.click(x, y)Native CGEvent click.
mouse.move(x, y) / drag(...)
tap(x, y)iOS equivalent of click.
swipe(start, end)Swipe gesture.
button("home")Hardware button (home / volume / …).
keyboard.type("text")Typed input.
keyboard.press("cmd+space")Chord syntax for shortcuts.
exec("ls -la /Users/lume")Runs a shell command via SSH.
exec_ax(...)Runs under cua-server (AX-granted).
files.put(local, remote)Upload.
files.get(remote)Download.
accessibility(...)axe-backed UI tree introspection.

Keep-alive

For long-running operations (>2 min between API calls), send a keep-alive so the idle reaper doesn't snipe your sandbox:

mac.keepalive()

Cleanup

mac.destroy()

Always call this when you're done. The reservation expirer will catch it otherwise, but it's wasteful.

HTTP API

If you're not on Python, every SDK method is a thin wrapper over https://api.use.computer/v1/sandboxes/.... Auth is Authorization: Bearer mk_live_... on every request. There's an interactive Swagger viewer at api.use.computer/docs and the raw spec at api.use.computer/openapi.yaml — drop the latter into Postman or Insomnia for an explorable client.

Sandboxes

MethodPathDescription
POST/v1/sandboxesOpen a sandbox. Body: {type, mini_ip?, vm_name?, device_type?, runtime?}.
GET/v1/sandboxes/{id}Session detail + ssh/vnc info.
DELETE/v1/sandboxes/{id}Destroy.
POST/v1/sandboxes/{id}/keepaliveTouch last_active.
POST/v1/sandboxes/{id}/screenshotReturns PNG.
POST/v1/sandboxes/{id}/mouse/clickBody: {x, y, button?}.
POST/v1/sandboxes/{id}/keyboard/typeBody: {text}.
POST/v1/sandboxes/{id}/execBody: {cmd}.
PUT/v1/sandboxes/{id}/filesUpload.
GET/v1/sandboxes/{id}/files?path=...Download.
GET/v1/sandboxes/{id}/vncReturns ws_url + vnc_password.
GET/v1/sandboxes/{id}/vnc/wsWebSocket VNC bridge.

Reservations

MethodPathDescription
GET/v1/reservations/meCurrent reservation state.

Platforms (catalog)

MethodPathDescription
GET/v1/platformsmacOS images + iOS device types/runtimes available.

Auth and errors

All endpoints return JSON. 4xx errors include {"error": "..."}. The key is revoked when the reservation ends or you call dev-destroy — once revoked, every call returns 401.

On this page