Skip to main content

⚡ 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:

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:

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:

from apay import APaySession, AgentWallet

# Generate or load wallet with daily safety limit
wallet = 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 fly
response = 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:

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

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

{
  "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

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

# 1. Install A-Pay via pip
pip install apay

# 2. Generate a new Agent Wallet with spending limits
apay wallet new

# 3. Protect any website or API with an instant HTTP 402 Paywall
apay 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.

Metadata

Release files for apay 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apay 0.1.7
File Size Uploaded Provenance Actions
apay-0.1.7.tar.gz 56.1 kB Without provenance Details for apay-0.1.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for apay 0.1.7
File Interpreter ABI Platform Actions
apay-0.1.7-py3-none-any.whl Python 3 none any Details for apay-0.1.7-py3-none-any.whl

Total release size: 120.6 kB

Release files / apay-0.1.7.tar.gz

Download URL apay-0.1.7.tar.gz
Size 56.1 kB
Tags Source
SHA-256 checksum
How to use checksums
2e7793aa498639028ec9badbae3144190047b2928fb4301df941caab7f21738f
BLAKE2b-256 checksum
How to use checksums
a6d6adbe4f919e319f1ad489b9d1a7e91de931a4714b1d535ab8c5f1cbe8e546
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.05","id":"yarara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / apay-0.1.7-py3-none-any.whl

Download URL apay-0.1.7-py3-none-any.whl
Size 64.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34bbbac7034e0e98a0066352a647a7a3899fc8c61ba0e4acd093417e6da7423f
BLAKE2b-256 checksum
How to use checksums
ddd43bda54d55e8471d2f0b315b7ebee41993d3fb698ad121e669afacdf0fd39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"NixOS","version":"26.05","id":"yarara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for apay 0.1.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page