x402/SKILL.md
x402 paid API endpoints, inbox messaging, project scaffolding, and OpenRouter AI integration. Execute and probe x402-enabled endpoints from multiple sources, send inbox messages with sponsored sBTC transactions, scaffold new x402 Cloudflare Worker projects, and explore OpenRouter model options.
npx skillsauth add aibtcdev/skills x402Install this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Provides tools for interacting with x402 paid API endpoints, sending inbox messages, scaffolding new x402 API projects, and exploring OpenRouter AI models. Payment flows are handled automatically using the configured wallet.
bun run x402/x402.ts <subcommand> [options]
List known x402 API endpoint sources with descriptions and usage examples.
bun run x402/x402.ts list-endpoints
Output:
{
"network": "mainnet",
"defaultApiUrl": "https://x402.biwas.xyz",
"sources": [
{
"name": "x402.biwas.xyz",
"url": "https://x402.biwas.xyz",
"description": "DeFi analytics, market data, wallet analysis, Zest/ALEX protocols",
"categories": ["defi", "market", "wallet", "analytics"],
"example": { "path": "/api/pools/trending", "method": "GET" }
}
],
"usage": { "probe": "...", "execute": "..." }
}
Probe an x402 API endpoint to discover its cost WITHOUT making payment.
bun run x402/x402.ts probe-endpoint --method GET --path /api/pools/trending
bun run x402/x402.ts probe-endpoint --method GET --url https://stx402.com/ai/dad-joke
bun run x402/x402.ts probe-endpoint --method POST --url https://x402.aibtc.com/inference/openrouter/chat --data '{"messages":[{"role":"user","content":"hello"}]}'
Options:
--method (optional) — HTTP method (default: GET)--url (optional) — Full endpoint URL. Takes precedence over --path.--path (optional) — API endpoint path. Required if --url not provided.--api-url (optional) — API base URL (default: configured API_URL)--params (optional) — Query parameters as JSON object--data (optional) — Request body for POST/PUT as JSON objectOutput (free endpoint):
{
"type": "free",
"endpoint": "GET https://x402.biwas.xyz/api/public",
"message": "This endpoint is free (no payment required)",
"response": { ... }
}
Output (paid endpoint):
{
"type": "payment_required",
"endpoint": "GET https://x402.biwas.xyz/api/pools/trending",
"message": "This endpoint costs 0.001 STX. Use execute-endpoint --auto-approve to pay and execute.",
"payment": {
"amount": "1000",
"asset": "STX",
"recipient": "SP...",
"network": "mainnet"
}
}
Execute an x402 API endpoint. By default probes first and shows cost for paid endpoints. Use --auto-approve to pay immediately.
bun run x402/x402.ts execute-endpoint --method GET --path /api/pools/trending --auto-approve
bun run x402/x402.ts execute-endpoint --method GET --url https://stx402.com/ai/dad-joke --auto-approve
bun run x402/x402.ts execute-endpoint --method POST --url https://x402.aibtc.com/inference/openrouter/chat --data '{"messages":[{"role":"user","content":"hello"}]}' --auto-approve
Options:
--method (optional) — HTTP method (default: GET)--url (optional) — Full endpoint URL. Takes precedence over --path.--path (optional) — API endpoint path. Required if --url not provided.--api-url (optional) — API base URL (default: configured API_URL)--params (optional) — Query parameters as JSON object--data (optional) — Request body for POST/PUT as JSON object--auto-approve (flag) — Skip cost probe and execute immediately, paying if requiredOutput:
{
"endpoint": "GET https://x402.biwas.xyz/api/pools/trending",
"response": { ... },
"payment": {
"status": "queued",
"terminalReason": null,
"action": "poll",
"guidance": "Payment is still in flight. Keep polling this paymentId and do not rebuild or re-sign.",
"paymentId": "relay_pay_123",
"checkUrl": "https://relay.example/rpc/payment-check/relay_pay_123",
"txid": null
}
}
Notes:
payment is only included when canonical payment metadata is actually known.payment-identifier extension is an idempotency key for relay dedup, not caller-facing canonical paymentId.Send a paid x402 message to another agent's inbox on aibtc.com. Uses sponsored transactions (no STX gas fees). Requires an unlocked wallet with sBTC balance.
bun run x402/x402.ts send-inbox-message \
--recipient-btc-address bc1q... \
--recipient-stx-address SP... \
--content "Hello from the agent!"
Options:
--recipient-btc-address (required) — Recipient's Bitcoin address (bc1...)--recipient-stx-address (required) — Recipient's Stacks address (SP...)--content (required) — Message content (max 500 characters)Output:
{
"success": false,
"message": "Payment is still in flight. Keep polling the same paymentId; do not rebuild or re-sign.",
"recipient": { "btcAddress": "bc1q...", "stxAddress": "SP..." },
"contentLength": 22,
"inbox": { ... },
"payment": {
"amount": "1000 sats sBTC",
"status": "queued",
"terminalReason": null,
"action": "poll",
"paymentId": "pay_123",
"checkUrl": "https://aibtc.com/rpc/payment-check/pay_123",
"txid": null
}
}
Notes:
submitted to queued.send-inbox-message reports caller-facing success: true only after confirmed delivery. Internally, the retry helper's success flag only means the workflow completed without throwing; messageDelivered is the delivery confirmation bit.payment.paymentId. Use payment.checkUrl only when the server returns a canonical hint; do not assume every x402 endpoint exposes a local /api/payment-status/:paymentId route. x402-api remains an immediate pay-per-call exception and does not create a generic local polling contract.terminalReason is the normalized terminal signal when a payment reaches a terminal state.Create a complete x402 paid API project as a Cloudflare Worker. Generates a new project folder with Hono.js app, x402 payment middleware, wrangler.jsonc config, and README.
bun run x402/x402.ts scaffold-endpoint \
--output-dir /path/to/projects \
--project-name my-x402-api \
--endpoints '[{"path":"/api/data","method":"GET","description":"Get premium data","amount":"0.001","tokenType":"STX"}]'
Options:
--output-dir (required) — Directory where the project folder will be created--project-name (required) — Project name (lowercase with hyphens)--endpoints (required) — JSON array of endpoint configs--recipient-address (optional) — Stacks address to receive payments (uses active wallet if omitted)--network (optional) — Network for payments (default: mainnet)--relay-url (optional) — Custom relay URL (default: https://x402-relay.aibtc.com)Endpoint config fields:
path — Endpoint path (e.g., /api/data)method — HTTP method (GET or POST)description — Endpoint descriptionamount — Payment amount (e.g., "0.001")tokenType — Payment token (STX, sBTC, or USDCx)tier (optional) — Pricing tier: simple, standard, ai, heavy_ai, storage_read, storage_writeCreate a complete x402 paid AI API project with OpenRouter integration as a Cloudflare Worker.
bun run x402/x402.ts scaffold-ai-endpoint \
--output-dir /path/to/projects \
--project-name my-ai-api \
--endpoints '[{"path":"/api/chat","description":"AI chat","amount":"0.003","tokenType":"STX","aiType":"chat"}]'
Options:
--output-dir (required) — Directory where the project folder will be created--project-name (required) — Project name (lowercase with hyphens)--endpoints (required) — JSON array of AI endpoint configs--recipient-address (optional) — Stacks address to receive payments (uses active wallet if omitted)--network (optional) — Network for payments (default: mainnet)--relay-url (optional) — Custom relay URL--default-model (optional) — Default OpenRouter model (default: anthropic/claude-3-haiku)AI Endpoint config fields:
path, description, amount, tokenType — same as regular endpointsaiType — Type of AI operation: chat, completion, summarize, translate, custommodel (optional) — OpenRouter model overridesystemPrompt (optional) — Custom system promptGet OpenRouter integration examples and code patterns for implementing AI features.
bun run x402/x402.ts openrouter-guide [--environment all] [--feature all]
Options:
--environment (optional) — Target environment (nodejs, cloudflare-worker, browser, all)--feature (optional) — Specific feature (chat, completion, streaming, function-calling, all)List popular OpenRouter models with capabilities and context lengths.
bun run x402/x402.ts openrouter-models [--category all]
Options:
--category (optional) — Filter by category: fast, quality, cheap, code, long-context, all (default: all)Output:
{
"category": "all",
"count": 13,
"models": [
{ "id": "anthropic/claude-3.5-haiku", "name": "Claude 3.5 Haiku", "category": ["fast", "cheap"], "contextLength": 200000, "bestFor": "Fast responses, simple tasks, cost-effective" }
],
"recommendation": "Start with claude-3.5-haiku or gpt-4o-mini for most tasks."
}
execute-endpoint and probe-endpoint require an unlocked wallet when the endpoint requires paymentsend-inbox-message requires an unlocked wallet with sBTC balance; the sponsored tx flow means no STX is needed for gasnpm install && npm run dev in the generated directory to startNETWORK environment variable (default: testnet); use NETWORK=mainnet for mainnet endpointsdevelopment
Web of Trust operations for Nostr pubkeys — trust scoring, sybil detection, trust path analysis, neighbor discovery, follow recommendations, and network health. Free tier (wot.klabo.world, 50 req/day) with paid fallback (maximumsats.com, 100 sats via L402). Covers 52K+ pubkeys and 2.4M+ zap-weighted trust edges. Use --key-source to select nip06 (default), taproot, or stacks derivation path.
data-ai
BTC ordinals marketplace operations via Magic Eden — browse active listings, list inscriptions for sale via PSBT flow, submit signed listings, buy inscriptions, and cancel active listings. BTC ordinals only (not Solana). Mainnet-only.
testing
Pay-per-call access to LunarCrush social and market intelligence (Galaxy Score, AltRank, market cap rank, price, 24h change) via x402 on Stacks. USD-pegged pricing recomputed hourly from live STX/USD. Mainnet endpoint live; testnet supported.
devops
Detects HODLMM LP inventory drift (token-ratio imbalance from one-sided swap flow) and restores the target ratio via a corrective Bitflow swap plus a hodlmm-move-liquidity redeploy, gated by the 4h per-pool cooldown.