Automate Any Desktop App With the Coasty Computer Use API
Most desktop automation tools rely on brittle selectors or closed APIs that break when the UI changes. You spend days maintaining XPath, class names, or proprietary SDKs. The Coasty computer use API flips that by giving you an AI agent that sees the screen and acts like a human. You send a task, the agent captures screenshots, predicts actions, and clicks, types, and scrolls until the job is done. This is a computer use agent that drives real desktops, browsers, and terminals, not just API calls.
How it works
The Coasty computer use API uses a model trained to simulate human computer use. You describe a goal in natural language and the agent plans a sequence of actions to achieve it. Internally the system captures a base64 screenshot, sends it to /v1/predict with an instruction and cua_version, and receives a list of actions. It then executes those actions (clicks, keypresses, window management) and repeats until the task is finished. For stateful workflows you can create a session via /v1/sessions ({"machine_id": "..."}) and then call /v1/sessions/{id}/predict to keep the trajectory in memory across steps. The model also supports /v1/ground to map an element description to specific x,y coordinates if you need low-level precision.
#!/usr/bin/env bash
# Example: Run a short desktop task with the Coasty computer use API
# Prerequisites: export COASTY_API_KEY=your_key_here
API_KEY=$(cat "$HOME/.coasty_key" 2>/dev/null || echo "$COASTY_API_KEY")
if [ -z "$API_KEY" ]; then
echo "Error: COASTY_API_KEY environment variable or ~/.coasty_key not set."
exit 1
fi
# POST a task run and stream events until success or failure
# Billed $0.05 per agent step
curl -sS https://coasty.ai/v1/runs \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d ' {
"machine_id": "virtual-desktop-1",
"task": "open a browser window, navigate to coasty.ai/docs, and close the browser",
"cua_version": "v3",
"max_steps": 20,
"deadline_seconds": 120,
"on_awaiting_human": "pause"
}' \
--no-buffer | while IFS= read -r line; do
echo "$line"
doneBilling and limits
- ●A prepaid USD wallet where 1 credit equals $0.01.
- ●Task runs are billed $0.05 per agent step.
- ●Session-based predict calls are $0.04 per call and $0.10 per session.
- ●Vision predict calls cost $0.05 per call.
- ●Ground calls to map description to coordinates are $0.03 per call.
- ●Parsing pyautogui code into structured actions via /v1/parse is free.
- ●Rate limits and scopes are enforced at the API key level.
- ●Idempotency-Key headers make retries safe to replay.
A task run is billed $0.05 per agent step and streams events until the agent succeeds, fails, or cancels.
Why computer use beats brittle automation
Traditional automation tools require you to hardcode XPaths, CSS selectors, or proprietary SDKs. Every UI change means refactoring your scripts. With Coasty you describe what you want in natural language. The agent understands layout, context, and intent, so it adapts when the UI shifts. You can automate entire workflows across multiple apps, browsers, and terminals without maintaining fragile selectors. This is especially valuable for enterprise apps with inconsistent documentation or custom UI frameworks where closed APIs are unavailable.
You now have a practical path to automate any desktop app using the Coasty computer use API. Start by exporting COASTY_API_KEY and sending a POST to /v1/runs with a machine_id and a task. Monitor events via the stream to see the agent in action. Build workflows that run on any OS, any browser, or any terminal. Want a key and full docs, head to https://coasty.ai/developers.