Quickstart
In this guide you will install the agent SDK, create a client with your API key, and request your first metered payment.
1 · Install
Section titled “1 · Install”# private beta package — invite requirednpm i @allowkit/agent# or: bun add @allowkit/agent · pnpm add @allowkit/agent2 · Configure environment
Section titled “2 · Configure environment”ALLOWKIT_API_KEY=ak_live_...ALLOWKIT_AGENT_ID=researchbot-013 · Pay from an allowance
Section titled “3 · Pay from an allowance”import { AllowKit } from "@allowkit/agent";
const allowkit = new AllowKit({ apiKey: process.env.ALLOWKIT_API_KEY, agentId: "researchbot-01"});
// Request a metered payment. Resolves only if it passes// the agent's allowance + policy checks.const result = await allowkit.pay({ service: "risk-report-api", amount: "0.03", asset: "USDC", reason: "Fetch risk report"});
console.log(result.status); // "approved" | "blocked"If the payment is within the agent’s daily budget, under the max-per-payment cap, and the service
is approved, it settles in USDC on Solana. Otherwise it’s blocked and logged — your code receives
status: "blocked" instead of an uncontrolled charge.
{ "id": "pay_01JY6K6Y8F7P4B2S1Q8Z9R0M3N", "status": "approved", "amount": "0.03", "asset": "USDC", "service": "risk-report-api", "tx": "5xL...9Qp", "policyRevision": "polrev_18", "spentToday": "1.45", "createdAt": "2026-06-10T09:31:04Z"}{ "id": "pay_01JY6K7CMYV9J7R2BEED9F48A2", "status": "blocked", "reason": "service_not_approved", "message": "risk-report-api is not approved for researchbot-01", "policyRevision": "polrev_18"}Next steps
Section titled “Next steps”- Recipes for common integration tasks.
- Policy schema to see every field you can set.
- x402: Pay resources if the resource you’re calling returns
402 Payment Required.