latestOpenAPI 3.1.0MIT2026-08-0481194343.8 KB

f50d93b0d8a1

predict

Stateless action prediction

Send a screenshot + instruction; receive structured actions to execute on the target machine. Managed inference has a published 5-credit base plus the documented provider-visible trajectory-image, HD current/trajectory image, v1-engine, and combined system_prompt + trimmed instructions (>500 characters) surcharges. BYOK runs the complete harness on the selected Anthropic/OpenAI account, debits zero Coasty platform credits, and still returns real provider token usage and non-secret attribution. This is a direct CUA primitive: under a test Coasty key, provider-direct BYOK requires an explicit per-request X-LLM-Api-Key plus X-LLM-Provider and can bill that provider account. A body provider without the key header returns 422 LLM_KEY_NOT_CONFIGURED: Stored provider keys are unavailable for test API keys. Send X-LLM-Api-Key explicitly for direct BYOK. Test auth never resolves a stored live provider key. Task instruction is excluded from the managed prompt surcharge. Read effective deployed pricing from GET /v1/models under pricing.

post/v1/predict

Headers

Idempotency-Keystring

Optional client-supplied key (≤128 chars, [A-Za-z0-9_-:]) for safe retries. Keys are global within one concrete API-key credential plus live/test mode; never reuse one on another endpoint. 'Same request' = a SHA-256 of an explicit operation discriminator plus the canonical (sorted-key) JSON body (session_id is folded in for /sessions/{id}/predict). LLM-capable operations also bind the non-secret effective provider, role models, and one-way provider-key fingerprint; plaintext provider keys never enter the hash or replay record. Replays the response for 24 h when operation, body, and effective execution identity match (X-Coasty-Idempotent-Replay: true and X-Credits-Charged: 0). Action screenshot pixels are response-only and deliberately omitted from replay storage; a replay retains frame_id but returns screenshot=null and observation_available=false. Inference replays also set body usage.credits_charged=0 and usage.billed=false; machine-snapshot bodies retain the original gross charge for auditability. A retry while the original is still running waits up to ~25 s then returns the result, otherwise 409 IDEMPOTENCY_IN_FLIGHT (retry with the SAME key). Returns 422 IDEMPOTENCY_KEY_REUSED if any bound input differs. Rotating the API key starts a new replay namespace. Collect a lost result via GET /v1/idempotency/{key} using the original credential.

X-LLM-Provider'anthropic' | 'openai'

BYOK: which provider the X-LLM-Api-Key belongs to (anthropic | openai). Required whenever X-LLM-Api-Key is sent — a key without a provider is a 422 LLM_PROVIDER_UNSUPPORTED. With a live Coasty key, selecting BYOK runs the entire harness on your provider account with no platform fallback and zero Coasty inference credits. Under test auth, predict, ground, and session create require an explicit per-request X-LLM-Api-Key; a body provider without that header fails with 422 LLM_KEY_NOT_CONFIGURED because test auth never reads a stored live provider key. Session create fixes the explicit key for inherited predicts without inference. Managed-mode Tasks, Workflows, and schedules remain deterministic sandbox executions; BYOK intent on them fails before execution with 422 LLM_PROVIDER_UNSUPPORTED. They never decrypt or require a stored provider key and make no provider call.

X-LLM-Api-Keystring

BYOK provider credential supplied on this request. Lifecycle depends on the operation: predict/ground use it for that call; session create retains a fixed owner-process copy for inherited predicts; Run/Workflow creation snapshots it encrypted until terminal state; schedule create uses it only to validate the current stored key and persists no credential. It requires an effective anthropic/openai provider; combining it with body llm.provider='managed' is 422. Under live auth, immediate operations prefer this header over a stored key. Schedules fire without headers, so the header key must match the stored key and each fire resolves the current stored key. Never logged or echoed. With a test Coasty key, explicit BYOK is provider-direct only for the direct CUA flow: POST /v1/predict, POST /v1/ground, POST /v1/sessions, and POST /v1/sessions/{id}/predict. Predict, ground, and session create require this explicit per-request header plus X-LLM-Provider; body llm.provider without it returns 422 LLM_KEY_NOT_CONFIGURED (Stored provider keys are unavailable for test API keys. Send X-LLM-Api-Key explicitly for direct BYOK.) and test auth never reads or uses a stored live provider key. Session create fixes the explicit key for inherited session predicts but makes no inference call; predict, ground, and session predict can call and bill Anthropic/OpenAI. Managed-mode test Tasks, Workflows, and schedules remain deterministic sandbox. Supplying BYOK headers or provider metadata to them returns 422 LLM_PROVIDER_UNSUPPORTED (BYOK is unavailable for synthetic test runs, workflows, and schedules. Use managed mode or a live Coasty API key.) before execution. They never decrypt or require a stored provider key and do not call or bill Anthropic/OpenAI. Keep provider secrets out of sandbox and CI requests; use a live Coasty key for real asynchronous execution.

X-LLM-Modelstring

BYOK model selection for this operation (equivalent to body llm.model). Sessions retain it for inherited predicts, Runs/Workflows snapshot it, and schedules persist the non-secret selection for later fires. Defaults: claude-sonnet-5 (anthropic), gpt-5.6-sol (openai). The same 1-256-character model-id syntax applies; invalid ids return 422 LLM_MODEL_INVALID. The provider can still reject an unknown or inaccessible model; it must be vision-capable.

Request body

instructionstring required

Natural-language task instruction. This task text is not counted toward the custom-prompt surcharge.

cua_version'v1' | 'v3' | 'v4' | 'v5'

v1 = baseline full pipeline. v3 = lean, v4 = autonomous, v5 = latest/default. For managed stateless predict, v3/v4/v5 share the low-latency single-call planner; sessions, runs, workflows, and BYOK predictions use the selected full engine. Inspect GET /models managed_stateless_predict_mode.

model'default' nullable

Managed model alias. For BYOK model selection use llm.model.

system_promptstring nullable

Optional custom prompt. Its full length plus trimmed instructions determines the custom-prompt surcharge; exactly the discovered threshold is free.

instructionsstring nullable

Optional appended guidance. Its trimmed length plus system_prompt determines the custom-prompt surcharge; task instruction is excluded.

screen_widthinteger nullable

Omit to use the screenshot's true size (measured server-side); no longer defaults to 1920.

screen_heightinteger nullable

Omit to use the screenshot's true size (measured server-side); no longer defaults to 1080.

max_actionsinteger
toolsstring[] nullable
include_reasoningboolean
include_raw_codeboolean

Response

Predicted actions.

request_idstring required
actionsActionResponse[] required— unresolved $ref
raw_codestring[]
reasoningstring
status'continue' | 'done' | 'fail' required

Authoritative model loop-control claim. done means the model believes the observed state or the proposed step outcome satisfies the instruction; it may coexist with mutating actions and is not proof of persistence. Execute only admitted actions, capture a fresh post-action screenshot, and verify application state before accepting business completion. fail ends the ordinary loop for this response.

cua_versionstring nullable

Echo: the CUA engine version that actually served this call (e.g. "v5").

screen_widthinteger

Echo: the width the server actually used — the coordinate space the returned (x, y) are in.

screen_heightinteger

Echo: the height the server actually used — the coordinate space the returned (x, y) are in.