x402 plugin packages

Drop-in files that give your agent framework pay-per-call superpowers on the Mekong Trade Intel fleet. Each Python plugin handles the full flow itself: unpaid request → HTTP 402 → parse PAYMENT-REQUIRED → EIP-712 sign a USDC/Base payment → retry with X-PAYMENT. No facilitator account, no API key.

⚠ base64, not base64url. PAYMENT-REQUIRED and X-PAYMENT are base64 STANDARD (fleet fix 2026-10-20). Only JWT signing uses base64url. All files below implement this correctly.
READY · Python

smolagents

Tool subclasses with paid 402 handling: generic X402PaidTool plus prebuilt web-search and token-price tools. Trial mode works with no wallet.

⬇ smolagents_x402.py
READY · Python

CrewAI

BaseTool subclasses: generic X402PaidBaseTool plus prebuilt web-search and news tools. Drop into any Crew.

⬇ crewai_x402.py
READY · Python

LangChain

make_x402_tool(...) factory returning StructuredTool for any endpoint, plus prebuilt web-search and news tools.

⬇ langchain_x402.py
STUB · TypeScript

ElizaOS / Virtuals

Skeleton Action with the integration steps documented inline — intentionally not wired, so no half-built wallet signer ships. Generate the full TS flow instead:

⬇ eliza_x402.ts (stub)

Full ElizaOS snippet generator →

Install

  1. Download the file for your framework (buttons above).
  2. Install deps: pip install requests eth_account + pip install smolagents / crewai / langchain-core as needed.
  3. Trial mode (free): just import and use — no key, no signup. Quota is per IP.
  4. Paid mode: export X402_PRIVATE_KEY=0x... (Base wallet with a little USDC) and export X402_MAX_USD_PER_CALL=0.05 to cap spend per call. On 402 the plugin signs and retries automatically.

Example (smolagents)

from smolagents import CodeAgent, InferenceClientModel
from smolagents_x402 import X402WebSearchPaid

agent = CodeAgent(tools=[X402WebSearchPaid()], model=InferenceClientModel())
agent.run("Latest news about Ethereum ETFs")
Machine-readable fleet list: manifest.json (43 tools: name, description, endpoint_url, price_usdc, input_schema_ref) · Full MCP schema: mcp-schema.json · Custom snippet for any endpoint: snippet generator