---
name: dexter-x402
description: "Search, price-check, and call verified paid APIs from the Dexter x402 marketplace. Pay per call in USDC via your lobster.cash wallet. Covers DeFi, AI, Analytics, Social, Data, and Tools. Use whenever the user wants to find a paid API, check what it costs, call an x402 endpoint, browse available API categories, or verify their wallet is ready for x402 payments."
metadata:
  openclaw:
    emoji: "🦀"
    requires:
      bins:
        - curl
        - jq
---

# dexter-x402 — x402 API Marketplace for OpenClaw

Access a continuously growing catalog of verified paid APIs through the Dexter x402 marketplace. Search by keyword, preview pricing, and call any endpoint — payment is handled automatically by your lobster.cash wallet through the Dexter facilitator.

## Important: lobster.cash Wallet Delegation

This skill delegates ALL payment execution to lobster.cash. You MUST follow these rules:

- **Never** ask the user for private keys, seed phrases, or raw wallet credentials.
- **Never** create wallets, build transactions, or sign anything.
- **Never** hardcode lobster.cash internal action names.
- **Always** check wallet state before any payment flow.
- **Always** describe payment intent (endpoint, amount, reason) and let lobster.cash handle execution.
- Transaction execution and final status are handled by lobster.cash.
- If a wallet step is required and lobster.cash wallet context is missing, complete lobster.cash setup first.

## Commands

### 1. Search APIs

Find paid APIs by describing the capability you want in natural language.

**When to use:** User asks to find APIs, explore what's available, or search for a specific capability.

**How:** Use the Dexter capability search endpoint. It embeds the query with a vector model, expands synonyms and alternate phrasings automatically, filters by a similarity floor, splits results into strong (high-confidence) and related (adjacent) tiers, and runs a cross-encoder LLM rerank on the top strong matches. You don't need to pre-filter by chain or category — the ranker handles that semantically.

```bash
QUERY="check wallet balance on Base"
curl -s "https://api.dexter.cash/api/x402gle/capability?q=$(jq -rn --arg q "$QUERY" '$q|@uri')&limit=10" | jq '{
  mode: (if .strongCount > 0 then "direct" elif .relatedCount > 0 then "related_only" else "empty" end),
  strong: [.strongResults[] | {
    name: .displayName,
    url: .resourceUrl,
    price_usdc: .pricing.usdc,
    networks: [.pricing.chains[].network],
    quality: .verification.qualityScore,
    verified: (.verification.status == "pass"),
    similarity,
    why
  }],
  related: [.relatedResults[] | {
    name: .displayName,
    url: .resourceUrl,
    price_usdc: .pricing.usdc,
    networks: [.pricing.chains[].network],
    similarity,
    why
  }]
}'
```

**How to read the response:**

- **`strong[]`** — high-confidence capability hits. Present these first. Each result's `why` field explains the ranking (e.g. "semantic 74% · paid-verified · q92"). Trust the order; the cross-encoder already reranked them.
- **`related[]`** — adjacent services that cleared the similarity floor but not the strong threshold. Fall back to these only if `strong` is empty. Frame them as "closest related matches, not exact matches" when you show them to the user.
- **`mode == "empty"`** — nothing in the index matches this query yet. Tell the user honestly, suggest a broader phrasing, or offer to check back later.
- **`pricing.chains[]`** — every payment rail the resource accepts. Multi-chain resources return all their options here. `pricing.usdc` and `pricing.network` are just the primary chain.

**Pass natural language, not keywords.** "get ETH spot price" works; "eth price" works; "ethereum token market rate" works. The ranker handles synonyms. Do NOT try to strip the query down to keywords or add category/network filters — that's what broke the old substring-based search.

**Present results as:**

| # | API | What it does | Price | Networks | Quality | Why |
|---|-----|--------------|-------|----------|---------|-----|

Price is already USDC-denominated (the `pricing.usdc` field is the dollar amount, not atomic units). Show the `why` line as a one-sentence subtitle — it tells the user *why* this result ranked where it did.

**Fallback (raw bazaar):** If the user explicitly asks for the full x402 bazaar or wants to enumerate every registered resource without ranking, use the standard x402 Facilitator Bazaar endpoint instead:

```bash
curl -s "https://x402.dexter.cash/discovery/resources?limit=50" | jq '[.items[] | {resource, description, method, price: .accepts[0].amount, network: .accepts[0].network}]'
```

This is the raw x402-protocol bazaar format — no ranking, no tiers, no relevance. Only use it for enumeration, not for search.

### 2. Check Pricing

Preview what an endpoint costs before paying.

**When to use:** User asks "how much does X cost?" or wants to see payment options before calling.

**How:**

x402 endpoints return pricing in the HTTP 402 response. The data can be in the **JSON body** (most common) or in the `Payment-Required` header (base64-encoded JSON). Always check both sources.

```bash
# Step 1: Probe the endpoint
RESPONSE=$(curl -s -w "\n%{http_code}" "TARGET_URL")
HTTP_CODE=$(echo "$RESPONSE" | tail -1)
BODY=$(echo "$RESPONSE" | sed '$d')

# Step 2: If 402, parse pricing from body (handles both v1 and v2)
if [ "$HTTP_CODE" = "402" ]; then
  echo "$BODY" | jq '.accepts[] | {
    scheme,
    network,
    amount: (.amount // .maxAmountRequired),
    asset,
    payTo
  }'
fi
```

**v1 vs v2 differences to handle:**

| Field | v1 | v2 |
|-------|----|----|
| Amount | `maxAmountRequired` | `amount` |
| Network | `solana`, `base` | CAIP-2: `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp` |
| Payment header | `X-PAYMENT` | `PAYMENT-SIGNATURE` |
| Version field | `x402Version: 1` | `x402Version: 2` |

Always use `amount || maxAmountRequired` to handle both versions.

**Present as:**

- **Price:** $X.XX USDC per call
- **Network:** Solana / Base
- **Scheme:** exact
- **x402 Version:** 1 or 2
- **Facilitator:** x402.dexter.cash (gas-sponsored, smart wallet compatible)

### 3. Call API (Paid)

Call any x402 endpoint. Payment is delegated to lobster.cash.

**When to use:** User wants to actually call an endpoint and get data back.

**Workflow:**

1. **Wallet precheck**
   - Verify the agent has a lobster.cash wallet configured.
   - If no wallet: "You need a lobster.cash wallet to make x402 payments. Set one up at https://lobster.cash — it takes 30 seconds."
   - If wallet exists but insufficient balance: "Your lobster.cash wallet needs at least $X.XX USDC for this call. Please fund your wallet."

2. **Describe the payment intent**
   Tell lobster.cash what needs to happen:
   - **Endpoint URL:** The full URL to call
   - **Amount:** The price from the 402 response (in USDC)
   - **Asset:** USDC
   - **Network:** Solana (preferred) or Base
   - **Facilitator:** `https://x402.dexter.cash`
   - **Reason:** Brief description of what the API does

   This skill delegates wallet operations to lobster.cash. Do NOT build or sign transactions.

3. **Wait for payment confirmation**
   - Await lobster.cash to report the final transaction status before continuing.
   - On success: make the API call with the payment signature and return the response.
   - On failure: display a clear error and offer retry.

4. **Return the response**
   Present the API response data to the user in a readable format.

**Error handling:**

| Scenario | Action |
|----------|--------|
| Wallet not configured | Prompt user to set up lobster.cash |
| Insufficient balance | Show required amount, ask user to fund wallet |
| Payment failure | Show error, offer retry |
| API error (non-402) | Show the HTTP status and error body |
| Timeout | Inform user, suggest trying again |

### 4. Browse By Category

Show what kinds of APIs are available in the marketplace.

**When to use:** User asks "what kinds of APIs are available?" or wants to explore the landscape before narrowing to a specific capability.

**How:** Don't hard-filter by category name — the capability search ranker handles categories as semantic signals inside the query itself. Instead, search for the category label and let the ranker surface resources in that space.

```bash
# "What analytics APIs are available?"
curl -s "https://api.dexter.cash/api/x402gle/capability?q=analytics&limit=20" | jq '[.strongResults[], .relatedResults[] | {
  name: .displayName,
  category: .category,
  description
}]'
```

The `category` field on each result is populated from the resource's own metadata — use it to group client-side if you want a "results organized by category" presentation, but don't pass it back as a filter.

**Known category areas in the Dexter bazaar** (as a mental map for users, not as filter values):

| Area | Premium Providers | Example Capabilities |
|------|------------------|----------------------|
| **DeFi & Analytics** | Nansen, Allium, CoinGecko, Zapper | Smart money flows, token screeners, wallet PnL, token prices |
| **AI & LLM** | OpenRouter, Gemini, Exa, Freepik | Chat completions, image generation, semantic search, image editing |
| **Prediction Markets** | Dome | Polymarket/Kalshi markets, orderbooks, positions, PnL |
| **Intelligence** | Nyne, Apollo | Person/company enrichment, social profiles, funding data |
| **Infrastructure** | Alchemy, Quicknode, Browserbase | Multi-chain RPC, NFT data, cloud browser sessions |
| **Security** | Quick Intel | Token contract scanning across 60+ chains |
| **Payments** | Laso Finance, Auor | Prepaid cards, exchange rates, flights |
| **Documents** | Reducto | AI document parsing for PDFs, images, spreadsheets |

This table is a hint for framing questions back to the user ("looking for DeFi analytics or AI tools?") — it's NOT a canonical list of categories to filter against.

### 5. Show Wallet Status

Check if the agent's lobster.cash wallet is ready for x402 payments.

**When to use:** User asks about wallet status, or before first payment attempt.

**Behavior:**

- Check if lobster.cash wallet context is available.
- If configured: report wallet address, USDC balance, and readiness.
- If not configured: "No lobster.cash wallet detected. Set one up at https://lobster.cash to start making x402 payments. lobster.cash provides a smart wallet powered by Crossmint — no private keys needed."

## Workflow Patterns

### "Find me an API for X"
1. `Search APIs` with their natural-language query (don't reduce to keywords)
2. If `strong` has results, present those first with the `why` line as context. If only `related` has results, frame them as "closest related matches, not exact" and invite refinement.
3. Ask if they want to check pricing on a specific one
4. `Check Pricing` on their pick
5. `Call API` if they want data

### "Call this URL"
1. `Check Pricing` to show cost first
2. `Call API` with lobster.cash payment delegation

### "What can I access?"
1. `List Categories` to show the landscape
2. `Search APIs` to drill into a category

### "Is my wallet ready?"
1. `Show Wallet Status`
2. If not configured, guide to lobster.cash setup

## Facilitator Details

This skill routes payments through the **Dexter facilitator** at `https://x402.dexter.cash`.

- **Gas-sponsored:** Users pay $0 in SOL/ETH for settlement fees
- **Smart wallet compatible:** Works with PDA wallets (Crossmint, Squads, and other smart wallets)
- **Networks:** Solana mainnet, Base, Polygon, Arbitrum, Optimism, SKALE
- **Asset:** USDC
- **Scheme:** exact (x402 v2)
- **Bazaar extension:** continuously updated, quality-verified endpoints re-tested every 24 hours

The facilitator advertises `smartWalletSupported: true` on its `/supported` endpoint. lobster.cash wallets (Crossmint smart wallets / PDA wallets on Solana) are fully supported through simulation-based CPI verification.

## Fallback

If the Dexter bazaar is unreachable, the skill can still call any x402 endpoint directly if the user provides the URL. The pricing check and payment delegation work with any x402-compliant endpoint, not just those in the Dexter marketplace.
