# Compute: computers for AI swarms, confidential or plain

Two kinds of machine, bought the same way:

- Confidential VM, every plan but the plain ones: for agents that hold keys, money or private data. Memory encrypted while it runs (Intel TDX), the host cannot read it, and a remote-attestation quote anyone checks shows what it runs. Trading agents with wallet keys, agents with API secrets, agents working on private data.
- Plain VM, `compute.vm.standard` or `compute.vm.pro` (`"proof": "none"` on its card): for agents with nothing secret on them, for much less. Its own IP and any port. No proof: its host can read its disk, its memory and its env values. Scrapers, crawlers, bots on public data, test runs.

For trading swarms, research, data and backtesting swarms, and agents that
serve their own APIs: one dedicated machine per agent, running your Docker
workload, paid in USDC over x402. No signup, no API key: the paying wallet
owns the deployment and is the only identity. A swarm buys one machine per
agent wallet, or draws many machines from one prepaid balance (below).
A sealed sandbox shares its confidential VM with other sandboxes, each walled off from the others; for a confidential VM of your own, buy a machine plan. Sealed sandboxes are sold by the minute (below).

Everything else we sell (AI models, phone numbers, inboxes and more), each with its price now and the call that buys it: `GET https://api.agentgates.ai/api/products`.

## What's new

- 2026-11-22, Cache marks on AI calls: Issue: a cache_control mark on a message part was dropped. Now: on the open tier a text part may carry cache_control {"type":"ephemeral"}, and a call that starts the same within five minutes is answered sooner at the cached rate.
- 2026-11-21, Solana tokens in batch and the MCP: Issue: agentgates batch and the wallet MCP moved only SOL and USDC on Solana. Now: batch legs, propose_swap, propose_send and wallet://balances take any Solana token by symbol or mint, and a thin market or unverified token asks to confirm.
- 2026-11-19, Solana tokens in the wallet CLI: Issue: the wallet CLI swapped and sent only SOL and USDC on Solana. Now: swap and send take any Solana token by symbol or mint, a thin market or unverified token raises an alert to confirm, and balance lists them.

All of it: https://api.agentgates.ai/changelog.json (JSON Feed) or https://api.agentgates.ai/changelog.xml (Atom).

## Notices

Agentgates tells your wallet what it should know: a machine about to stop, stopped, about to be deleted, deleted or failed; a payment refused for lack of USDC; offers picked from what it bought; and the news. One way: there is nothing to answer.

- In every compute answer: `notices` (`count`, the newest `items`, `more`) and the header `Agentgates-Notices`. A signed or paid call carries your wallet's own; a call that names no wallet carries the news.
- Inbox: `GET https://api.agentgates.ai/api/notices`, signed with `X-Wallet-Auth` as an owner read is (the path signed without its query). Newest first; `after=<id>` for what came after a notice you have, `before=<id>` to page back, `unread=1`, `limit` up to 100.
- Mark read: `POST https://api.agentgates.ai/api/notices/read` with `{"upTo":"<id>"}` or `{"ids":["<id>"]}`, signed.
- Live: `GET https://api.agentgates.ai/api/notices/stream`, signed, Server-Sent Events: unread first (or what came after `Last-Event-ID`), then each new one within 5 seconds. Reconnect when it closes; 2 open at most per wallet.
- Webhooks: `POST https://api.agentgates.ai/api/notices/webhooks` with `{"url":"https://..."}`, signed, answers an `id` and a `secret`, shown once. Each notice is POSTed as JSON with `webhook-id`, `webhook-timestamp` and `webhook-signature`: `v1,` and the base64 HMAC-SHA256 of `id.timestamp.body`, keyed with the secret's bytes after `whsec_` (Standard Webhooks). Tried again after 1 m, 5 m, 30 m, 2 h and 6 h; 24 hours of failures pause it. `GET` lists yours, `DELETE https://api.agentgates.ai/api/notices/webhooks/{id}` removes one; 3 at most.
- The news alone: https://api.agentgates.ai/changelog.json (JSON Feed) or https://api.agentgates.ai/changelog.xml (Atom).

## Plans (live prices — reread before paying)

- `compute.starter` — 1 vCPU, 2 GB RAM, 20 GB disk, TEE (Intel TDX): from $0.128/hour. Prepay 1-720 hours. 100 GB egress included.
  Per hour by how many hours ONE payment buys, per network:
    `base`: 1h $0.135/hr · 6h $0.129/hr · 24h $0.128/hr · 720h $0.128/hr
    `polygon`: 1h $0.137/hr · 6h $0.129/hr · 24h $0.128/hr · 720h $0.128/hr
    `solana`: 1h $0.135/hr · 6h $0.129/hr · 24h $0.128/hr · 720h $0.128/hr
  By the quarter-hour, one payment, per network:
    `base`: 15 min $0.04 · 30 min $0.071 · 45 min $0.103
    `polygon`: 15 min $0.042 · 30 min $0.074 · 45 min $0.106
    `solana`: 15 min $0.039 · 30 min $0.071 · 45 min $0.103
- `compute.standard` — 2 vCPU, 4 GB RAM, 40 GB disk, TEE (Intel TDX): from $0.255/hour. Prepay 1-720 hours. 250 GB egress included.
  Per hour by how many hours ONE payment buys, per network:
    `base`: 1h $0.267/hr · 6h $0.257/hr · 24h $0.255/hr · 720h $0.255/hr
    `polygon`: 1h $0.27/hr · 6h $0.257/hr · 24h $0.255/hr · 720h $0.255/hr
    `solana`: 1h $0.267/hr · 6h $0.257/hr · 24h $0.255/hr · 720h $0.255/hr
  By the quarter-hour, one payment, per network:
    `base`: 15 min $0.077 · 30 min $0.14 · 45 min $0.204
    `polygon`: 15 min $0.079 · 30 min $0.142 · 45 min $0.206
    `solana`: 15 min $0.076 · 30 min $0.14 · 45 min $0.203
- `compute.pro` — 4 vCPU, 8 GB RAM, 80 GB disk, TEE (Intel TDX): from $0.509/hour. Prepay 1-720 hours. 500 GB egress included.
  Per hour by how many hours ONE payment buys, per network:
    `base`: 1h $0.532/hr · 6h $0.513/hr · 24h $0.51/hr · 720h $0.509/hr
    `polygon`: 1h $0.534/hr · 6h $0.513/hr · 24h $0.51/hr · 720h $0.509/hr
    `solana`: 1h $0.532/hr · 6h $0.513/hr · 24h $0.51/hr · 720h $0.509/hr
  By the quarter-hour, one payment, per network:
    `base`: 15 min $0.15 · 30 min $0.277 · 45 min $0.405
    `polygon`: 15 min $0.153 · 30 min $0.28 · 45 min $0.407
    `solana`: 15 min $0.15 · 30 min $0.277 · 45 min $0.404
- `compute.vm.standard` — 2 vCPU, 4 GB RAM, 40 GB disk, plain VM, no proof: from $0.02/hour. Prepay 1-720 hours. 29.555 GB of data out included per hour bought.
  A plain virtual machine: your compose runs as given at the machine's own address, any port, TCP or UDP, with no confidential proof (its host can read its disk and memory), in Europe. Your env values travel in its start-up data. It takes a new setup or new env values while it runs (`POST /api/compute/deployments/{id}/update`, as on a confidential plan): we keep them sealed only until the machine fetches them at the restart this brings, then drop them; its host can read them on the machine, as it can its first setup. It pauses (`POST /api/compute/deployments/{id}/stop`): its disk and its address are kept and the machine itself is deleted, its paid time paying what keeping them costs; `POST .../start` makes it again on the same address with the same disk, using up an hour of its paid time (its host bills the machine made again a whole hour). `stop.secondsAtStart` is the paid time a start gives now; it is kept while that covers a start and 15 minutes after it, at most 72 hours (`stop.deleteAt`). It resizes to another plain size while it runs (`POST /api/compute/deployments/{id}/resize`), its disk kept: its time left converts at the new size, less what its host bills for the change (an hour at the larger size's rate and, growing, an hour of the difference; `GET` the same path shows the time each size leaves), and once resized it keeps nothing past its paid end. It pays as it goes by the hour (`"pocket"` on the create or a renewal, as on a confidential plan): its first hour is a new machine's price, and each hour after it a renewed hour's, `extra.paygHourMicro` on each network of the 402, the amount the later hours are signed for. It gets an https name of ours on port 443, its certificate made inside the machine, in front of the first TCP port your compose publishes (or the one "aliasTarget": "service:port" names); "alias": false, a compose publishing 443 or one on the machine's own network keeps 443 yours and the name without https. A new machine's first payment carries one more hour, the hour it is deleted in, which its host bills whole. When its paid time ends it stops, is kept until that hour ends, then is deleted with its disk. Its use policy: no crypto mining, no scanning, attacks, open relays or forged source addresses, no spam, nothing unlawful; its host sees its traffic and reports breaches to us, a reported machine can be cut off the network or deleted with its paid time not refunded, and outbound mail ports 25 and 465 are closed (587 is open). The whole policy: https://agentgates.ai/terms#plain-vms.
  Per hour by how many hours ONE payment buys, per network:
    `base`: 1h $0.042/hr · 6h $0.024/hr · 24h $0.021/hr · 720h $0.02/hr
    `polygon`: 1h $0.044/hr · 6h $0.024/hr · 24h $0.021/hr · 720h $0.02/hr
    `solana`: 1h $0.042/hr · 6h $0.024/hr · 24h $0.021/hr · 720h $0.02/hr
  By the quarter-hour, one payment, per network:
    `base`: 15 min $0.027 · 30 min $0.032 · 45 min $0.037
    `polygon`: 15 min $0.029 · 30 min $0.034 · 45 min $0.039
    `solana`: 15 min $0.027 · 30 min $0.032 · 45 min $0.037
- `compute.vm.pro` — 4 vCPU, 8 GB RAM, 80 GB disk, plain VM, no proof: from $0.03/hour. Prepay 1-720 hours. 29.555 GB of data out included per hour bought.
  A plain virtual machine: your compose runs as given at the machine's own address, any port, TCP or UDP, with no confidential proof (its host can read its disk and memory), in Europe. Your env values travel in its start-up data. It takes a new setup or new env values while it runs (`POST /api/compute/deployments/{id}/update`, as on a confidential plan): we keep them sealed only until the machine fetches them at the restart this brings, then drop them; its host can read them on the machine, as it can its first setup. It pauses (`POST /api/compute/deployments/{id}/stop`): its disk and its address are kept and the machine itself is deleted, its paid time paying what keeping them costs; `POST .../start` makes it again on the same address with the same disk, using up an hour of its paid time (its host bills the machine made again a whole hour). `stop.secondsAtStart` is the paid time a start gives now; it is kept while that covers a start and 15 minutes after it, at most 72 hours (`stop.deleteAt`). It resizes to another plain size while it runs (`POST /api/compute/deployments/{id}/resize`), its disk kept: its time left converts at the new size, less what its host bills for the change (an hour at the larger size's rate and, growing, an hour of the difference; `GET` the same path shows the time each size leaves), and once resized it keeps nothing past its paid end. It pays as it goes by the hour (`"pocket"` on the create or a renewal, as on a confidential plan): its first hour is a new machine's price, and each hour after it a renewed hour's, `extra.paygHourMicro` on each network of the 402, the amount the later hours are signed for. It gets an https name of ours on port 443, its certificate made inside the machine, in front of the first TCP port your compose publishes (or the one "aliasTarget": "service:port" names); "alias": false, a compose publishing 443 or one on the machine's own network keeps 443 yours and the name without https. A new machine's first payment carries one more hour, the hour it is deleted in, which its host bills whole. When its paid time ends it stops, is kept until that hour ends, then is deleted with its disk. Its use policy: no crypto mining, no scanning, attacks, open relays or forged source addresses, no spam, nothing unlawful; its host sees its traffic and reports breaches to us, a reported machine can be cut off the network or deleted with its paid time not refunded, and outbound mail ports 25 and 465 are closed (587 is open). The whole policy: https://agentgates.ai/terms#plain-vms.
  Per hour by how many hours ONE payment buys, per network:
    `base`: 1h $0.062/hr · 6h $0.036/hr · 24h $0.032/hr · 720h $0.03/hr
    `polygon`: 1h $0.064/hr · 6h $0.036/hr · 24h $0.032/hr · 720h $0.03/hr
    `solana`: 1h $0.062/hr · 6h $0.035/hr · 24h $0.032/hr · 720h $0.03/hr
  By the quarter-hour, one payment, per network:
    `base`: 15 min $0.04 · 30 min $0.047 · 45 min $0.054
    `polygon`: 15 min $0.042 · 30 min $0.049 · 45 min $0.057
    `solana`: 15 min $0.039 · 30 min $0.047 · 45 min $0.054

## Sealed sandboxes

A small Linux computer for one agent, in a confidential VM (Intel TDX), bought
by the minute. A sealed sandbox shares its confidential VM with other sandboxes, each walled off from the others; for a confidential VM of your own, buy a machine plan.

- `compute.sandbox.s` (Sandbox S): 512 MB of memory, 2 GB of disk, bursts to 1 vCPU. a minute $0.012, 10 minutes $0.032, 30 minutes $0.078, an hour $0.146

Prices by the cheapest network, read now; any whole number of minutes from
1 is sold, the same law over any length.

### Buy

`POST https://api.agentgates.ai/api/compute/deployments` with
`{"plan": "compute.sandbox.s", "minutes": 10, "image": "python"}` (or `"hours"`), paid
as every create is: its free 402, then the same request with `X-PAYMENT`,
or from a prepaid balance (`X-Wallet-Auth` signed by the wallet or by a
signing API key, or a compute key as `Authorization: Bearer`). The image is
`base`, `python` or `node`. `"count"` buys 2 to 10 in one payment, each opened by the same
openers. A sandbox plan takes no `compose`, `env`, `aliasTarget`,
`pocket` or `ai`.

When a host has a free seat it answers 201 with `"status": "running"` and a
`sandbox` object, when the paid call answers (over x402 that call waits for
the payment to settle, about 6 seconds on Base): `id`, `api` (its own
address), `proof` and `tlsPin` (the key its door serves,
`sha256//<base64>`; its proof's statement names the same key). When none has
a seat it answers 202 and waits for one: about two minutes after its payment
when a host must start for it, longer when many wait at once. A purchase that
waits for a host to start also carries that host's start, 192 seconds of its
plan's cost: its 402 says the price. Its paid time
starts when it runs; read `GET https://api.agentgates.ai/api/compute/deployments/{id}`, signed by
the paying wallet or its signing API key, until it does (with a compute key,
the list, `GET https://api.agentgates.ai/api/compute/deployments`, which the key reads). Its
answers carry `openWith`, `openRule` and `apiKey`.

### What opens it

You choose, in `"openWith"`, one, two or all three:

- `wallet`: the owner wallet signs at its door (`X-Wallet-Auth`).
- `apiKey`: a signing API key signs there as a wallet does; `"apiKey"`
  names its public half (default: the key that signed the purchase).
- `password`: `Authorization: Bearer <password>` at its door; send
  `"accessKeyHash"`, its sha256 (64 lowercase hex).

`"openRule"`: `any` (default), one of them opens it; `all`, every one on
each call (one signature per signer in `X-Wallet-Auth`, comma-separated,
each with its own nonce, and the password). With no `"openWith"` it opens
with the paying wallet, the signing API key that signed the purchase, and the
password when `"accessKeyHash"` came. A compute key (`agc_`) never opens
a sandbox: we see it on every call, so a purchase with one sends a password's
hash or names a signing API key. Nothing of ours opens it or changes what
does; its statement names its openers (`opens`, below). A choice that
contradicts itself is refused before any money, never a purchase that names
none.

### Sign with a signing API key

Make the key where your agent runs; its secret never leaves it. Node
(`npm i bs58`):

```
import crypto from 'node:crypto'; import bs58 from 'bs58';
const seed = Buffer.from(process.env.AGS.slice(4), 'hex'); // AGS = 'ags_' + 64 hex, e.g. crypto.randomBytes(32)
const key = crypto.createPrivateKey({ key: Buffer.concat([Buffer.from('302e020100300506032b657004220420', 'hex'), seed]), format: 'der', type: 'pkcs8' });
const address = bs58.encode(crypto.createPublicKey(key).export({ format: 'der', type: 'spki' }).subarray(12));
const sign = (text) => crypto.sign(null, Buffer.from(text), key).toString('base64');
const auth = (method, path, nonce = crypto.randomBytes(16).toString('hex'), timestamp = Math.floor(Date.now() / 1000)) =>
  Buffer.from(JSON.stringify({ address, timestamp, nonce, signature: sign(`${method}\n${path}\n${nonce}\n${timestamp}`) })).toString('base64');
// register once, signed by the wallet: {"signer": address, "proof": sign(`agentgates-signing-key:v1|${wallet}|${address}`)}
// then X-Wallet-Auth: auth('POST', '/api/compute/deployments'), or at its door auth('POST', new URL(api + '/exec').pathname)
```

Python (`pip install pynacl base58`):

```
import base64, json, os, secrets, time, base58
from nacl.signing import SigningKey
key = SigningKey(bytes.fromhex(os.environ["AGS"][4:]))  # AGS = "ags_" + secrets.token_hex(32)
address = base58.b58encode(bytes(key.verify_key)).decode()
sign = lambda text: base64.b64encode(key.sign(text.encode()).signature).decode()
def auth(method, path):
    nonce, ts = secrets.token_hex(16), int(time.time())
    return base64.b64encode(json.dumps({"address": address, "timestamp": ts, "nonce": nonce, "signature": sign(f"{method}\n{path}\n{nonce}\n{ts}")}).encode()).decode()
```

Register it with `POST https://api.agentgates.ai/api/compute/keys` (API keys, above). Never send
`ags_` anywhere: sent to us it is refused; revoke it and make another.

### Use it at its own address

Every call goes to `api`, straight to the confidential VM that hosts it,
never through us: `POST {api}/exec` (`cmd` or `shell`, answered with its exit
code, output and a receipt it signed; a stream with `Accept: text/event-stream`;
`"background": true` answers a pid for `GET {api}/processes/{pid}`),
`GET`/`PUT`/`DELETE {api}/files/<path>` (a folder as a tar with
`application/x-tar`), `PUT {api}/env` for secret values, `GET {api}` for
its status. Each call carries what opens it: `X-Wallet-Auth` signed by the
wallet or the signing API key over
`<METHOD>\n<path>\n<nonce>\n<timestamp>` (the path without its query),
`Authorization: Bearer <password>`, or under `all` every one of them. A
refusal says what it opens with, never an address. Outbound internet is open; nothing reaches
it from outside. A caller may also seal each body to its statement's
`sealKey` and get the answer sealed back (the CLI always does). These calls
as OpenAPI, under its host: `https://api.agentgates.ai/openapi-sandbox.json`.

### Check its proof

`GET {api}/proof?nonce=<hex>` is public. Four checks: Intel's certificate
chain on its quote; its boot record (the event log) replays to the quote's
RTMR3 and names the app id its address names and a compose hash; that hash is
under `sandboxHosts` in https://agentgates.ai/api/public/cvm-approved, for the
host version the statement names; and the quote's report data is
`SHA-512("agentgates/sandbox/statement/v1" || root)` with the root rebuilt
from the statement's leaf (`SHA-256(0x00 || its JSON, keys sorted)`) and its
path, your nonce signed by the statement's `receiptKey`, the statement naming
this sandbox, `ownerHash` = `SHA-256("agentgates-sandbox-owner:v1|" + the
wallet, an EVM one lowercased)` and the `tlsKey` its door serves. Its
`opens` is `{rule, with}`, `with` the sorted hex of
`SHA-256("agentgates-sandbox-opener:v1|" + sandbox id + "|signer|" + address)`
for each signer (an EVM one lowercased) and
`"|password|" + the password's sha256`: exactly what you chose. Every
receipt is that key's Ed25519 signature over
`agentgates-sandbox-receipt:v1|` and the receipt's JSON, keys sorted.
`agentgates sandbox verify <id or api>` runs all four with a nonce of yours.

### Renew and delete

`POST https://api.agentgates.ai/api/compute/deployments/{id}/renew` with `"minutes"`: any wallet may
pay, the minutes go on the end of its paid time. It is sold until 60 seconds
before its end, and not while it waits for its host. At its paid second the
sandbox ends with its disk: nothing is kept.
A `compute.ending` notice goes 2 minutes before. It does not stop, start, resize or take a new setup;
delete it with `DELETE https://api.agentgates.ai/api/compute/deployments/{id}`, signed by its owner.

### Recipes

By the CLI (`npm i -g @agentgates/cli`, then `agentgates init` for the key
that pays and owns; every body sealed, its proof checked first, every
receipt checked):

```
agentgates sandbox create --plan compute.sandbox.s --minutes 10 --image python --max-usd 0.05 --yes
agentgates compute keys create --signing --name my-agent
agentgates sandbox create --plan compute.sandbox.s --minutes 10 --open-with key,password --open-rule all --key ags_... --max-usd 0.05 --yes
agentgates sandbox exec <id> -- python3 -c 'print(6 * 7)'
agentgates sandbox cp ./app <id>:/work/app
agentgates sandbox cp <id>:/work/out.txt ./out.txt
agentgates sandbox verify <id>
agentgates sandbox rm <id>
```

By curl, with a password (TLS pinned to its key; curl checks no proof and
seals nothing, the CLI does):

```
SECRET=$(openssl rand -hex 32)
HASH=$(printf %s "$SECRET" | shasum -a 256 | cut -d' ' -f1)
# the create, with "openWith": ["password"], "accessKeyHash": "$HASH", paid as above; its answer's sandbox gives API and PIN
curl -sk --pinnedpubkey "$PIN" -H "Authorization: Bearer $SECRET" -H 'content-type: application/json' \
  -d '{"cmd": ["python3", "-c", "print(6 * 7)"]}' "$API/exec"
curl -sk --pinnedpubkey "$PIN" -H "Authorization: Bearer $SECRET" -T app.py "$API/files/work/app.py"
curl -sk --pinnedpubkey "$PIN" -H "Authorization: Bearer $SECRET" "$API/files/work/out.txt" -o out.txt
curl -sk --pinnedpubkey "$PIN" "$API/proof?nonce=$(openssl rand -hex 16)"
```

The delete is signed by the owner's wallet (`X-Wallet-Auth`, above), never
by a signing API key.

Prices are read from the catalog at request time: `GET https://api.agentgates.ai/api/compute/catalog`.

## Why buying more hours at once is cheaper per hour

Every payment costs us one on-chain settle, and that fee is the same whether
you buy one hour or seven hundred. So the price you are quoted is
`(machine cost + settle fee ÷ hours this payment buys) × margin`, and buying
more hours in a single payment carries less of the fee per hour. The fee is
read from live gas at the moment you ask, never a constant, so the quote moves
with the chain. Every `402` carries the exact number you will pay.

The settle costs a different amount on each chain, so THE PRICE IS PER
NETWORK: every entry of the `accepts` array carries its own
`maxAmountRequired`, and a network is offered only where its own price
clears its own minimum. What another chain's gas is doing never moves the
price on yours.

Pay-as-you-go works the same way: each draw is one settle, so a bigger grain
is cheaper per hour than an hourly one. Grains on offer are in
`GET /api/compute/catalog` under `payg.grainChoicesHours`, and each plan's
`pricing` array is the full ladder.

## By the quarter-hour

On every plan but GPU, a create or a renewal may send `"minutes": 15`, `30`
or `45` in place of `"hours"`. It is the same price law for a payment
that buys a quarter of an hour: `(machine cost for those minutes + settle
fee + a new machine's boot and stop) × margin`, so a quarter-hour costs more
per hour than an hour does. A renewal carries no boot and stop. The clock
starts when the machine runs, renewals stack on its end, and a balance draw
works the same way. A wallet short of USDC for the time asked gets a 402
that asks, on its network, for the most time it can pay for, down to 15
minutes, and so does its next request; paying it buys that time. Each plan's
`minutesPricing` in the catalog carries these prices per network.

## Buy in one pass

1. `POST https://api.agentgates.ai/api/compute/deployments` with JSON
   `{"plan": "<plan id>", "hours": <int>, "compose": "<docker-compose.yml as a string>", "env": {"KEY": "value"}, "name": "optional"}`
   (`"image": "nginx:alpine"` may replace `compose` for a one-container run;
   it publishes host port 8080 in front of the container's port 80, or
   `"port": <n>` for a different one. Your own `compose` must publish a port
   too — a container that publishes nothing has no address, and the machine
   runs and bills with no way to reach it. The endpoint is the published HOST
   port: `https://{appId}-8080.{gateway}`.)
2. The reply is `402` with an `accepts` array (x402, scheme `exact`).
   Networks offered: `base` (USDC 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913, pay to 0x90eb67757bed72a825b45f4b50828a635474cab0), `polygon` (USDC 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359, pay to 0x90eb67757bed72a825b45f4b50828a635474cab0), `solana` (USDC EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v, pay to A8QmYWssCDVHRJRfYgKY1H7EgzG6XJWNKim2YbzAEkcv).
3. Sign an EIP-3009 `TransferWithAuthorization` for `maxAmountRequired`
   USDC to `payTo` (EIP-712 domain in `extra`), and retry the same POST with
   `X-PAYMENT: base64({"x402Version":1,"scheme":"exact","network":"<network>","payload":{"signature":"0x…","authorization":{"from","to","value","validAfter","validBefore","nonce"}}})`.
   On a `solana` leg, build a transaction of exactly
   [ComputeBudget SetComputeUnitLimit, ComputeBudget SetComputeUnitPrice,
   spl-token `TransferChecked` of `maxAmountRequired` USDC (`asset`, 6
   decimals) to `payTo`'s associated token account, optional Memo], set the
   fee payer to `extra.feePayer` (you pay no SOL — we co-sign that seat and
   broadcast), sign it as the token owner, and retry with
   `X-PAYMENT: base64({"x402Version":1,"scheme":"exact","network":"solana","payload":{"transaction":"<base64 partially-signed tx>"}})`.
   Your own wallet must never be the fee payer, and the fee payer may not
   appear in any instruction's accounts. Sign against a FRESH blockhash —
   the payment is only good for ~60 seconds.
   On Solana the same price can be paid in SOL instead, for every compute payment: the entry
   whose `extra.token` is `SOL` (its `asset` is `So11111111111111111111111111111111111111112`, SOL's
   address) asks `maxAmountRequired` lamports, priced at
   `extra.usdPerSol` (`extra.usd` is the price in dollars). Build the same
   transaction with instruction 2 a System Program `Transfer` of those
   lamports from your wallet to `payTo`; the fee payer is still
   `extra.feePayer`. Keep the rent minimum (about 0.00065 SOL) in your
   wallet after paying. The rate is read again at settlement, so a payment
   within 3% of the lamports asked buys what it was asked for.
   With "ai" the SOL entry pays two accounts: send `extra.payToLamports`
   to `payTo` and `extra.alsoLamports` to `extra.alsoPayTo` (the AI
   part), as two System Program transfers in the same transaction.
4. Settlement is confirmed on-chain, then your machine provisions:
   `202 {"deploymentId", "status": "provisioning", ...}`. Poll
   `GET /api/compute/deployments/{id}` until `status: "running"`: your
   app answers then, and `endpoint` and `attestation` are live. Until
   then the read carries `boot` (While it boots, below). The clock starts
   when the machine is up (`runningAt`), not at payment.

x402 v2 works too: every `402` also carries a `PAYMENT-REQUIRED` header
(CAIP-2 networks), and the retry may send `PAYMENT-SIGNATURE` instead of
`X-PAYMENT`. The official client (`@x402/fetch` on `@x402/core` 2.x) refuses
any payment over $1 by default: for more hours, a larger plan or a balance
rung over $1, raise its cap, e.g. `wrapFetchWithPaymentFromConfig(fetch,
{ schemes, spendControls: { maxAmountPerPayment: "$50" } })`.

Your env var VALUES are sealed to the machine's enclave key and never stored;
if a first provision attempt has to be retried by the worker, the retry runs
without them, so keep secrets re-settable (an update with `{"env": {…}}`
alone sets them again) or bake them into your compose.
With `"image"`, its one container gets every env value (empty when the
worker had to make the machine again); your own compose passes each to its
services as `NAME: ${NAME}`.

## Many machines in one payment

Add `"count": <n>` (2 to 10) to the create to buy that many machines
with one setup in one payment. The 402 asks for that many times one
machine's price on each network, and its description says how many
machines. Each machine is its own, as if bought alone: its own
`deploymentId`, address, clock, controls and renewal. The answer is
`202 {"count", "deployments": [...]}`, each entry as a single create
answers it; read each with `GET /api/compute/deployments/{id}`. The same
payment sent again lists every machine it bought. A balance pays for them the
same way. A wallet short of USDC for all of them gets a 402 that asks, on its
network, for the most of them it can pay for, and so does its next request;
paying it buys those. `count` is sold without `ai` and `pocket`.

## While it boots

Until it reads `running`, the read carries `boot`:

- `phase`: `placing` (the machine is being made), `booting`, `disk`
  (its encrypted disk), `keys`, `gpu`, `network` (its address),
  `containers` (your images pulled and started), then `app`: the machine
  is up and your app has not answered yet.
- `startedAt` and `seconds`: when this start began (the sale, or the
  restart, update, resize, start or renewal that started it again) and the
  seconds since; `phaseSince` when it is known.
- `failure`: `{"code", "reason"}` in plain words. `room` and `create`:
  the machine could not be made yet and is tried again at no cost to you;
  `image` (an image could not be pulled or started), `env` (its env
  values could not be opened), `cpus` (a service asks for more CPUs than
  the plan has), `gpu`, `stalled` (its start stopped moving), `boot`.
- `readsRunningBy`: in phase `app`, when it reads `running` whether or
  not your app answered.

The machine is up, and its paid time runs, once its boot is done. It reads
`running` once your app answers: when a service's `healthcheck` asks for
an `http://localhost` URL on a port that service publishes (a `curl -f` or
`wget` of it), once that same URL answers under 400 through the machine's
address; otherwise once its `endpoint` answers HTTP at all (any status).
Any other check (a command, a port not published) is not seen from outside.
One that has not answered 10 minutes after the machine came up (came up
again, after a restart) reads `running` anyway. After a restart,
an update, a resize or a start it reads `provisioning` with `boot` again
until your app answers. A stopped machine starting keeps `status: "stopped"`
with `stop.starting`, and carries `boot` too. A Direct machine reports no
phase between `booting` and `app`. If your setup cannot run (an image name that
does not exist, for example), the read says so at once in `boot.failure`,
and the machine closes as `failed` with the reason in `killReason`.

## AI in the same payment

Add `"ai": {"usd": 5}` to the create, with 1, 5, 25 or 100 dollars. The
`402` then asks for the machine's price plus exactly those dollars, on every
network: the AI part rides the machine's own settle, so it carries no fee of
its own. Paying it buys three things at once:

1. the machine, as without `ai`;
2. an AI balance of those dollars for the paying wallet, the same balance
   `POST https://api.agentgates.ai/api/inference/credits` sells: it never expires, is not
   refundable, and stays when the machine is deleted;
3. one fresh key on that balance, put into the machine's env before it is
   sealed, as `AGENTGATES_API_KEY` (or the variable `"ai": {"usd": 5, "env": "NAME"}`
   names). A compose reads it as `${AGENTGATES_API_KEY}`; with `"image"`, the
   one container gets it. Its secret exists only in the machine, and this key
   is revoked when the machine is deleted (a key you mint yourself is yours
   to revoke).

The machine's software then calls `https://api.agentgates.ai/api/inference/v1` in the standard
chat format with `Authorization: Bearer $AGENTGATES_API_KEY`. Each call draws that
balance, then the paying wallet's account balance if it holds one. The `202`
answer carries `ai`: the dollars added, the balance, the env name and the
key's id and prefix. The key is listed with your keys
(`GET https://api.agentgates.ai/api/inference/keys`, signed) and revoked with
`POST https://api.agentgates.ai/api/inference/keys` `{"revoke": "<id>"}`.

- Over x402 only. A create paid from a prepaid compute balance cannot buy an
  AI balance and answers `400 ai_needs_x402`; leave out `ai` to buy from
  the balance, then top up AI on its own.
- Not with pay-as-you-go (`pocket`): buy hours up front.
- If your env already has the key's name, the create answers `400 bad_ai`:
  your value is never overwritten. Leave it out, or name ours with `ai.env`.
- A wallet holding its most AI keys answers `409 too_many_keys` before
  anything is charged. A payment sent again is answered with
  the machine it bought. One spent with no machine made for it (its request
  died, or the chain took it after we gave up) is never charged again: its AI
  balance lands by itself, and you write to support@agentgates.ai with the
  payment for the machine.
- An update that sends `env` replaces all of it, the key included: mint a key
  (`POST https://api.agentgates.ai/api/inference/keys`, signed) and send it in that env.
- If our worker has to make the machine again, it starts without env values,
  the key included (as every env value): the answer says so, and you mint a
  key and send it in env, with your image or compose, to
  `POST https://api.agentgates.ai/api/compute/deployments/{id}/update`.

## Pay as you go (the agent loop)

On a plan whose `minHours` is 1 you never have to prepay a block. The
billing grain is one hour
(a config value — reread this page, not a cached copy), and renewals extend
from the clock's current end. So the
minimal always-on loop is:

1. Buy 1 hour (`"hours": 1` in the create above). The clock starts when
   the machine is up (`runningAt`).
2. Watch `expiresAt` on `GET /api/compute/deployments/{id}`.
3. Shortly before it passes, `POST /api/compute/deployments/{id}/renew`
   `{"hours": 1}` with a fresh x402 leg — the renewal stacks on the end of
   the clock, so renewing early never loses time.
4. Repeat. Stop paying and the machine stops at `expiresAt`; you owe
   nothing further, ever (nothing is postpaid). It then sits in `grace`
   (data kept, renew still works) for as long as it was paid for, at least
   an hour and at most 72 hours, before it is destroyed.

Each settle is an on-chain USDC transfer, so pay each hour right before it
starts and you are never ahead of your usage by more than the hour you are
in — and never behind it, because the machine only runs on settled time.

Humans get the same economics without running a loop: the dashboard's
pay-as-you-go allowance pre-signs one authorization per hour in a single
wallet ceremony (each valid only inside its own hour window, cancelable,
capped), and this API draws them on the same schedule. Agents do not need
it — the loop above is the whole contract. On a plain plan the
first hour is a new machine's price (it carries the hour its host bills when
it ends) and each later hour a renewed hour's: sign the later hours for
`extra.paygHourMicro` of the network you pay on (on Solana it sets the
allowance and the SOL hours too).

On Solana, pay-as-you-go in USDC is an allowance: send
`"pocket": {"capHours": <n>, "grainSeconds": <the served grain>}` with the
first hour's USDC payment, and put an `ApproveChecked` in the same
transaction, on the USDC account the first hour pays from, for
`extra.paygDelegate` of `extra.paygAllowance` (the hours after the
first). Each hour, right before it starts, one hour's worth is drawn from
that account. The pocket stops with the owner's DELETE; revoking the delegate
on your USDC account ends it on chain too.

In SOL there is no allowance, so you sign each later hour ahead. Send the
same `pocket` body and take the entry whose `extra.token` is `SOL`: it
asks the first hour in `maxAmountRequired` lamports, and
`extra.paygHours` later hours of `extra.paygHourLamports` each. For
each later hour open a nonce account of your own (System Program, 80 bytes,
its authority your paying wallet; its rent, about 0.00106 SOL, comes back
when you close it) and sign one transaction against that account's nonce:
instruction 0 `AdvanceNonceAccount`, then the two ComputeBudget
instructions, then a System Program `Transfer` of that hour's lamports
from your wallet to `payTo`; the fee payer is `extra.feePayer`. Send
them with the first hour's SOL payment as `"pocket": {"capHours": <n>,
"grainSeconds": <the served grain>, "transactions": [<base64>, ...]}`, one
per later hour. Each hour, right before it starts, that hour's transaction
is sent as you signed it. It moves exactly the lamports you signed, whatever
SOL is worth by then: it is sent while they are worth the hour's price
within 3% or more; if SOL has fallen further, it is not sent, the pocket
ends, and the machine runs to the end of its paid time. Stop with the
owner's DELETE, or on chain by advancing or closing a nonce account: its
hour can never be sent, and the pocket ends.

## If you lose the answer

A timeout or a dropped connection after you send `X-PAYMENT` is safe to retry.
Send the SAME `X-PAYMENT` to the SAME endpoint: the receipt is keyed by your
authorization's own nonce, so the retry returns the machine that payment
already bought, marked `"alreadyPaid": true`, and charges nothing. Never sign
a NEW authorization to retry a call that may have gone through.

If a payment is spent and we cannot match it to a receipt, you get
`409 payment_already_spent` instead of a fresh price. List your machines with
the owner call below to find what it bought.

## Prepay once, then buy many times

🚨 THIS IS A PREPAID BALANCE. You send USDC FIRST and spend it down; nothing
is loaned. Every pay-per-purchase call carries one on-chain settle; a balance
pays that settle ONCE, for the whole amount, and every machine or renewal
after it is a draw with no chain write.

1. `POST https://api.agentgates.ai/api/compute/credits` with `{"amountUsd": 5}` (`1`,
   `5`, `25` or `100`). The `402` asks for the amount plus the one
   delivering settle. Pay it like any purchase below.
2. From then on `POST /api/compute/deployments` or `.../renew` with
   `X-Wallet-Auth` (or an API key) and NO `X-PAYMENT` draws the balance —
   charged at the cheapest offered total, since a draw settles nowhere.
3. `GET https://api.agentgates.ai/api/compute/credits` reads the balance and ledger.
4. `POST https://api.agentgates.ai/api/compute/deployments/{id}/auto-renew` lets the
   balance renew a machine by itself before its paid time ends (Lifecycle,
   below).

A balance never expires, is not refundable, is per wallet and never
transferable. A balance short of a purchase answers the ordinary `402`.
Egress top-ups still pay per purchase for now.

## API keys (optional, for software that cannot sign wallet messages)

The wallet stays the only account. A compute key (`agc_…`, distinct from
inference's `ag_…`) is a bearer handle the wallet mints on its own prepaid
balance:

- `POST https://api.agentgates.ai/api/compute/keys` with `X-Wallet-Auth` and
  `{"name": "my-agent"}` — mints; the answer carries the secret ONCE.
- `GET https://api.agentgates.ai/api/compute/keys` with `X-Wallet-Auth` — active keys.
- `POST https://api.agentgates.ai/api/compute/keys` with `{"revoke": "<key id>"}` — kills
  a key instantly.

With `Authorization: Bearer agc_…` a key can: rent a machine and renew it
(draws on the balance), list the wallet's machines, and read the balance it
spends. It can NEVER destroy a machine, sign a payment, touch the wallet, or
list its sibling keys — the unspent balance is the most a leaked key can
spend, and Revoke ends it. Up to 20 active keys per wallet, one per agent.

A signing API key is never sent: it is an Ed25519 key pair your agent makes
where it runs (its secret `ags_` and the 64 hex of its seed stays there; we
hold its public half, 32 bytes in base58). Register it once, signed by the
wallet: `POST https://api.agentgates.ai/api/compute/keys` with
`{"name", "signer": "<public half>", "proof": "<base64 Ed25519 signature>"}`,
the proof the key's own signature over
`agentgates-signing-key:v1|<wallet>|<public half>` (an EVM wallet
lowercased). Then it signs as a wallet does (`X-Wallet-Auth`, its public
half as the address) and acts for the wallet as a bearer key does: draws,
lists, reads, renewals from the balance. A sealed sandbox can open with it
(Sealed sandboxes, below). It never deletes or makes keys. Sent as
`Bearer ags_…` it is refused: revoke it and make another.
`DELETE https://api.agentgates.ai/api/compute/keys` with `{"id"}` revokes either kind.

## Owner calls (read, destroy) and renewals

Reads and destroys are wallet-signed, no session. Header
`X-Wallet-Auth: base64({"address","timestamp","nonce","signature"})` where
`signature` is an EIP-191 personal_sign over the exact string
`METHOD\npath\nnonce\ntimestamp` (e.g. `GET\n/api/compute/deployments/abc\n<nonce>\n<unix seconds>`).
A Solana wallet signs the SAME string with its ed25519 key and sends
`signature` as base64 of the raw 64-byte signature, `address` base58.
Nonces are single-use; timestamps must be within the server skew. A read or
a control call signed by any other wallet answers `404` `not found for this
wallet: sign with the wallet that paid for the machine`.

- `GET /api/compute/deployments` — your deployments.
- `GET /api/compute/deployments/{id}` — status, endpoint, expiry, invoices,
  live TEE attestation.
- `POST /api/compute/deployments/{id}/renew` `{"hours": <int>}` — x402-gated.
  Any wallet may pay a renewal with `X-PAYMENT`; only the owner reads, controls
  or destroys the machine. A renewal drawn from a prepaid balance, or one that
  opens a pay-as-you-go allowance, comes from the owner. Extends `expiresAt`.
- `POST /api/compute/deployments/{id}/egress` `{"gb": <int>}` — x402-gated
  egress top-up. Egress is metered, never postpaid: at quota exhaustion the
  machine suspends (stopped, not destroyed) until a top-up lands. A top-up is
  ONE payment and therefore ONE settle, so the per-GB price falls with the
  size of the block, exactly like the hourly ladder; each plan's sizes are
  listed above. A plan that quotes no top-up price is not selling egress yet
  and this answers `503 egress_unpriced` rather than inventing a number.
- `DELETE /api/compute/deployments/{id}` — destroys the machine. Remaining
  hours die with it.

## Control your machine

The machine's own wallet signs each of these, the same `X-Wallet-Auth`
header as a read (POST, over the exact path). Nothing here takes a payment.

- `POST /api/compute/deployments/{id}/restart` — restarts a running machine.
  The clock runs on; it reads `provisioning` with `boot` until your app
  answers again.
- `POST /api/compute/deployments/{id}/stop` — stops a running machine and
  pauses its paid hours: the reply's `stop.pausedSeconds` is what is left. A
  stopped machine is kept 72 hours (`stop.deleteAt`),
  then deleted with its disk; a day before, we mail the address you proved on
  your account (`POST /api/account/email`). Renewing a stopped machine adds
  to its paused hours.
- `POST /api/compute/deployments/{id}/start` — starts it again. The paused
  hours run from the moment the machine is up (`stop.starting` while it boots).
- `POST /api/compute/deployments/{id}/resize` `{"plan": "<id>"}` — a new size.
  No payment and no refund: the time left converts at the new size's rate, so
  a bigger machine has fewer hours and a smaller one more. It restarts once.
- `POST /api/compute/deployments/{id}/update` `{"compose": "…"}` (or
  `{"image": "…", "port": 80}`) — a new setup on the same machine, optionally
  with `"env": {…}`. `{"env": {…}}` alone keeps the setup and changes the
  values only; values it already has change nothing and restart nothing (a
  keyed fingerprint of them tells us, never the values). The env you send is
  the machine's whole env: values are never stored, so send every value it
  should keep; a name you leave out is gone, and the answer names it.
  Without `"env"` it keeps its values. It restarts once and keeps its hours.

GPU machines run their block as started: no stop, resize or update. A
plain machine resizes only to another plain size, while it runs: what its
host bills for the change is used up (an hour at the larger size's rate and,
growing, an hour of the difference), and its disk stays as it is, so one made
with the larger disk does not move down. A plain machine's stop keeps its disk
and address and deletes the machine, its paid time paying their keep; its
start makes it again on that address and uses up an hour of its paid time
(`stop.secondsAtStart` says what a start gives now). A plain machine's new
setup reaches it at the restart it brings: we keep it sealed until then. A
pay-as-you-go machine stops its allowance before a stop or a resize. Your
logs stay inside your machine: we cannot read them, and neither can anyone else
without your app.

## Prove it to your own customers

Every deployment has a public, shareable verify page:
`GET https://api.agentgates.ai/compute/verify/{deploymentId}` — the machine's compose
hash, OS image hash, and Intel TDX hardware quote, rendered from the
attestation chain the TEE itself produces. No login, no wallet.

## Lifecycle

`provisioning → running` (the clock starts when the machine is up; it reads
`running` once your app answers) `→ grace` (past expiry: machine
stopped, data kept, renew still works) `→ destroyed` (past the grace
window: as long as the machine was paid for, at least an hour, at most
72 hours). A machine you stop sits in `stopped` with its hours paused, and is
destroyed 72 hours after the stop unless you start it. Grace is a ceiling, not a reservation: an expired machine may be
destroyed sooner when a paying buyer needs the capacity. Renew before expiry
if the disk matters. Prepaid time is revenue at purchase; there are no refunds, of
anything, ever. A provision failure after payment is retried at our cost —
your clock has not started.

Every answer about a machine (the read, the list, the create and renew
receipts, a control's answer) carries `lifecycle`: `paidUntil`, `stopsAt`,
`deleteAt`, `renew` (the call, and its price on each network and from a
prepaid balance), `start` on a machine you stopped, and `next`, the same
in words. An expired machine (`grace`) answers restart, start, stop, resize
and update with 409 `expired`: renew to start it again. A deleted machine
(`destroyed`) does not come back. When it was deleted because its time ran
out, or lost on our side, its renewal, restart or start answers a 402 priced
as a new machine of its plan (`lifecycle.replace`; not on GPU or Direct
plans, a plan no longer sold, or a machine that had a machine name; a machine
you stopped is replaced only from its owner's wallet): paying it makes a new
machine with its setup, the same image or compose, for the same owner, with
a new id and a new address, and the answer names it
(`replacement.deploymentId`). Its env values were sealed to the old machine
and never stored, so the new one starts with them empty unless the owner
pays with `"env": {…}` in the body. One new machine per deleted one: from
then on, renewing the old id renews the new machine, and a control of the
old id answers 409 `replaced` with its id (`lifecycle.replacedBy`). A
machine its owner deleted, or one deleted under our terms, answers a renewal
or a control with 409 `deleted`: when and why it went, and
`newMachine`, the create call for its plan at the price now. A machine
that never started (`failed`) answers 409 `failed` the same way.

A machine can renew itself from a prepaid balance:
`POST https://api.agentgates.ai/api/compute/deployments/{id}/auto-renew` with `{"hours": 1}`
(the plan's smallest when left out), signed by the wallet that pays
(`X-Wallet-Auth`; on your own machine, your compute key too). Shortly
before its paid time ends (`lifecycle.autoRenew.renewsAt` says when), the
hours are drawn from that wallet's balance at the renewal's price then, as
a signed renewal from the balance is. Any wallet may pay, as for a renewal:
a parent can keep its children's machines running from one balance. A
wallet other than the owner sets it only while its balance pays one
renewal, and takes over another wallet's setting only when that one's
balance no longer does. When the balance cannot pay, nothing is drawn and
the machine stops at the end of its paid time. An expired machine runs
again by a renewal, one you stopped by its start, and either renews itself
from there. `GET` reads it, `DELETE` ends it
(the paying wallet or the owner signs). `lifecycle.autoRenew` says who
pays, the price now and when the next renewal is drawn.

Kept hours: `POST https://api.agentgates.ai/api/compute/deployments/{id}/keep` with
`{"hours": 24}` keeps the machine stopped that much longer after its paid
time ends, beyond the window its paid hours keep it, at the disk's cost with
the plan's margin (about 23 kept hours for the price of one running hour).
The owner pays, by x402 or from its prepaid balance (signed, no
`X-PAYMENT`), at purchase or any time after; a machine past its window is
not sold more. `lifecycle.keptHours` and `deleteAt` count them, and a
renewal that brings the machine back uses up the hours its stop ran past the
paid window. Not sold on GPU or Direct plans.

## Rules

No SMTP egress, no mining pools, no inbound SSH exposure, no sanctioned
wallets (every settlement is screened), no attacking, scanning or flooding
other systems. We never look inside a machine: memory and disk are encrypted
in the TEE and we hold no key to them; your logs stay inside it. Before we
stop or delete a machine for breaking a rule, we mail the address proved on
your account with the reason (a machine attacking others right now is
stopped first and you hear at once). When paid hours end you get a mail too.
The full text: https://agentgates.ai/terms#machines
