Quick Start
Get started with Sentinel in under 5 minutes.
Install
npm install @x402sentinel/x402
# or
pnpm add @x402sentinel/x402Sentinel requires @x402/core and @x402/fetch as peer dependencies. Install them if you haven't already.
Wrap Your Fetch
Add 4 lines to your existing x402 setup:
import { x402Client, wrapFetchWithPayment } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { wrapWithSentinel, standardPolicy } from "@x402sentinel/x402";
const client = new x402Client();
registerExactEvmScheme(client, { signer });
const fetchWithPayment = wrapFetchWithPayment(fetch, client);
const secureFetch = wrapWithSentinel(fetchWithPayment, {
agentId: "agent-weather-001",
budget: standardPolicy(),
});
const response = await secureFetch("https://api.example.com/weather");Console Output
With default in-memory storage, you won't see console output. To verify Sentinel is working, add a hook:
const secureFetch = wrapWithSentinel(fetchWithPayment, {
agentId: "agent-weather-001",
budget: standardPolicy(),
hooks: {
afterPayment: async (record) => {
console.log(`Paid $${record.amount} to ${record.endpoint}`);
},
},
});Test Your Endpoints
Before deploying, verify your endpoints are correctly configured:
npx @x402sentinel/test https://your-api.com/endpointThis tests reachability, 402 response, payment schema, security headers, and response time — scoring your endpoint 0-10.
Next Steps
- Dashboard Overview — Query spend and export audit data
- Budget Policies — Configure limits and presets
- Storage Backends — File or API storage for persistence