Skip to main content

Python SDK for the use.computer macOS and iOS Computer Use API

Project description

use-computer Python SDK

Python SDK for the use.computer macOS and iOS Computer Use API.

Install

pip install use-computer

Usage

from use_computer import Computer

client = Computer(api_key="mk_live_...")
sandbox = client.create()

# Screenshot
img = sandbox.screenshot.take_full_screen()

# Mouse
sandbox.mouse.click(500, 400)
sandbox.mouse.move(100, 200)
sandbox.mouse.scroll(500, 400, "down", 3)
sandbox.mouse.drag(100, 100, 300, 300)

# Keyboard
sandbox.keyboard.type("Hello")
sandbox.keyboard.press("enter")
sandbox.keyboard.hotkey("command+space")

# Display
info = sandbox.display.get_info()
windows = sandbox.display.get_windows()

# Recording
recording = sandbox.recording.start(name="my-recording")
# ... do stuff ...
sandbox.recording.stop(recording.id)
sandbox.recording.download(recording.id, "output.mp4")

# Cleanup
sandbox.close()
client.close()

Environment

Computer() reads these environment variables when explicit values are not passed:

USE_COMPUTER_API_KEY=mk_live_...
USE_COMPUTER_BASE_URL=https://api.use.computer

USE_COMPUTER_BASE_URL is optional. The default is https://api.use.computer.

Async

from use_computer import AsyncComputer

client = AsyncComputer(api_key="mk_live_...")
sandbox = await client.create()
img = await sandbox.screenshot.take_full_screen()
await sandbox.close()
await client.close()

Local Gateway

from use_computer import Computer

client = Computer(
    api_key="sk-local",
    base_url="http://localhost:8080",
)

Backward Compatibility

The original import path still works:

from mmini import Mmini

New code should prefer:

from use_computer import Computer

Publishing

CI publishes use-computer from the main branch. The first release is 0.0.1; after that the workflow reads the latest vX.Y.Z tag and bumps the patch version.

For CI, prefer PyPI Trusted Publishing. If using an API token instead, set a repo secret named PYPI_API_TOKEN; do not commit tokens to .env.

Development

uv run --group dev pre-commit install

Pre-commit runs ruff format, ruff check --fix, and ty check.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

use_computer-0.0.1.tar.gz (72.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

use_computer-0.0.1-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

Details for the file use_computer-0.0.1.tar.gz.

File metadata

  • Download URL: use_computer-0.0.1.tar.gz
  • Upload date:
  • Size: 72.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for use_computer-0.0.1.tar.gz
Algorithm Hash digest
SHA256 0ba5456f2e374b657fa956224e775a085b6db4e14ff5e7b7caea6e423a114e85
MD5 d7ceacb3ba6ae77ff1928e9f61d68457
BLAKE2b-256 a87c37e3cb0b4c71e3ec47611da9533541bb09ee9ae7904057b1f5cdae7a4a46

See more details on using hashes here.

File details

Details for the file use_computer-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: use_computer-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 33.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for use_computer-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 85c832b0b39483a8a9adf200f8aee3a037f59577b6822a34e59fcfa9ea98c5b3
MD5 f2a9492a45c744b67bc54f0ccf388b0c
BLAKE2b-256 f5dd995e6d9d2db0523f139fc67c21257c63685741e44f9ea663423c16a384ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page