API keys, scopes, and the prepaid USD wallet explained
Most API providers let you generate a single key and start calling endpoints. In Coasty, keys are scoped to specific permissions and tied to a prepaid USD wallet. This lets you control who can start task runs, access vision actions, or provision machines. If you try to call an endpoint without the right scope or enough credits, you get a clear error instead of a silent failure.
API keys and authentication
All Coasty endpoints require an API key. You can send it as the header X-API-Key or as an Authorization Bearer token. The key is read from the COASTY_API_KEY environment variable in your code. This keeps keys out of source control and lets you rotate them safely from the dashboard.
- ●Base URL: https://coasty.ai/v1
- ●Auth header: X-API-Key: <key> or Authorization: Bearer <key>
- ●Environment variable: COASTY_API_KEY (never hardcode)
- ●Keys are generated at https://coasty.ai/developers/keys
# List your runs to verify authentication and show current wallet balance.
curl -s https://coasty.ai/v1/runs \
-H "X-API-Key: $COASTY_API_KEY" | jqScopes gate what a key can do
Keys can have one or more scopes. Scopes control access to specific resources and operations. Missing a required scope results in a 403 INSUFFICIENT_SCOPE error. Common scopes include run, vision, machine, and webhook. Check the scopes of a key on the keys page before you deploy to production.
- ●run: start, cancel, and resume task runs
- ●vision: call /v1/predict, /v1/ground, and /v1/parse
- ●machine: provision, start, stop, and snapshot cloud VMs
- ●webhook: receive Server-Sent Events and webhook payloads
Prepaid USD wallet explained
Coasty uses a prepaid USD wallet, not a postpay model. One credit equals one cent of USD. You add funds and then spend credits as you call endpoints. The wallet is consumed by task runs, vision actions, and other operations. Checking your balance and recent activity helps you spot unexpected usage early.
- ●Wallet: prepaid USD with 1 credit = $0.01
- ●Task runs: $0.05 per agent step
- ●Vision: POST /v1/predict costs $0.05 per call
- ●Sessions: POST /v1/sessions costs $0.10, then $0.04 per predict call
- ●Grounding: POST /v1/ground costs $0.03
- ●Parse: POST /v1/parse is free
# Example: start a task run and monitor its events.
import os
import requests
import json
from time import sleep
cURL = os.environ.get("COASTY_API_KEY")
url = "https://coasty.ai/v1/runs"
headers = {"X-API-Key": cURL, "Content-Type": "application/json"}
payload = {
"machine_id": None,
"task": "Open Chrome, navigate to coasty.ai, and click the Developers link",
"cua_version": "v4",
"max_steps": 30,
"deadline_seconds": 300,
"on_awaiting_human": "pause"
}
resp = requests.post(url, headers=headers, json=payload)
resp.raise_for_status()
run = resp.json()
run_id = run["id"]
print("Run ID:", run_id)
# Poll events until the run finishes
stream_url = f"https://coasty.ai/v1/runs/{run_id}/events"
resp = requests.get(stream_url, headers=headers, stream=True)
for line in resp.iter_lines():
if line:
print(line.decode())Scopes gate permissions and the prepaid wallet tracks spend per credit.
Where this beats brittle automation
Traditional automation relies on brittle locators like CSS selectors, XPath, or hardcoded IDs. If a UI changes, your script breaks. A computer use agent sees the screen like a human and can adapt to new layouts, dynamic text, and unexpected UI shifts. Scopes let you limit an agent to specific actions, and the prepaid wallet gives you precise control over costs per task. This combination lets you build reliable workflows that survive UI changes without constant rework.
Start building workflows with scoped keys and your prepaid balance. Try starting a task run with a vision task, or use the MCP server from Cursor or Claude Desktop. Get your API key at https://coasty.ai/developers.