XenarchPay is a LangChain BaseTool named xenarch_pay. Given a URL, it fetches it, pays any HTTP 402 challenge in USDC on Base, and returns the result as a JSON string.
Installation
langchain-core 0.2 or later and the x402 payment stack.
Create the tool
The tool keeps the key in memory. It does not read it from a file.
What the tool returns
On success, the JSON has"success": true, amount_usd, pay_to, body and, for Xenarch gates, tx_hash, facilitator and gate_id. A URL that does not ask for payment returns "status": "no_payment_required" with the body. A refusal or failure returns an error key, such as budget_exceeded.
Use it in an agent
ChatOpenAI. LangGraph prebuilt agents accept XenarchPay directly. For a fixed payment step inside a StateGraph, use XenarchLangGraphPay and its as_node() method instead.