Skip to main content
Glama

Agent X402

CI npm license


x402 micropayments for AI agents — pay per API call in USDC on Base. No account, no API key, no subscription. With a spend policy a prompt injection cannot talk its way past.


⭐ Star us on GitHub if this project helps you build better agents!


🚀 Быстрый старт

git clone https://github.com/rustemmustafingovua-byte/agent-x402
cd agent-x402 && npm install
npm test

Related MCP server: @bridgenode/mcp

🎯 Демо

const {X402Client, SpendPolicy} = require('agent-x402');
const client = new X402Client({
  privateKey: process.env.PRIVATE_KEY,
  policy: new SpendPolicy({ dailyUsd: 5, perRequestUsd: 0.5 })
});
const res = await client.fetch('https://api.venice.ai/api/v1/chat/completions', {
  method: 'POST',
  body: { model: 'claude-haiku-5-5', messages: [{role:'user',content:'hi'}] }
});
console.log('Paid:', res.paid, 'Amount USD:', res.amountUsd);

💰 Монетизация

  • Pay-per-call API: продавайте доступ к своим API через x402 — $0 за подписку, оплата за вызов в USDC

  • Hosted endpoints: запустите inference-сервис и получайте микро-платежи за каждый запрос

  • Consulting: аудит x402-интеграций для enterprise-клиентов

  • Plugin marketplace: публикуйте плагины для x402-клиента в npm


Contributing

  1. Fork the repo

  2. Create a feature branch (git checkout -b feat/amazing-thing)

  3. Commit your changes (git commit -m 'feat: add amazing thing')

  4. Push to the branch (git push origin feat/amazing-thing)

  5. Open a Pull Request

Bug reports and feature requests are welcome on the Issues page.

MIT © rustemmustafingovua-byte

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents to make pay-as-you-go AI inference requests through x402 with automatic Solana USDC payments, no API keys or registration, while enforcing configurable spending limits.
      3
      196 npm
      1
      MIT No Attribution
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to autonomously pay for metered web APIs on a per-call basis, settling x402 v2 USDC micropayments via EIP-3009 authorization on Base Sepolia without human involvement. Spending is bounded by configurable per-call caps and host restrictions, and exposes tools to fetch paywalled URLs and inspect the agent wallet's address and balance.
      MIT