Building checkout bots with classic APIs is brittle. We inspect a page, look for specific IDs, then POST to endpoints that may not exist or change frequently. When a button moves by a few pixels or a layout shifts, you rewrite selectors or hit an error. The Coasty Computer Use API lets you automate these flows by driving real desktops and browsers with vision and actions instead of brittle selectors. You send a screenshot and an instruction, the agent sees the screen, plans actions, and clicks, types, and scrolls until the flow succeeds. This post shows how to automate a form fill and checkout with the real API endpoints, prices, and a working Python example.
How it works
The Computer Use API uses a simple loop. You take a screenshot (base64), send a prediction request with an instruction and a cua_version, and get back actions like click, type, and scroll. You execute those actions on the target app, capture a new screenshot, and repeat until the status is done. For a full agent that manages memory and state, you start a session with POST /v1/sessions, then POST /v1/sessions/{id}/predict inside the loop. The API bills $0.04 per predict call after the session is created. The vision model sees the UI as a human would, so it can adapt to layout changes, dynamic fields, and inline validation.
import os
import base64
import requests
import json
API_KEY = os.environ.get("COASTY_API_KEY")
BASE_URL = "https://coasty.ai/v1"
# Capture the screenshot as base64
with open("checkout_page.png", "rb") as f:
screenshot_b64 = base64.b64encode(f.read()).decode()
headers = {
"Authorization": f"Bearer {API_KEY}",
"Content-Type": "application/json"
}
def predict_action(session_id, instruction):
url = f"{BASE_URL}/sessions/{session_id}/predict"
payload = {
"screenshot": screenshot_b64,
"instruction": instruction,
"cua_version": "v3"
}
resp = requests.post(url, headers=headers, json=payload)
resp.raise_for_status()
return resp.json()
# Start a session and begin the loop
session_resp = requests.post(
f"{BASE_URL}/sessions",
headers=headers,
json={"cua_version": "v3"}
)
session_resp.raise_for_status()
session_id = session_resp.json()["id"]
actions = []
while True:
result = predict_action(session_id, "Fill the form and complete checkout")
actions.extend(result.get("actions", []))
if result.get("status") == "done":
break
# Execute actions on the target app (mock here)
for act in result.get("actions", []):
print("Action:", act)
print("Completed actions:", actions)Key fields and pricing
- POST /v1/sessions creates a stateful session and returns an id. Billing starts after the first predict call on that session.
- POST /v1/sessions/{id}/predict takes a screenshot (base64), instruction, and cua_version ("v3" or "v4"). It returns actions and a status field ("running" or "done").
- You pay $0.04 per predict call after session creation. The session itself has no separate charge.
- Use a loop: capture, predict, execute, repeat until status is done.
Use a session and loop predict until the status is done, billed $0.04 per prediction.
Where this beats brittle automation
Classic automation relies on CSS selectors, XPath, or fixed DOM paths. If a page reorders fields or adds a wrapper, the selector breaks and you need a new mapping. With Computer Use, the agent sees the rendered UI. It can click the correct button even if the class name changes or the button moves by a pixel. It can type into any input based on context, scroll if content is hidden, and handle inline validation messages. This means you do not need to maintain a mapping for every variant of the form. The same agent can handle different stores, regions, or dynamic layouts without rewriting selectors. It also works on desktop apps and terminals where there is no DOM, just a pixel surface to interpret.
Next steps
- Set up a machine with POST /v1/machines to get a cloud VM where your agents run.
- Use POST /v1/runs to let the server drive an agent to completion with a verifier.
- Define workflows with POST /v1/workflows to chain tasks, asserts, and retries.
- Integrate with MCP to run Coasty from Cursor, Claude Desktop, or other clients.
Automating form filling and checkout flows is easier when you can see and act like a human. The Coasty Computer Use API gives you a session-based loop with vision and actions, priced at $0.04 per prediction. Build agents that work across browsers, desktop apps, and terminals without brittle selectors. Get your API key at https://coasty.ai/developers and start building.
Want to see this in action?
View Case Studies