skills$openclaw/x402-layer
ivaavimusic4.0k

by ivaavimusic

x402-layer – OpenClaw Skill

x402-layer is an OpenClaw Skills integration for coding workflows. |

4.0k stars2.8k forksSecurity L1
Updated Feb 7, 2026Created Feb 7, 2026coding

Skill Snapshot

namex402-layer
description| OpenClaw Skills integration.
ownerivaavimusic
repositoryivaavimusic/x402-layer
languageMarkdown
licenseMIT
topics
securityL1
installopenclaw add @ivaavimusic/x402-layer
last updatedFeb 7, 2026

Maintainer

ivaavimusic

ivaavimusic

Maintains x402-layer in the OpenClaw Skills directory.

View GitHub profile
File Explorer
20 files
.
references
agentic-endpoints.md
524 B
credit-based.md
1.5 KB
pay-per-request.md
4.4 KB
payment-signing.md
1.4 KB
scripts
check_credits.py
1.6 KB
consume_credits.py
1.9 KB
consume_product.py
10.1 KB
create_endpoint.py
6.0 KB
discover_marketplace.py
3.4 KB
list_on_marketplace.py
3.3 KB
manage_endpoint.py
4.4 KB
pay_base.py
5.6 KB
pay_solana.py
6.3 KB
recharge_credits.py
5.6 KB
topup_endpoint.py
6.0 KB
_meta.json
289 B
requirements.txt
368 B
SKILL.md
5.2 KB
SKILL.md

name: x402-layer version: 1.0.1 description: | x402 Singularity Layer - Enable AI agents to deploy monetized API endpoints, consume paid services via USDC payments, manage credits, and participate in a self-sustaining agent economy. Supports Base and Solana networks. metadata: clawdbot: emoji: "⚡" os: - linux - darwin allowed-tools:

  • Read
  • Write
  • Edit
  • Bash
  • WebFetch

x402 Singularity Layer

x402 is a Web3 payment layer enabling AI agents to:

  • 💰 Pay for API access using USDC
  • 🚀 Deploy monetized endpoints
  • 🔍 Discover services via marketplace
  • 📊 Manage endpoints and credits

Networks: Base (EVM) • Solana
Currency: USDC
Protocol: HTTP 402 Payment Required


Quick Start

1. Install Dependencies

pip install -r {baseDir}/requirements.txt

2. Set Up Wallet

# For Base (EVM)
export PRIVATE_KEY="0x..."
export WALLET_ADDRESS="0x..."

# For Solana (optional)
export SOLANA_SECRET_KEY="[1,2,3,...]"  # JSON array

Scripts Overview

🛒 CONSUMER MODE (Buying Services)

ScriptPurpose
pay_base.pyPay for endpoint on Base network
pay_solana.pyPay for endpoint on Solana network
consume_credits.pyUse pre-purchased credits (fast)
consume_product.pyPurchase digital products (files)
check_credits.pyCheck your credit balance
recharge_credits.pyBuy credit packs for an endpoint
discover_marketplace.pyBrowse available services

🏭 PROVIDER MODE (Selling Services)

ScriptPurpose
create_endpoint.pyDeploy new monetized endpoint ($5)
manage_endpoint.pyView/update your endpoints
topup_endpoint.pyAdd credits to YOUR endpoint
list_on_marketplace.pyPublish endpoint publicly

Consumer Flows

# Pay with Base (EVM) - 100% reliable
python {baseDir}/scripts/pay_base.py https://api.x402layer.cc/e/weather-data

# Pay with Solana - includes retry logic
python {baseDir}/scripts/pay_solana.py https://api.x402layer.cc/e/weather-data

B. Credit-Based Access (Fastest)

Pre-purchase credits for instant access without blockchain latency:

# Check your balance
python {baseDir}/scripts/check_credits.py weather-data

# Buy credits (consumer purchasing credits)
python {baseDir}/scripts/recharge_credits.py weather-data pack_100

# Use credits for instant access
python {baseDir}/scripts/consume_credits.py https://api.x402layer.cc/e/weather-data

C. Discover Services

# Browse all services
python {baseDir}/scripts/discover_marketplace.py

# Search by keyword
python {baseDir}/scripts/discover_marketplace.py search weather

Provider Flows

A. Create Endpoint ($5 one-time)

Deploy your own monetized API:

python {baseDir}/scripts/create_endpoint.py my-api "My AI Service" https://api.example.com 0.01

Includes 20,000 test credits.

B. Manage Your Endpoint

# List your endpoints
python {baseDir}/scripts/manage_endpoint.py list

# View stats
python {baseDir}/scripts/manage_endpoint.py stats my-api

# Update price
python {baseDir}/scripts/manage_endpoint.py update my-api --price 0.02

C. Top Up YOUR Endpoint (Provider)

Add credits to maintain your endpoint's balance:

python {baseDir}/scripts/topup_endpoint.py my-api 10  # Add $10 worth

Note: This is different from recharge_credits.py which is for CONSUMERS.

D. List on Marketplace

Make your endpoint publicly discoverable:

python {baseDir}/scripts/list_on_marketplace.py my-api --category ai --description "AI-powered analysis"

Payment Technical Details

Base (EVM) - EIP-712 Signatures

Uses USDC TransferWithAuthorization (EIP-3009):

  • Gasless for payer
  • Facilitator settles on-chain
  • 100% reliable

Solana - Versioned Transactions

Uses VersionedTransaction with MessageV0:

  • Facilitator pays gas (from extra.feePayer)
  • SPL Token TransferChecked instruction
  • ~75% success rate (retry logic included)

Environment Reference

VariableRequired ForDescription
PRIVATE_KEYBase paymentsEVM private key (0x...)
WALLET_ADDRESSAll operationsYour wallet address
SOLANA_SECRET_KEYSolana paymentsJSON array of bytes

API Base URL

  • Endpoints: https://api.x402layer.cc/e/{slug}
  • Marketplace: https://api.x402layer.cc/api/marketplace
  • Credits: https://api.x402layer.cc/api/credits/*
  • Agent API: https://api.x402layer.cc/agent/*

Resources


Known Issues

⚠️ Solana payments have ~75% success rate due to facilitator-side fee payer infrastructure issue. Retry logic is included in pay_solana.py. Base (EVM) payments are 100% reliable and recommended for production.

README.md

No README available.

Permissions & Security

Security level L1: Low-risk skills with minimal permissions. Review inputs and outputs before running in production.

Requirements

  • OpenClaw CLI installed and configured.
  • Language: Markdown
  • License: MIT
  • Topics:

FAQ

How do I install x402-layer?

Run openclaw add @ivaavimusic/x402-layer in your terminal. This installs x402-layer into your OpenClaw Skills catalog.

Does this skill run locally or in the cloud?

OpenClaw Skills execute locally by default. Review the SKILL.md and permissions before running any skill.

Where can I verify the source code?

The source repository is available at https://github.com/openclaw/skills/tree/main/skills/ivaavimusic/x402-layer. Review commits and README documentation before installing.