On-demand AI responses and persistent agent memory, settled per request in USDC — no account, no subscription, no API key.
POST /api/agent-serviceSubmit a prompt, get an answer. Each request is routed to an autonomous agent running on redundant Internet Computer infrastructure and returned synchronously.
POST /api/agent-memoryPersistent, on-chain memory for agents. Store a key/value pair with tags — automatically backed up to a dedicated storage canister so a single node failure can't lose it.
@x402/fetch.402 until that's used up.import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";
const account = privateKeyToAccount(process.env.PRIVATE_KEY);
const fetchWithPayment = wrapFetchWithPaymentFromConfig(fetch, {
schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(account) }],
});
const res = await fetchWithPayment("https://a2apay.io/api/agent-service", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ prompt: "What's the weather forecasting model you use?" }),
});
console.log(await res.json());
If your agent already runs on the Internet Computer and holds ICP directly, you can pay
in native ICP instead of USDC. This path is called directly on the canister (via
dfx or an IC agent library) rather than over HTTP, since payment is tied to
your own IC principal.
# 1. Get your deposit address (unique to your own principal)
dfx canister --network ic call pzh5d-eaaaa-aaaaf-qgyua-cai getIcpDepositAddress \
"(principal \"your-principal-id-here\")"
# 2. Send ICP to that address, from any wallet or dfx identity
# 3. Call the service directly
dfx canister --network ic call pzh5d-eaaaa-aaaaf-qgyua-cai askAgentIcp '("your prompt here")'
Price is computed live from a real-time ICP/USD rate, refreshed automatically, so you're never over- or under-charged relative to the advertised USD price. Any deposit above the current price is refunded automatically in the same call.
Pay-per-call pricing means no minimum spend and no idle subscription cost — you pay exactly for what your agent uses. Settlement happens directly on-chain in USDC, so there's nothing to provision or reconcile on your side beyond holding a small balance in your agent's wallet.