Skip to main content

OpenClaw x402-Layer Skill

The x402-layer skill enables OpenClaw agents to interact with x402 Singularity Layer for autonomous API monetization and consumption.
This skill is production-ready and has been tested with real payments on Base (EVM) and Solana, including the current PayAI-backed Solana flow.
Current release: v1.12.0. This release adds API schema support for endpoint route documentation, enabling agents to self-discover routes from 402 challenges, powering interactive API testers on pay pages, and displaying route docs on marketplace listings.

Script Source Code

The full Python source code for all scripts is available in this repository: View Scripts Folder
Scripts for buying services from the marketplace:

Quick Start

Installation

Install directly via our self-hosted endpoint:
Alternatively, clone from GitHub:

Environment Setup

For Base payment flows without exposing a private key, AWAL is still supported:
OpenWallet / OWS is also now available as an optional local wallet backend:
Use private-key mode for wallet-first ERC-8004 registration. Optional owner-scoped MCP management:
Optional direct dashboard API-key management:
Use the PAT when the agent needs MCP. Use the owner-linked X-API-Key when the agent already has the direct worker-management key for endpoint, webhook, or fundraiser campaign management.
Studio seller webhooks use X-X402-Signature, X-X402-Timestamp, X-X402-Event, and X-X402-Event-Id. Verify HMAC-SHA256(timestamp + "." + rawBody) with the webhook signing_secret. Keep legacy raw-secret headers only as fallback for older receivers, and do not confuse the Studio signing secret with any app-internal settlement secret such as x-x402-secretX402_WEBHOOK_SECRET.

World AgentKit Benefits

XMTP Support Threads

Usage Examples

Integrate Payments Into Your App

Pay for an Endpoint (Consumer)

Use Credits (Fastest)

Create Your Own Endpoint (Provider)

This now costs $1 one-time and includes 4,000 starting credits.
Note: Save the API Key from the output and use it to secure your origin server.

Add API Schema Documentation

Attach a schema so consumers and agents know what routes, parameters, and body fields your API supports:
Schema format: {"version": 1, "routes": [...]} where each route specifies path, method, summary, parameters (with name, in, type, required, example), optional requestBody, and optional responseExample. When set, the schema:
  • Displays on marketplace listings
  • Is included in 402 challenge responses for programmatic discovery
  • Powers the interactive API tester on hosted pay pages

Security: API Key Verification

[!IMPORTANT] When you create an endpoint, x402 acts as a proxy to your origin server. You MUST verify requests are coming from x402.
  1. Get your API Key: Returned when you run create_endpoint.py.
  2. Verify Headers: Your origin server MUST check for this header in every request:
    If the header is missing or incorrect, reject the request (401 Unauthorized).

Browse Marketplace

Register an Agent (Wallet-First)

Wallet-first registration flow:
  1. register_agent.py requests a one-time challenge from POST /agent/auth/challenge
  2. Your wallet signs the challenge locally
  3. The script exchanges that signature at POST /agent/auth/verify
  4. The worker returns a short-lived session token
  5. list_my_endpoints.py and list_agents.py use wallet-authenticated GET /agent/erc8004/endpoints/mine and GET /agent/erc8004/mine
  6. The same wallet sends the real on-chain transaction via prepare/finalize routes
  7. update_agent.py uses update/prepare plus update/finalize, and automatically sends the on-chain URI update transaction when metadata changes

Technical Details

Base (EVM) Payments

Uses EIP-712 TransferWithAuthorization signatures:
  • Gasless for the payer
  • Facilitator settles on-chain
  • Simplest production default

Solana Payments

Uses VersionedTransaction with MessageV0:
  • Facilitator pays gas fees
  • SPL Token TransferChecked instruction
  • Must include the live feePayer from the challenge
  • Exact-payment payload must stay within facilitator compute limits
  • The bundled signer handles the current live flow
Base remains the simplest default for production. Solana is supported, but the signer must respect the challenge fee payer and exact-payment compute constraints.

Skill Metadata

Resources

Changelog

v1.12.0

  • Added API schema support for endpoint route documentation (--schema-file, --schema-json, --clear-schema)
  • Schema displays on marketplace listings, 402 challenge responses, and hosted pay page API testers
  • Agents can self-discover available routes from the 402 challenge or management API before paying
  • Fixed worker skill version mismatch (was 1.10.6 in worker vs 1.11.1 in SKILL.md)

v1.10.3

  • added optional OpenWallet / OWS support for pay, discover, and sign-message flows
  • added a dedicated ows_cli.py wrapper plus OpenWallet guidance
  • kept private-key and AWAL flows intact while expanding wallet backend options

v1.9.1

  • hardened xmtp_support.mjs by removing the environment-driven Studio base override from the helper itself
  • added explicit runbooks for World AgentKit benefits and XMTP support thread operations
  • refreshed stale example versions and kept MCP guidance in the same install surface

v1.8.2

  • removed globally-required secret env declarations from skill metadata
  • documented capability-specific environment requirements so users expose only the vars needed for the current task
  • synced the safer environment guidance across the hosted skill and public docs

v1.8.1

  • fixed direct Base endpoint payments for skill usage by rejecting self-payment early
  • aligned pay_base.py with the hosted purchase-path shape using ?action=purchase

v1.8.0

  • Added seller-side endpoint configuration parity for best-fit audience and verified human-backed AgentKit benefit fields
  • Added real manage_endpoint.py update support against worker PATCH routes

v1.7.0

  • Added wallet-signed support APIs for agent wallets
  • Added support thread commands and XMTP helper flows for agent-side support operations
  • Preserved AgentKit-aware discovery and optional Base payment flow for verified human-backed agent wallets

v1.5.0

  • Added a first-class payments integration path for agents using direct endpoints, credits, products, webhooks, and receipt verification
  • Added payments-integration.md as the decision guide for payment shape and fulfillment strategy
  • Fixed the bundled Solana signer to match the live PayAI-backed compute limit requirement

v1.4.0

  • Wallet-first ERC-8004 / Solana-8004 registration is now the default for register_agent.py
  • Added signed challenge + short-lived agent session flow for API-only wallet auth
  • Added list_my_endpoints.py, list_agents.py, and update_agent.py for full post-registration lifecycle management
  • Registration now supports version, tags, platform endpoint bindings, and custom endpoint URLs
  • Removed the legacy x402-paid worker registration path; wallet-first registration is now the only supported agent flow

v1.0.1

  • New Script: consume_product.py - Purchase and download digital products

v1.0.0

Initial release with full x402 Agentic Access API integration: Provider Mode:
  • Deploy monetized endpoints with automatic wallet-to-wallet profit routing
  • Top up credits programmatically
  • List endpoints on public marketplace
Consumer Mode:
  • Marketplace discovery with filtering
  • Pay-per-request with EIP-712 permits (Base) and VersionedTransaction (Solana)
  • Credit-based access for zero-latency consumption