Getting started with Agentgates: from a first request to leaving

Agentgates sells infrastructure and services for AI swarms: confidential and plain virtual machines (CVMs and VMs), AI inference, phone numbers and calls, email inboxes and more, paid in USDC over x402. This page is the path an agent takes, in order: the way in, a free first request, paying, signing account calls, the limits, and how to leave.

Nothing on this page is a price; every price is read live at https://agentgates.ai/pricing. The machine index is https://agentgates.ai/llms.txt and the API spec https://agentgates.ai/openapi.json.

The same page as Markdown: /getting-started.md

  1. 1. The way in: no signup
  2. 2. A first request, free
  3. 3. Pay over x402
  4. 4. Sign account calls
  5. 5. The limits
  6. 6. Leave

1. The way in: no signup

There is no sign-up form, no email check, no card and no person in the path. Pick one of two ways in; both are built for software.

  • No account: pay per request. Machines, models, the payphone and directory listings sell to any wallet that holds USDC on Base, Polygon or Solana. The wallet that pays owns what it bought, and only that wallet reads or controls it.
  • An account, in one command: npm i -g @agentgates/cli, then agentgates init. It makes twelve words and a key on this machine, and prints a login key (agk_…, shown once). The account holds a prepaid USDC balance that pays for inboxes, numbers, texts, call minutes and memory.

Keep the twelve words: they are the account, on any machine (agentgates init --seed "<twelve words>"). Your person can take the account over on the site with Log in, then Restore from a recovery phrase, or on the same computer with agentgates receive.

Testing Agentgates for a directory that grades it? Its test agent takes a starting balance once with POST https://api.agentgates.ai/api/account/starter, signed by the account and by the agent's own Web Bot Auth key; any other caller is refused.

2. A first request, free

Nothing below charges anything. A request with no payment header is priced and stopped, never run and never charged, so you can ask for a quote as often as you like.

# The machine plans, each with live prices per network
curl -s https://api.agentgates.ai/api/compute/catalog | jq '.plans[] | {id, vcpu, memoryMb, diskGb}'

# The exact price of one hour on the first plan: the 402 is the quote
PLAN=$(curl -s https://api.agentgates.ai/api/compute/catalog | jq -r '.plans[0].id')
curl -s -X POST https://api.agentgates.ai/api/compute/deployments \
  -H 'content-type: application/json' \
  -d "{\"plan\":\"$PLAN\",\"hours\":1,\"image\":\"nginx:alpine\"}" \
  | jq '.accepts[] | {network, maxAmountRequired, payTo}'

# The models, in the standard chat format's list
curl -s https://api.agentgates.ai/api/inference/v1/models | jq -r '.data[].id'

# The directory of paid APIs: search it with no key
curl -s 'https://api.agentgates.ai/api/directory/resources?q=weather&limit=5'

Every price, read live: https://agentgates.ai/pricing. Without jq, drop the pipes and read the JSON.

3. Pay over x402

  1. Send the request with no payment header.
  2. The answer is HTTP 402 with one offer per network: the amount in USDC atomic units, the asset and the address to pay. x402 v2 clients read the PAYMENT-REQUIRED header, v1 clients the accepts body.
  3. Sign that exact amount as an EIP-3009 transfer authorization.
  4. Send the same request again with the signature in PAYMENT-SIGNATURE (v2) or X-PAYMENT (v1). The answer carries the work and the settlement.
// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPaymentFromConfig } from '@x402/fetch';
import { ExactEvmScheme } from '@x402/evm';
import { privateKeyToAccount } from 'viem/accounts';

const API = 'https://api.agentgates.ai';
const catalog = await (await fetch(`${API}/api/compute/catalog`)).json();
const plan = catalog.plans[0].id;

const account = privateKeyToAccount(process.env.EVM_PRIVATE_KEY);
const pay = wrapFetchWithPaymentFromConfig(fetch, {
    schemes: [{ network: 'eip155:8453', client: new ExactEvmScheme(account) }],
});

// Reads the 402, pays the amount it names on Base, sends the request again.
const res = await pay(`${API}/api/compute/deployments`, {
    method: 'POST',
    headers: { 'content-type': 'application/json' },
    body: JSON.stringify({ plan, hours: 1, image: 'nginx:alpine', port: 80 }),
});
console.log(res.status, await res.json());

The same script with a dry run that pays nothing: https://github.com/agentgates-ai/agentgates/blob/main/examples/buy-a-vm.mjs. Models are bought the same way at POST https://api.agentgates.ai/api/inference/chat, and the payphone at POST https://api.agentgates.ai/api/booth.

A retry after a timeout is safe: send the same signed payment to the same endpoint and you get back what it already bought, charged once. Never sign a new payment to retry a call that may have gone through.

Paying from a balance instead of per request: top up once, then mint a key per agent. ag_ keys spend a prepaid inference balance (POST https://api.agentgates.ai/api/inference/keys), agc_ keys a prepaid compute balance (POST https://api.agentgates.ai/api/compute/keys); a key can never spend more than the balance holds.

4. Sign account calls

Account calls (inboxes, numbers, calls, memory, the balance) take one of two credentials. There is no session and no token to refresh.

  • A login key: Authorization: Bearer agk_<64 hex>, the part of the key before the dot. agentgates init prints one; mint more by name with agentgates keys, each opening only the sections it needs.
  • A signature: X-Wallet-Auth: base64({"address","timestamp","nonce","signature"}), where signature is an EIP-191 personal_sign over METHOD\npath\nnonce\ntimestamp. The timestamp is unix seconds and each nonce is used once.
# pip install eth-account requests
import base64, json, os, secrets, time, requests
from eth_account import Account
from eth_account.messages import encode_defunct

ORIGIN = "https://api.agentgates.ai"
Account.enable_unaudited_hdwallet_features()
agent = Account.from_mnemonic(os.environ["AGENTGATES_PASSWORDS_SEED"])

def call(method, path, body=None):
    nonce, now = secrets.token_hex(16), int(time.time())
    signed = agent.sign_message(encode_defunct(text=f"{method}\n{path}\n{nonce}\n{now}"))
    sig = "0x" + signed.signature.hex().removeprefix("0x")
    auth = base64.b64encode(json.dumps({"address": agent.address, "timestamp": now, "nonce": nonce, "signature": sig}).encode()).decode()
    r = requests.request(method, ORIGIN + path, json=body, headers={"X-Wallet-Auth": auth})
    return r.status_code, r.json()

print(call("GET", "/api/account/balance"))

From a terminal the CLI signs for you: agentgates browser balance proves you are in and prints the address that tops the balance up. Every account call, with its refusals: https://api.agentgates.ai/api/account/docs. How each lane authenticates: https://agentgates.ai/auth.md.

5. The limits

  • Nothing is served on credit. Sends, texts and call minutes draw from the prepaid balance, and an empty balance refuses.
  • A model request is priced at the most it can cost before a token is generated: the prompt and max_tokens bound it, and the payment or the balance must cover that ceiling, or the answer is 402.
  • What a plan holds (inboxes, numbers, sends a day, memory) is in the catalog: GET https://api.agentgates.ai/api/account/catalog.
  • A 503 that names its seconds (retryInSeconds, startingInSeconds) is a wait, not a refusal: sleep them and call again.
  • A plain machine can answer 503 at_capacity: try again later, or take a confidential plan.
  • Each lane's agent docs list its refusals by their codes: https://api.agentgates.ai/api/compute/docs, https://api.agentgates.ai/api/inference/docs, https://api.agentgates.ai/api/account/docs.

6. Leave

Nothing an agent buys through this API renews by itself, so there is nothing to cancel. A machine stops when its paid time ends unless you turned auto-renew on; plans for inboxes, numbers, memory and logins are windows of 30 or 365 days paid in advance, and none renews on its own.

Every path below is on https://api.agentgates.ai, signed by the account, or for a machine by the wallet that owns it.

  1. Stop what runs. Turn auto-renew off with DELETE /api/compute/deployments/{id}/auto-renew, or destroy the machine now with DELETE /api/compute/deployments/{id}; destroying it also ends pay as you go, and its remaining hours end with it.
  2. Revoke every key: POST /api/account/keys with {"revoke":"<id>"} for login keys, and the same body on POST /api/inference/keys and POST /api/compute/keys for the lane keys. A revoked key answers 401 at once.
  3. Delete what you stored: a memory file with POST /api/memory/files/{id}/delete, a saved login with POST /api/passwords/{id}/delete, a permit with POST /api/passwords/permits/{id}/revoke. An inbox that never sent can be released with DELETE /api/inboxes/{id}.
  4. Spend the balance or leave it: it never expires and is not refundable.
  5. Delete the account: POST /api/account/delete with {"confirm":"<your address>"}, signed by the account (never a key). It removes the account's personas, its proven email and its name, and revokes every key it minted, so each answers 401 from then on.
  6. Delete the twelve words and the key file (~/.agentgates/passwords-key.json) from every machine that holds them. With no words, nothing can sign as the account again.

What stays on our side: the record of what the account paid, and its balance until the words come back.