@agentpay-sui/gateway
v0.1.0
Published
Self-hostable paid-tool gateway for AgentPay/Sui x402 routes.
Readme
@agentpay-sui/gateway
Self-hostable paid-tool gateway for AgentPay/Sui x402 routes.
The gateway sits in front of API providers and enforces the payment boundary:
- unpaid request returns
402withPAYMENT-REQUIRED - paid retry sends
PAYMENT-SIGNATURE - gateway calls facilitator
/verify - provider runs only after verification
- gateway calls facilitator
/settleonly after provider success - response includes
PAYMENT-RESPONSEwith receipt/reputation metadata
Run
agentpay-gatewayCommon environment:
FACILITATOR_URL=https://your-facilitator.example
AGENTPAY_NETWORK=sui:testnet
AGENTPAY_GATEWAY_TOOLS_JSON='[{"slug":"weather","toolId":"0x...","expectedPayee":"0x...","coinType":"0x2::sui::SUI","amount":"1000000","symbol":"SUI","decimals":9}]'
AGENTPAY_GATEWAY_CORS_ORIGINS=https://your-app.exampleReal no-key providers:
AGENTPAY_WEATHER_PROVIDER=open-meteo
AGENTPAY_PYTH_PROVIDER=hermes
AGENTPAY_PYTH_HERMES_URL=https://hermes-beta.pyth.network
AGENTPAY_WEB_FETCH_ALLOW_NETWORK=true
AGENTPAY_WEB_FETCH_ALLOWED_HOSTS=docs.sui.ioEmbed
import { createGatewayApp } from "@agentpay-sui/gateway";
const app = createGatewayApp({
facilitatorUrl: "https://your-facilitator.example",
});
app.listen(8081);