Skip to main content

⚡ A-Pay Protocol (AgentPay)

The Universal Micropayment & Economic Layer for Autonomous AI Agents

Python 3.11+ Status Tests Live Console


🎯 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)

Protect ANY existing website or API with an instant HTTP 402 crypto paywall—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())

📦 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

🛠️ Quickstart & Local Testing

# 1. Activate virtual environment
source .venv/bin/activate

# 2. Run automated test suite
pytest tests/

# 3. Generate a new Agent Wallet
apay wallet new

# 4. Protect a local service
apay protect --target http://localhost:8000 --price 0.001 --wallet 0x70997970C51812dc3A010C7d01b50e0d17dc79C8

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

Release files for apay 0.1.1

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.1
File Size Uploaded
apay-0.1.1.tar.gz 18.1 kB Details

Built distribution (wheel)

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

Total release size: 37.0 kB

Release files / apay-0.1.1.tar.gz

Download URL apay-0.1.1.tar.gz
Size 18.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1f0b1949a0fbf7ed86ed16ed1d01f958d357ac3086118ae60b16461d3626f00b
BLAKE2b-256 checksum
How to use checksums
91ed421e589a14f303bc6315544c05cb5b28156a30351508f19363a94759c420
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.1-py3-none-any.whl

Download URL apay-0.1.1-py3-none-any.whl
Size 19.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7513a759f46ae93df63a36c3a0b3bd60931f66e1b08781f7d805ded23c2db482
BLAKE2b-256 checksum
How to use checksums
e4b51a6ead9ad1aa6a27499f22799f328a8ca424d4f7e317b34525983704458e
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 history Release notifications | RSS feed

0.1.3

2 release files

0.1.2

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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