When you send a task to the Coasty Computer Use API, each agent step costs $0.05. Network retries, client crashes, or misconfigured webhooks can cause duplicate POST requests. That means you pay twice for the same work. The API provides idempotency keys to make reserve-and-replay operations safe. This guide shows how to use them so you never double charge your account.
How idempotency works
Idempotency keys apply only to the 18 documented reserve-and-replay operations. If the same key is present on a subsequent request, the API returns the original response instead of creating a new resource. This prevents duplicate billing for those specific endpoints. Other endpoints that are not in the reserve list ignore the key. The header is case-insensitive. Use a stable value for each request you want to make idempotent, such as a UUID or a request fingerprint.
curl -X POST https://coasty.ai/v1/runs \
-H "Authorization: Bearer $COASTY_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
-d '{
"machine_id": "machine-123",
"task": "Open Chrome and navigate to https://example.com",
"cua_version": "v4",
"webhook_url": "https://your-domain.com/webhook"
}'
# If you retry this request with the same Idempotency-Key, the server returns the original run ID and status instead of creating a new one.Reserve-and-replay operations
- POST /v1/runs - create a task run, billed $0.05 per agent step.
- POST /v1/sessions - create a stateful trajectory session.
- POST /v1/sessions/{id}/predict - continue a session with a $0.04 call.
- POST /v1/predict - one-shot action prediction, billed $0.05.
- POST /v1/ground - map a screenshot to coordinates, billed $0.03.
- POST /v1/parse - free, turns pyautogui code into structured actions.
Use Idempotency-Key on POST /v1/runs, POST /v1/sessions, and POST /v1/predict to avoid duplicate charges.
Where this beats brittle automation
Traditional automation relies on brittle selectors, XPath, or hardcoded API calls that break when UI changes. The Coasty Computer Use API sees the screen and acts like a human. It handles dynamic layouts, popups, and non-API workflows without you maintaining fragile selectors. Idempotency lets you retry this human-like behavior safely without paying for the same steps twice.
Add Idempotency-Key to your run, session, or predict requests to guarantee you never double charge. Build reliable workflows that see the screen and act like a human. Get your API key at https://coasty.ai/developers.
Want to see this in action?
View Case Studies