https://compute.x402layer.cc/pods/v1. Auth: a compute API key (X-API-Key: x402c_...)
with pods:control:write (a sandbox runs commands) and spend, or a wallet signature.
Price: pay as you go, from your credits
A sandbox sleeps after 15 idle minutes and wakes on the next request in about 2 seconds, so a user
who works 2 hours a day costs about $0.72 + $1.50 = $2.22 a month. No monthly base fee.
Each sandbox: 2 vCPU, 4 GB memory, 12 GB disk.
1. Set your platform up (once)
GET /platform shows these, this month’s spend, and your live-sandbox limit (max_live, set by us:
ask to raise it).
Per-user overrides: PUT /platform/end-users/{end_user_id} with {"monthly_cap_usd": 25, "max_live": 3},
GET to read it with that user’s spend, DELETE to go back to the defaults.
2. Create a sandbox for one of your users
Idempotency-Keyis required: retry with the SAME key and you get the same sandbox, never a second charge.harness:claude-code,codex,opencode,pi.ai_mode:own_key(api_key; for OpenCode/Pi alsomodeland optionallybase_url, default OpenRouter) orown_login(Claude Code: the user signs in to their own Claude account in the terminal). The key stays on our side (the box gets a proxy token), but anyone using the sandbox can spend through it, so give each user their own.end_user_id: your id for the user (1 to 128 ofA-Z a-z 0-9 . _ : @ | + = -). Fixed for the sandbox’s life.tags: up to 16 string pairs, replaceable later withPATCH /sandboxes/{id}.
sandbox.ready webhook, or poll GET /sandboxes/{id}).
Refusals take no money: 402 spend_cap_reached (a cap), 402 insufficient_credits, 409 limit
(live-sandbox limit), 503 at_capacity (we are full: try again later).
3. List, read, change, delete
/pods/v1/pods/{id}/exec, /files, /ports, /keys.
4. Caps: what happens at the limit
- The next awake hour that would pass a cap is not charged: the sandbox goes on hold and sleeps
(
sandbox.cap_reached,billing.hold_reason=cap_platform,cap_end_userorinsufficient_credits). It will not wake while on hold. - If a day of disk cannot be paid, the sandbox is deleted after 7 days unless it is paid by
then (
billing.deletes_at, andsandbox.deletingjust before). - Raise the cap or add credits and the hold lifts by itself on the next wake.
5. Webhooks
Use the pod webhooks (POST /pods/v1/webhooks with your https URL; signed t=...,v1=... HMAC). Every
sandbox event carries data.end_user_id.
Missed one?
GET /pods/v1/events?after=<seq>.
6. Embed the terminal in your app
Your server asks for a short-lived link for one sandbox and gives it to that user’s browser:- Only your
embed_originsmay frame it. The page has no branding. - The token is for that one sandbox, terminal only, 60 s to 1 h (default 15 min). It sits in the URL fragment, so it never reaches a server log.
- Revoke every link for a sandbox:
POST /sandboxes/{id}/embed-token/revoke. This stops new connections; a terminal already open stays until it closes (after 10 idle minutes at most). - Your own terminal UI instead:
POST ticket_urlwithAuthorization: Bearer <token>(CORS open to yourembed_origins) returns{ws_url}: text frame{"cols":..,"rows":..}resizes, binary frames are the terminal’s input and output.
SDK snippets
TypeScript:Idempotency-Key for each new sandbox and the same one when you retry that request.)