Give AI agents the ability to use cryptocurrency
npm install @agenti/sdk @pump-fun/pump-sdk @pump-fun/pump-swap-sdk @pump-fun/agent-payments-sdkCapabilities documented in this repository.
See the full documentation for details.
See the full documentation for details.
See the full documentation for details.
See the full documentation for details.
See the full documentation for details.
See the full documentation for details.
Install it, then run your first command.
npm install @agenti/sdk @pump-fun/pump-sdk @pump-fun/pump-swap-sdk @pump-fun/agent-payments-sdk
| Command | Runs |
|---|---|
npm run build | pnpm -r build |
npm run dev | pnpm -r --parallel dev |
npm run test | pnpm -r test |
npm run typecheck | pnpm -r typecheck |
Taken directly from this repository's documentation.
1. Agent sends request
GET https://api.example.com/data
2. Server responds with payment requirements
HTTP/1.1 402 Payment Required
Content-Type: application/json
{
"x402Version": 1,
"accepts": [{
"scheme": "exact",
"network": "base-mainnet",
"maxAmountRequired": "1000000", // 1 USDC (6 decimals)
"payTo": "0x...",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", // USDC on Base
"maxTimeoutSeconds": 300
}]
}
3. Agenti signs an EIP-3009 transferWithAuthorization
(gasless — no ETH required, no transaction to wait for)
4. Agent retries with payment
GET https://api.example.com/data
X-Payment: <base64-encoded signed authorization>
5. Facilitator verifies signature and settles on-chain
HTTP/1.1 200 OK
{ "data": "..." }SOLANA_PRIVATE_KEY=<your-key> npx tsx examples/01-buy-a-coin.tsANTHROPIC_API_KEY=sk-... SOLANA_PRIVATE_KEY=<key> npx tsx examples/03-agent-buys.ts