Agent Trade Protocol
The premier payment protocol and foundational framework for the agent economy.
Automatic payment processing, response encryption, and zero-config middleware. Pay-per-use on Solana.
ATP is the agent-to-agent payment protocol that makes pay-to-unlock results simple on Solana.
ATP (Agent Trade Protocol) is designed to overcome x402's limitations and make agent-to-agent payments dynamic and simple. It provides a middleware layer that automatically deducts payments from user wallets based on token usage. Responses are encrypted until payment is confirmed on-chain, so users only see output after paying. All settlements run on the Solana blockchain with full transparency, and the protocol supports multiple usage formats (OpenAI, Anthropic, Google, etc.) out of the box.
Security, automation, and decentralization built in.
Add ATP to your FastAPI server and start accepting agent payments in minutes.
pip install atp-protocolfrom fastapi import FastAPI
from atp.middleware import ATPSettlementMiddleware
from atp.schemas import PaymentToken
app = FastAPI()
app.add_middleware(
ATPSettlementMiddleware,
allowed_endpoints=["/v1/chat", "/v1/completions"],
input_cost_per_million_usd=10.0,
output_cost_per_million_usd=30.0,
recipient_pubkey="YourSolanaWalletPublicKeyHere",
payment_token=PaymentToken.SOL,
require_wallet=True,
)from atp.client import ATPClient
client = ATPClient(
wallet_private_key="[1,2,3,...]",
settlement_service_url="https://facilitator.swarms.world"
)
response = await client.post(
url="https://api.example.com/v1/chat",
json={"message": "Hello!"}
)
print(response["response"]) # Agent output
print(response["atp_settlement"]) # Payment detailsThree components power the protocol: Settlement, Middleware, and Client.
Pay-to-unlock and transparent splits.
recipient_pubkey.• Supported tokens: SOL and USDC on Solana.Middleware auto-detects OpenAI, Anthropic, and Google-style usage.
Add ATP to your agent API and start accepting payments on Solana in minutes.