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.
| Method | macOS | iOS | Notes |
|---|---|---|---|
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
| Method | Path | Description |
|---|---|---|
| POST | /v1/sandboxes | Open 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}/keepalive | Touch last_active. |
| POST | /v1/sandboxes/{id}/screenshot | Returns PNG. |
| POST | /v1/sandboxes/{id}/mouse/click | Body: {x, y, button?}. |
| POST | /v1/sandboxes/{id}/keyboard/type | Body: {text}. |
| POST | /v1/sandboxes/{id}/exec | Body: {cmd}. |
| PUT | /v1/sandboxes/{id}/files | Upload. |
| GET | /v1/sandboxes/{id}/files?path=... | Download. |
| GET | /v1/sandboxes/{id}/vnc | Returns ws_url + vnc_password. |
| GET | /v1/sandboxes/{id}/vnc/ws | WebSocket VNC bridge. |
Reservations
| Method | Path | Description |
|---|---|---|
| GET | /v1/reservations/me | Current reservation state. |
Platforms (catalog)
| Method | Path | Description |
|---|---|---|
| GET | /v1/platforms | macOS 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.