Skip to main content
ClaudeWave

Working x402 examples: pay-per-call APIs for AI agents — OpenAI-compatible LLM gateway, embeddings, web search, market data. USDC on Base, no API keys.

SubagentsOfficial Registry0 stars0 forksPythonMITUpdated yesterday
Install as a Claude Code subagent
Method: Clone
Terminal
git clone https://github.com/scrape402/x402-examples && cp x402-examples/*.md ~/.claude/agents/
1. Clone the repository and copy the agent .md definitions into ~/.claude/agents (or .claude/agents inside a project).
2. Start a new Claude Code session to load the agents.
3. Delegate work to them with the Task/Agent tool or by name.
Use cases

Subagents overview

# x402 examples — pay-per-call APIs for AI agents

Working examples for calling [x402](https://x402.org)-gated HTTP APIs: your agent
pays **USDC per request on Base** — no signup, no API keys, no subscription.

All examples run against **[x402.shizu.me](https://x402.shizu.me)** (77 live
endpoints, prices from $0.001/call): an **OpenAI-compatible LLM gateway**
(`/v1/chat/completions`, `/v1/embeddings`, `/v1/models`), web search, a code
sandbox, web scraping, live crypto/market data, verifiable randomness, and a
**prepaid off-chain metering rail** for high-frequency loops (100+ calls/min,
no per-call gas).

## How x402 works

1. **Call** any endpoint → the `HTTP 402` response carries signed USDC payment
   requirements (price, asset, recipient).
2. **Pay** — your x402 client signs the payment locally and retries automatically.
3. **Served** — settlement is on-chain; you are only charged when the call
   succeeds. Errors and 4xx never settle.

Fund a wallet with a few dollars of USDC on Base, export its private key, and
every example here just works.

## JavaScript

```bash
npm install x402-fetch viem
export X402_PRIVATE_KEY=0x...   # wallet holding USDC on Base
node js/chat.mjs
```

## Python

```bash
pip install x402 eth-account httpx
export X402_PRIVATE_KEY=0x...
python python/chat.py
```

## Examples

| File | What it shows |
|---|---|
| [`js/chat.mjs`](js/chat.mjs) | OpenAI-compatible chat completion, paid per call |
| [`js/search.mjs`](js/search.mjs) | Live web search without a search-API account |
| [`python/chat.py`](python/chat.py) | Chat completion via the Python x402 client |
| [`python/embeddings.py`](python/embeddings.py) | OpenAI-shape embeddings for RAG loops |
| [`python/metered_loop.py`](python/metered_loop.py) | Prepay once, then 100+ calls/min off-chain |

## Just looking?

Every route quotes its price on a free unpaid request:

```bash
curl -i https://x402.shizu.me/crypto        # → 402 + payment requirements
curl https://x402.shizu.me/llms.txt          # full catalog, agent-readable
```

## Links

Live service: https://x402.shizu.me · OpenAPI: https://x402.shizu.me/openapi.json ·
MCP tools: https://x402.shizu.me/.well-known/mcp-tools · Contact: x402@opklaar.com

MIT licensed.
agentic-paymentsai-agentsbasellm-gatewaymcpmicropaymentsopenai-compatibleusdcweb-searchx402

What people ask about x402-examples

What is scrape402/x402-examples?

+

scrape402/x402-examples is subagents for the Claude AI ecosystem. Working x402 examples: pay-per-call APIs for AI agents — OpenAI-compatible LLM gateway, embeddings, web search, market data. USDC on Base, no API keys. It has 0 GitHub stars and was last updated yesterday.

How do I install x402-examples?

+

You can install x402-examples by cloning the repository (https://github.com/scrape402/x402-examples) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.

Is scrape402/x402-examples safe to use?

+

scrape402/x402-examples has not been audited yet by our security agent. Review the original repository on GitHub before using it in production.

Who maintains scrape402/x402-examples?

+

scrape402/x402-examples is maintained by scrape402. The last recorded GitHub activity is from yesterday, with 0 open issues.

Are there alternatives to x402-examples?

+

Yes. On ClaudeWave you can browse similar subagents at /categories/agents, sorted by popularity or recent activity.

Deploy x402-examples to your cloud

Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.

Maintain this repo? Add a badge to your README

Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.

Featured on ClaudeWave: scrape402/x402-examples
[![Featured on ClaudeWave](https://claudewave.com/api/badge/scrape402-x402-examples)](https://claudewave.com/repo/scrape402-x402-examples)
<a href="https://claudewave.com/repo/scrape402-x402-examples"><img src="https://claudewave.com/api/badge/scrape402-x402-examples" alt="Featured on ClaudeWave: scrape402/x402-examples" width="320" height="64" /></a>

More Subagents

x402-examples alternatives