A-Pay Protocol

io.github.neuralaisofficial-langPublished by GitHub account neuralaisofficial-langv0.1.8Updated Oct 24, 2026

Universal HTTP 402 Micropayment Protocol & Autonomous Economic Settlement Engine for AI Agents

VerifiedStreamable HTTPWeb executableFinanceDeveloper Tools

Overview

AI-generated overview

Gives an AI assistant a non-custodial crypto wallet to probe and pay HTTP 402 micropayments on Base L2 within spending limits.

What you can do
  • Inspect endpoints for A-Pay paywalls, price quotes, currency and payout receiver without spending
  • Pay HTTP 402 crypto micropayments in USDC or $APAY on Base L2, automatically, within configured limits
  • Check the agent wallet address, network, spending guardrails and total spent
  • Read live on-chain balances of ETH, USDC and $APAY
  • Set daily budget and per-call spending caps
When to use it
Use it when an assistant needs to call paid APIs or data services that answer with HTTP 402 and you want it to settle small crypto payments autonomously, with hard budget caps instead of manual approval each time.
Requirements
Runs as a remote endpoint or as a local Python package (uvx/pip, stdio). Needs a Base network choice (base-mainnet or base-sepolia), a currency preference, and budget limits; a private key can be supplied via APAY_PRIVATE_KEY or a session wallet is generated if omitted. On-chain funds for payments and ETH for gas are needed.
Before you install
It spends real crypto: payments are signed and settled on-chain, so set APAY_DAILY_BUDGET and APAY_MAX_PER_CALL carefully. APAY_PRIVATE_KEY is a wallet signing key; a generated session wallet is non-custodial but still holds funds. Endpoint inspection is free, but paying requests sends funds to third-party receivers.

Installation

In SourceWeft

  1. Open A-Pay Protocol in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Web executable via Streamable HTTP. Remote servers run from the web runtime once configured in a workspace.

Use with an agent

Paste this prompt into Claude Code, Codex, Cursor or another agent — or into SourceWeft chat. The agent reads this server's install guide, shows you its publisher, endpoint and sign-in, and adds it to your client once you agree. Keys never go into a command.

Read https://sourceweft.com/mcp/io.github.neuralaisofficial-lang%2Fapay/install.md and connect the MCP server it describes to my client. Before changing any config, show me its publisher, endpoint and sign-in method and wait for my OK. Never put an API key in a command or in a file I would commit; ask me where it should come from.

Read the install guide the agent follows

Other MCP clients

Add this to your client's mcpServers config.

{
  "mcpServers": {
    "a-pay-protocol": {
      "type": "http",
      "url": "https://apay-network.vercel.app/api/mcp"
    }
  }
}

README

⚡ A-Pay Protocol (AgentPay)

The Universal Micropayment & Economic Layer for Autonomous AI Agents

[Python 3.11+] [Status] [Tests] [Live Console]


🌐 Live Production Network & On-Chain Addresses


🎯 Vision & Identity

A-Pay is an ultra-lightweight, zero-latency, open economic rail designed for the machine-to-machine (M2M) economy. Just as UPI revolutionized human digital payments in India, A-Pay enables autonomous AI software agents to discover, consume, and pay for data, compute, APIs, and micro-services on the fly—without credit cards, human KYC, or seed phrase friction.


🚀 1-Command Experience

1. Website / API Owners (The Sellers)

Scaffold a fullstack monetized AI Agent app (Next.js, FastAPI, or Express) in 60 seconds:

bash
npx create-apay-app my-paid-agent

Or protect ANY existing website or API with an instant HTTP 402 crypto paywall proxy—zero code modifications required:

bash
apay protect --target http://localhost:8000 --price 0.001 --wallet 0xYourWalletAddress
  • Incoming requests from AI bots will automatically receive an HTTP 402 Payment Required challenge.
  • Once the AI agent's cryptographic micropayment is verified (<15ms), the request is forwarded to your server and data is unlocked!

2. AI Agent Developers (The Buyers)

Give your AI agent an in-memory wallet and strict spending guardrails with 2 lines of code:

python
from apay import APaySession, AgentWallet
# Generate or load wallet with daily safety limitwallet = AgentWallet(private_key="0x...", max_per_call_usdc=0.01, daily_budget_usdc=5.0)session = APaySession(wallet)
# Automatically handles HTTP 402 challenges & settles on the flyresponse = session.get("https://protected-api.com/market-data")print(response.json())

3. Claude Desktop & Cursor (Model Context Protocol / MCP)

Equip Claude Desktop, Cursor, Antigravity, or Cline with an autonomous A-Pay micro-wallet in 1 click via Smithery.ai:

bash
npx -y @smithery/cli install apay --client claude

Or add directly to claude_desktop_config.json or .cursor/mcp.json (zero-setup via uvx):

json
{  "mcpServers": {    "apay": {      "command": "uvx",      "args": ["apay", "mcp"],      "env": {        "APAY_NETWORK": "base-mainnet",        "APAY_CURRENCY": "DUAL",        "APAY_MAX_PER_CALL": "0.05",        "APAY_DAILY_BUDGET": "2.0"      }    }  }}

Now your assistant can autonomously inspect balances, probe paywalls, and settle HTTP 402 micropayments on Base L2!


📦 Directory Structure

text
apay/├── src/│   └── apay/│       ├── __init__.py      # Package exports│       ├── cli.py           # ⚡ 1-Command CLI (`apay protect`, `apay wallet new`, `apay pay`)│       ├── client.py        # 🤖 Auto-settling HTTP client (sync & async)│       ├── wallet.py        # 🔐 In-memory wallet + local spending limits│       ├── proxy.py         # 🛡️ Ultra-light reverse proxy paywall (Starlette + EIP-712)│       ├── relayer.py       # 📊 Settlement journal & batch relayer│       └── integrations/    # 🔗 LangChain & CrewAI agent wrappers├── contracts/               # Base Sepolia Smart Contracts (APAYToken & APayRouter)├── tests/                   # Automated integration & security test suite├── spec/                    # RFC wire format & security model specifications└── pyproject.toml           # Hatchling packaging configuration

🛠️ Installation & Quickstart

bash
# 1. Install A-Pay via pippip install apay
# 2. Generate a new Agent Wallet with spending limitsapay wallet new
# 3. Protect any website or API with an instant HTTP 402 Paywallapay protect --target http://localhost:8000 --price 0.001 --wallet 0xYourPayoutWalletAddress

A-Pay is an open-source decentralized economic protocol for autonomous machine agents. Built on Base L2.

Source: README.md at commit cbab6ab

Tools

5

apay_request

Probe and automatically pay HTTP 402 crypto micropayments on Base Layer 2 with USDC or $APAY within pre-configured budget limits.

Parametersurlrequiredmethodheadersjson_body

apay_get_wallet_status

Inspect the agent's active non-custodial wallet address, network, current spending guardrails, and total spent in USDC and $APAY.

Takes no parameters.

apay_set_budget

Configure agent safety invariants and spending guardrails. Prevents runaway loops or overcharging.

Parametersdaily_budget_apaydaily_budget_usdcmax_per_call_apaymax_per_call_usdc

apay_inspect_endpoint

Inspect an endpoint to check if it requires an A-Pay micropayment, inspect the exact price quote, currency, and payout receiver without spending any funds.

Parametersurlrequired

apay_get_balance

Inspect the agent's live on-chain balances on Base Layer 2, including native ETH (for gas), USDC, and $APAY tokens.

Parametersaddress

Version history

1
  1. v0.1.8LatestSep 27, 2026

Score

90% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 daysRequired25 pts
  • Auth declaredRequired10 pts
  • Tools listedRequired15 pts
  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts

    Declare a license in the repository or the registry entry.