Logo: Agent Micropayments Via X402 Protocol

Agent Micropayments Via X402 Protocol

Organisatioun
rondoflow
agent-micropayments-via-x402-protocol

Enable AI agents to make micropayments via x402 protocol. Use when purchasing browser sessions on Browserbase, scraping with Firecrawl, or any x402-compatible API. Handles wallet creation, funding, and automatic payment flows.

Iwwersiicht

Editeurrondoflow
Repositoryrondoflow
Skill-Nummagent-micropayments-via-x402-protocol
Stären
29
Forks
2
Matgeliwwert Dateien
1
LizenzMIT
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 1 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    rondoflow huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Agent Micropayments Via X402 Protocol an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/rondoflow/rondoflow/tree/master/packages/catalog/content/skills/agent-micropayments-via-x402-protocol
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/rondoflow/rondoflow.git /tmp/rondoflow
mkdir -p .claude/skills
cp -r /tmp/rondoflow/packages/catalog/content/skills/agent-micropayments-via-x402-protocol .claude/skills/agent-micropayments-via-x402-protocol
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Agent Micropayments Via X402 Protocol an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Agent Micropayments Via X402 Protocol automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Agent Micropayments Via X402 Protocol net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

OpenKrill - x402 Payments Skill

This skill enables AI agents to autonomously make micropayments using the x402 protocol. It handles wallet management, balance checking, and automatic payment flows when APIs return HTTP 402 Payment Required responses.

When to Use This Skill

  • When asked "what services can I purchase?" or "what x402 APIs are available?" - Query the Bazaar first!
  • When purchasing browser automation sessions on Browserbase
  • When performing web scraping tasks with Firecrawl
  • When the agent needs to create an email address for signups or verification
  • When interacting with any x402-compatible API
  • When the user mentions micropayments, crypto payments, or paying for API access
  • When you encounter a 402 Payment Required response
  • When discovering new x402-compatible services via the Bazaar

TIP: When a user or agent asks what services are available for purchase, always start by querying the Bazaar discovery endpoint. It provides a live, up-to-date catalog of 12,000+ x402-compatible services.

Quick: Discover Available Services

bash
# Query the Bazaar to see what's available (no auth required)
curl -s "https://api.cdp.coinbase.com/platform/v2/x402/discovery/resources?type=http&limit=50"

Prerequisites

Before using this skill, ensure:

  1. THIRDWEB_SECRET_KEY environment variable is set with a valid thirdweb project secret key
  2. The wallet has sufficient USDC balance on Base chain (or the target chain)
  3. Network access to thirdweb API endpoints

IMPORTANT: x402 Endpoint URLs & Service Types

Two Types of x402 Support

TypeDescriptionExample
True x402Fully keyless - no API keys needed, just pay and useBrowserbase
Hybrid x402Requires API key/token + payment headerFirecrawl

x402 Endpoint Patterns

ServiceStandard APIx402 EndpointTypeStatus
Browserbaseapi.browserbase.comx402.browserbase.comTrue x402✅ Works
Firecrawlapi.firecrawl.dev/v1/searchapi.firecrawl.dev/v1/x402/searchNon-standard❌ Broken

Discovery tips:

  • Check for x402. subdomain (e.g., x402.browserbase.com)
  • Check for /x402/ in the path (e.g., /v1/x402/search)
  • Hit the x402 root URL for endpoint listing (e.g., curl https://x402.browserbase.com/)

Core Workflow

Step 1: Check or Create Wallet

Use the thirdweb API directly (recommended):

bash
curl -s -X POST https://api.thirdweb.com/v1/wallets/server \
  -H "Content-Type: application/json" \
  -H "x-secret-key: $THIRDWEB_SECRET_KEY" \
  -d '{"identifier": "x402-agent-wallet"}'

The response will include the wallet address. Store this for subsequent operations.

Step 2: Make Payments with fetchWithPayment

Call the thirdweb x402 fetch API directly:

bash
# Browserbase - Create browser session
curl -s -X POST "https://api.thirdweb.com/v1/payments/x402/fetch?url=https://x402.browserbase.com/browser/session/create&method=POST" \
  -H "Content-Type: application/json" \
  -H "x-secret-key: $THIRDWEB_SECRET_KEY" \
  -d '{"browserSettings": {"viewport": {"width": 1920, "height": 1080}}}'

Step 3: Handle the Response

Success: The API returns the session data directly.

Insufficient Funds: If the wallet needs funding, the API returns:

json
{
  "result": {
    "message": "This endpoint requires 0.002 USDC on chain id 8453...",
    "link": "https://thirdweb.com/pay?chain=8453&receiver=0x...&token=0x..."
  }
}

When you receive a payment link, open it in the user's browser:

  • If browser automation is available (MCP, browser tool, etc.), use it to navigate to the link in a new tab
  • Otherwise, display the link prominently and instruct the user to open it manually

This opens thirdweb's payment page where users can fund the wallet.

API Reference

fetchWithPayment Endpoint

URL: https://api.thirdweb.com/v1/payments/x402/fetch

Method: POST

Query Parameters:

ParameterRequiredDescription
urlYesTarget API URL to call
methodYesHTTP method (GET, POST, etc.)
fromNoWallet address for payment (uses default project wallet if omitted)
maxValueNoMaximum payment amount in wei
assetNoPayment token address (defaults to USDC)
chainIdNoChain ID for payment (e.g., "eip155:8453" for Base)

Headers:

  • x-secret-key: Your thirdweb project secret key (required)
  • Content-Type: application/json

Supported x402 Services

Browserbase

x402 Endpoint: https://x402.browserbase.com
Pricing: $0.12/hour (paid in USDC on Base)

EndpointMethodDescription
/browser/session/createPOSTCreate a browser session
/browser/session/:id/statusGETCheck session status
/browser/session/:id/extendPOSTAdd more time
/browser/session/:idDELETETerminate session
bash
curl -s -X POST "https://api.thirdweb.com/v1/payments/x402/fetch?url=https://x402.browserbase.com/browser/session/create&method=POST" \
  -H "Content-Type: application/json" \
  -H "x-secret-key: $THIRDWEB_SECRET_KEY" \
  -d '{"browserSettings": {"viewport": {"width": 1920, "height": 1080}}}'

Firecrawl (Non-Standard x402 - NOT RECOMMENDED)

x402 Endpoint: https://api.firecrawl.dev/v1/x402/search
Pricing: $0.01/request
Status: ⚠️ Incomplete implementation - cannot be used with thirdweb

WARNING: Firecrawl's x402 implementation is non-standard and currently unusable for automated agents:

  1. Returns 401 Unauthorized instead of 402 Payment Required
  2. Doesn't include payment details (payTo address, asset, amount) in response
  3. Documentation says to use X-Payment: {{paymentHeader}} but doesn't explain how to generate it

Comparison with proper x402 (Browserbase):

  • Browserbase: Returns 402 with x402Version, accepts, payTo, asset → thirdweb can auto-pay
  • Firecrawl: Returns 401 with just {"error":"Unauthorized"} → no payment info provided
EndpointMethodStatus
/v1/x402/searchPOST❌ Non-functional for agents

Recommended alternatives:

  1. Firecrawl MCP - If available in your environment (uses standard API key)
  2. Browserbase + scraping script - True x402, fully keyless
  3. Standard Firecrawl API - With subscription/API key

Reference: Firecrawl x402 docs

Mail.tm (Disposable Email)

Base URL: https://api.mail.tm
Pricing: Free (no x402 payment required)

Mail.tm allows agents to create email addresses for signups and receive verification emails.

EndpointMethodAuthDescription
/domainsGETNoGet available email domains
/accountsPOSTNoCreate an email account
/tokenPOSTNoGet authentication token
/messagesGETYesList all messages
/messages/:idGETYesGet full message content
/meGETYesGet account info
Create Email Account
bash
# 1. Get available domain
DOMAIN=$(curl -s https://api.mail.tm/domains | jq -r '.["hydra:member"][0].domain')

# 2. Create account with unique address
curl -s -X POST https://api.mail.tm/accounts \
  -H "Content-Type: application/json" \
  -d '{"address": "agent-'$(date +%s)'@'"$DOMAIN"'", "password": "SecurePass123!"}'
Get Token and Check Messages
bash
# Get auth token
TOKEN=$(curl -s -X POST https://api.mail.tm/token \
  -H "Content-Type: application/json" \
  -d '{"address": "YOUR_EMAIL", "password": "YOUR_PASSWORD"}' | jq -r '.token')

# List messages
curl -s https://api.mail.tm/messages -H "Authorization: Bearer $TOKEN"

# Read specific message
curl -s https://api.mail.tm/messages/MESSAGE_ID -H "Authorization: Bearer $TOKEN"

Important: Store email credentials (address, password, token) for later use. Consider saving to .agent-emails.json (gitignored).

Error Handling

ErrorCauseSolution
401 UnauthorizedInvalid or missing THIRDWEB_SECRET_KEYCheck environment variable
402 Payment RequiredInsufficient balanceAuto-open payment link (see above)
400 Bad RequestInvalid URL or methodVerify request parameters
404 Not FoundWrong endpointCheck x402-specific endpoint (e.g., x402.browserbase.com)
500 Server Errorthirdweb or target API issueRetry or check service status

Common Mistakes

  1. Using wrong subdomain: api.browserbase.com vs x402.browserbase.com
  2. Using wrong path: /v1/sessions vs /browser/session/create
  3. Not checking for payment links: Always parse response for link field

Discovering x402 Endpoints

There are two ways to discover x402-compatible services:

Method 1: x402 Bazaar (Recommended)

The x402 Bazaar is a machine-readable catalog that helps AI agents discover x402-compatible API endpoints programmatically.

Query the Bazaar Discovery Endpoint
bash
# Using the default facilitator (x402.org)
curl -s "https://x402.org/facilitator/discovery/resources?type=http&limit=20"

# Using CDP facilitator (Coinbase)
curl -s "https://api.cdp.coinbase.com/platform/v2/x402/discovery/resources?type=http&limit=20"
Using the Discovery Script
bash
# Discover available services
npx ts-node scripts/discover-services.ts

# With pagination
npx ts-node scripts/discover-services.ts --limit 50 --offset 0

# Use CDP facilitator
npx ts-node scripts/discover-services.ts --facilitator "https://api.cdp.coinbase.com/platform/v2/x402"

# Output as JSON for programmatic use
npx ts-node scripts/discover-services.ts --json
Response Format
json
{
  "x402Version": 2,
  "items": [
    {
      "resource": "https://x402.browserbase.com/browser/session/create",
      "type": "http",
      "x402Version": 1,
      "accepts": [
        {
          "scheme": "exact",
          "network": "eip155:8453",
          "amount": "2000",
          "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
          "payTo": "0x..."
        }
      ],
      "lastUpdated": "2024-01-15T12:30:00.000Z",
      "metadata": {
        "description": "Create a browser session",
        "input": { ... },
        "output": { ... }
      }
    }
  ],
  "pagination": {
    "limit": 20,
    "offset": 0,
    "total": 42
  }
}
Query Parameters
ParameterTypeDefaultDescription
typestring-Filter by protocol type (e.g., "http")
limitnumber20Number of resources to return (max: 100)
offsetnumber0Offset for pagination

Method 2: Manual Discovery

When encountering a new service that might support x402:

1. Check for x402 Subdomain
bash
# Try the x402 subdomain - often has an info page
curl -s https://x402.SERVICE.com/

# Example: Browserbase lists all endpoints at root
curl -s https://x402.browserbase.com/
2. Check for /x402/ Path Prefix
bash
# Some services use path prefix instead of subdomain
curl -s -I https://api.SERVICE.com/v1/x402/endpoint
3. Test for 402 Response
bash
# A true x402 endpoint returns 402 Payment Required (not 401)
curl -s -i -X POST https://x402.SERVICE.com/endpoint \
  -H "Content-Type: application/json" \
  -d '{}' 2>&1 | head -5

Expected for true x402:

HTTP/2 402
x-payment-required: ...

If you see 401 Unauthorized: The service uses hybrid x402 (needs API key + payment).

4. Check Service Documentation

Look for x402/payments documentation:

  • docs.SERVICE.com/x402/
  • docs.SERVICE.com/payments/
  • Search for "x402" or "402" in their docs

Additional Resources

Links

Matgeliwwert Dateien

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Agent Micropayments Via X402 Protocol?

Enable AI agents to make micropayments via x402 protocol. Use when purchasing browser sessions on Browserbase, scraping with Firecrawl, or any x402-compatible API. Handles wallet creation, funding, and automatic payment flows.

Firwat Agent Micropayments Via X402 Protocol op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Agent Micropayments Via X402 Protocol besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Agent Micropayments Via X402 Protocol an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/rondoflow/rondoflow/tree/master/packages/catalog/content/skills/agent-micropayments-via-x402-protocol an. TypingMind liest d'Datei SKILL.md, bëndelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Agent Micropayments Via X402 Protocol benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Agent Micropayments Via X402 Protocol benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Agent Micropayments Via X402 Protocol domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Agent Micropayments Via X402 Protocol gratis?

Jo. rondoflow huet de Skill ënner der Lizenz MIT op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇