You want agents that interact with real applications not via brittle selectors but by seeing the screen and acting like a human. Coasty gives you a computer use API that bills only when the agent sees or acts. This guide lists every endpoint, its request parameters, and its exact price so you can plan costs and avoid surprises.
Vision Endpoints
Vision lets the agent inspect a screenshot and generate actions. Each call costs a small amount and you can chain them until the agent reports done.
# Install jq for prettier JSON output
# Save your key in COASTY_API_KEY and run:
export COASTY_API_KEY="$(grep COASTY_API_KEY .env | cut -d= -f2)"
# POST /v1/predict costs $0.05
# Capture a screenshot, send it with an instruction, and read back actions
curl -s https://coasty.ai/v1/predict \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"screenshot": "$(base64 -w0 screenshot.png)",
"instruction": "Click the OK button in the dialog",
"cua_version": "v3"
}' | jq
# Loop until status is done, then capture again and predict again
while true; do
ACTIONS=$(curl -s https://coasty.ai/v1/predict \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"screenshot": "$(base64 -w0 screenshot.png)",
"instruction": "Click the OK button in the dialog",
"cua_version": "v3"
}' | jq -r .actions)
STATUS=$(curl -s https://coasty.ai/v1/predict \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"screenshot": "$(base64 -w0 screenshot.png)",
"instruction": "Click the OK button in the dialog",
"cua_version": "v3"
}' | jq -r .status)
echo "Actions: $ACTIONS, Status: $STATUS"
if [[ "$STATUS" == "done" ]]; then break; fi
doneStateful Sessions
- POST /v1/sessions costs $0.10 to create a session with trajectory memory.
- Each subsequent /v1/sessions/{id}/predict call costs $0.04.
- Responses include actions, status, and a session_id for later steps.
import base64, os, requests, json
API_KEY = os.getenv("COASTY_API_KEY")
BASE_URL = "https://coasty.ai/v1"
# create a stateful session (costs $0.10)
session_resp = requests.post(
f"{BASE_URL}/sessions",
headers={"X-API-Key": API_KEY},
json={"cua_version": "v3"}
)
session_resp.raise_for_status()
session = session_resp.json()
session_id = session["session_id"]
# read a base64 screenshot
with open("screenshot.png", "rb") as f:
screenshot = base64.b64encode(f.read()).decode()
# predict within that session (costs $0.04)
predict_resp = requests.post(
f"{BASE_URL}/sessions/{session_id}/predict",
headers={"X-API-Key": API_KEY},
json={
"screenshot": screenshot,
"instruction": "Click the OK button in the dialog",
"cua_version": "v3"
}
)
predict_resp.raise_for_status()
print(json.dumps(predict_resp.json(), indent=2))$0.10 per session creation, $0.04 per subsequent predict.
Grounding & Parsing
- POST /v1/ground costs $0.03. It maps a screenshot and element description to x,y coordinates.
- POST /v1/parse is free. It turns PyAutoGUI code into structured actions.
# POST /v1/ground costs $0.03
curl -s https://coasty.ai/v1/ground \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"screenshot": "$(base64 -w0 screenshot.png)",
"element_description": "OK button",
"cua_version": "v3"
}' | jq
# POST /v1/parse is free
curl -s https://coasty.ai/v1/parse \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"pyautogui_code": "pyautogui.click(500, 300)"
}' | jqTask Runs
- POST /v1/runs starts an autonomous agent. It costs $0.05 per agent step.
- The server drives the agent until it succeeds, fails, cancels, times out, or awaits a human.
- GET /v1/runs, GET /v1/runs/{id}, and POST /v1/runs/{id}/cancel let you inspect and control runs.
- GET /v1/runs/{id}/events streams Server-Sent Events with reconnect support via Last-Event-ID.
# POST /v1/runs costs $0.05 per step (charged per agent step)
curl -s https://coasty.ai/v1/runs \
-H "X-API-Key: $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"machine_id": "machine-123",
"task": "Open Chrome and navigate to cozy.ai",
"cua_version": "v3",
"instructions": "Do not close the browser",
"max_steps": 30,
"deadline_seconds": 300,
"webhook_url": "https://your-app.com/webhook",
"on_awaiting_human": "pause"
}' | jq
# GET /v1/runs lists all runs
curl -s https://coasty.ai/v1/runs \
-H "X-API-Key: $COASTY_API_KEY" | jq
# GET /v1/runs/{id} shows details
RUN_ID="run-abc123"
curl -s https://coasty.ai/v1/runs/$RUN_ID \
-H "X-API-Key: $COASTY_API_KEY" | jq
# POST /v1/runs/{id}/cancel
curl -s -X POST https://coasty.ai/v1/runs/$RUN_ID/cancel \
-H "X-API-Key: $COASTY_API_KEY" | jq
# POST /v1/runs/{id}/resume (if supported)
curl -s -X POST https://coasty.ai/v1/runs/$RUN_ID/resume \
-H "X-API-Key: $COASTY_API_KEY" | jq
# GET /v1/runs/{id}/events streams events
curl -s https://coasty.ai/v1/runs/$RUN_ID/events \
-H "X-API-Key: $COASTY_API_KEY"Workflows
- POST /v1/workflows, POST /v1/workflows/{id}/runs, and POST /v1/workflows/runs let you orchestrate runs with a versioned JSON DSL.
- Step types include task, assert, if, loop, parallel, human_approval, retry, succeed, and fail.
- Conditions are structured objects and variables use the double-brace format like {{inputs.x}} or stepId.field.
- Hard guards include budget_cents, max_iterations, and deadline_seconds.
- Task steps are billed $0.05 each.
Machines
POST /v1/machines provisions a cloud VM that the agent can start, stop, and snapshot. The agent runs on real desktops, browsers, and terminals, not only on API calls.
Billing & Keys
- Billing uses a prepaid USD wallet where 1 credit is $0.01.
- Keys use scopes to control permissions.
- Webhooks are HMAC signed with header Coasty-Signature: t=unix,v1=hex.
- Idempotency-Key provides replay safety only for the 18 documented reserve-and-replay operations when present on the original request.
- An MCP server lets you drive Coasty from Cursor, Claude Desktop, or other MCP clients.
Errors
All errors come as JSON with an error object that holds code, message, and request_id. Common HTTP codes include 401 for an invalid key, 402 for insufficient credits, 403 for insufficient scope, and 429 for rate limits.
Where this beats brittle automation
Traditional automation relies on brittle selectors, network mocks, and fixed endpoints. The Coasty computer use API lets agents see the actual screen and execute clicks, keystrokes, and navigation just like a human. This means you can automate real web apps, desktop tools, and terminals without rewriting selectors when UI changes. You pay per step and only when the agent actually observes or acts.
Ready to build agents that see and act on real desktops? Get your API key at https://coasty.ai/developers and start running task runs, workflows, and vision loops with predictable per-call costs.
Want to see this in action?
View Case Studies