Skip to main content

a2apay

Python client for a2apay.io — pay-per-call AI answers and persistent memory for autonomous agents. No account, no API key.

pip install a2apay-io          # free-tier only
pip install "a2apay-io[paid]"  # adds real payment support (eth-account)

(The PyPI distribution is named a2apay-io — an unrelated package already holds the bare a2apay name. The importable module is still a2apay.)

Quick start (free tier, zero setup)

Every call tries the free tier first automatically — 5 requests/day per caller, no wallet needed:

from a2apay import Agent

agent = Agent()
answer = agent.ask("What's 7 times 8?")
print(answer)

agent.remember("last_task", "processed invoice #4471", tags=["billing"])

With real payment (once the free tier is used up)

from a2apay import Agent

agent = Agent(private_key="0x...")  # or set A2APAY_PRIVATE_KEY
answer = agent.ask("What's 7 times 8?")

The wallet needs a small USDC balance on Base mainnet ($0.028/call). The private key is used only to sign a payment authorization locally — it is never sent anywhere.

Checkpoint / resume (task memory)

Write versioned, task-scoped state and read it back later — even from a different process. Each checkpoint() to the same key adds a new version rather than overwriting, and resume() always returns the latest.

from a2apay import Agent

agent = Agent(private_key="0x...")
agent.checkpoint("invoice-batch-7", key="status", value="processed rows 1-400")

# ...process dies, or a second process picks up later...

agent2 = Agent(private_key="0x...")  # same wallet
records = agent2.resume("invoice-batch-7")
print(records[0]["value"])  # "processed rows 1-400"

resume() always requires payment ($0.014/call) — there's no free tier for reads yet, so it needs a configured wallet even for your first call. checkpoint() follows the same free-tier-then-paid behavior as remember().

What this honestly does and doesn't do

  • ask() returns a real AI-generated answer.
  • remember() stores a flat key/value record with optional tags — this is simple text storage, not a document database. Values are stored as text.
  • Falls back to a real payment only when the free tier returns a 402; if no private_key is configured at that point, it raises a clear A2ApayError rather than failing silently.
  • Payment signing uses eth-account (maintained by the Ethereum Foundation ecosystem), implementing the real x402 "exact" EVM scheme per the x402 protocol spec.

MCP server

An MCP server (mcp_server.py) exposes ask and remember as MCP tools for any MCP-aware agent or framework (Claude Desktop, etc.):

pip install "a2apay-io[mcp]"
python mcp_server.py

Add to an MCP client config:

{
  "mcpServers": {
    "a2apay": {
      "command": "python",
      "args": ["/absolute/path/to/mcp_server.py"],
      "env": {"A2APAY_PRIVATE_KEY": "0x..."}
    }
  }
}

Honest scope note: remember is write-only — there's no memory read-back tool because the live API doesn't have a read-back route yet.

Full API reference

See a2apay.io/openapi.yaml for the underlying HTTP API this wraps.

Metadata

Release files for a2apay-io 0.1.0

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

Source distribution (sdist)

Source distribution for a2apay-io 0.1.0
File Size Uploaded
a2apay_io-0.1.0.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for a2apay-io 0.1.0
File Interpreter ABI Platform
a2apay_io-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.2 kB

Release files / a2apay_io-0.1.0.tar.gz

Download URL a2apay_io-0.1.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
255296b7e1429bc5feab717989c131de1a268cfd46bcaf542938d682e6cc3490
BLAKE2b-256 checksum
How to use checksums
c4b927898cb75dae610e3d7a43492024ebbf441f02a56f5707b292a65f9d1c54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / a2apay_io-0.1.0-py3-none-any.whl

Download URL a2apay_io-0.1.0-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
625a877eb88f3ca0c4a8455ab6eaac0646c6b31ef33a51934d8a6cfe565e1100
BLAKE2b-256 checksum
How to use checksums
299d78b036c7d4cad973a8c65c24c7f37fac2068be995261b6e6bcd97e7eb36c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

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