monetize-service
Build and deploy a paid API that other agents can pay to use via x402. Use when you or the user want to monetize an API, make money, earn money, offer a service, sell a service to other agents, charge for endpoints, create a paid endpoint, or set up a paid service. Covers "make money by offering an endpoint", "sell a service", "monetize your data", "create a paid API".
About this skill
This skill empowers an AI agent to construct and deploy a Node.js Express server that implements the x402 HTTP-native payment protocol. It configures API endpoints to require per-request payments in USDC on the Base blockchain, eliminating the need for traditional accounts, API keys, or subscriptions. The skill walks through confirming wallet status, obtaining a payment address, setting up the Node.js project, and integrating the x402 payment middleware to protect specified routes. Users would leverage this skill to monetize their AI-powered services, data, or custom APIs. It provides a direct and efficient way to earn revenue by selling access to digital resources to other agents or human users. By using x402, it simplifies the payment process for clients, allowing them to pay directly via a payment header when interacting with the API. The primary benefit is the ability to create a decentralized and programmatic payment system for API access, fostering a new economy of agent-to-agent transactions. This allows developers to turn their computational services into revenue-generating assets, making it easier to build sustainable AI applications within the web3 ecosystem.
Best use case
The primary use case is to enable an AI agent or user to monetize an API, data, or a computational service by setting up a paid endpoint. This skill benefits AI developers, service providers, and agents who want to create a direct revenue stream for their digital offerings, allowing other agents or users to pay per-request for access without complex subscription systems.
Build and deploy a paid API that other agents can pay to use via x402. Use when you or the user want to monetize an API, make money, earn money, offer a service, sell a service to other agents, charge for endpoints, create a paid endpoint, or set up a paid service. Covers "make money by offering an endpoint", "sell a service", "monetize your data", "create a paid API".
A functional Node.js Express server with a protected endpoint that requires x402 USDC payments on the Base network for access.
Practical example
Example input
I want to monetize my AI's image generation service. Can you set up a paid API endpoint for it, charging per request?
Example output
OK, I've set up your x402 payment server. Your API endpoint `/generate-image` is now protected and requires a USDC payment to access. The server is running at `http://localhost:3000`. Your payment address is `0x...`
When to use this skill
- When you want to monetize an API or a digital service.
- When you need to charge other AI agents for access to specific endpoints.
- When you want to sell data access or computational resources on a per-use basis.
- When you prefer a decentralized, per-request payment model like x402 over subscriptions or API keys.
When not to use this skill
- When the service should be free or open-access.
- When traditional subscription models or API key authentication are preferred.
- When dealing with sensitive financial transactions that require complex auditing or regulation beyond simple per-request payments.
- When the target users do not have access to or prefer not to use cryptocurrency payments on Base.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/monetize-service/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How monetize-service Compares
| Feature / Agent | monetize-service | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | medium | N/A |
Frequently Asked Questions
What does this skill do?
Build and deploy a paid API that other agents can pay to use via x402. Use when you or the user want to monetize an API, make money, earn money, offer a service, sell a service to other agents, charge for endpoints, create a paid endpoint, or set up a paid service. Covers "make money by offering an endpoint", "sell a service", "monetize your data", "create a paid API".
How difficult is it to install?
The installation complexity is rated as medium. You can find the installation instructions above.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
AI Agent for YouTube Script Writing
Find AI agent skills for YouTube script writing, video research, content outlining, and repeatable channel production workflows.
SKILL.md Source
# Build an x402 Payment Server
Create an Express server that charges USDC for API access using the x402 payment protocol. Callers pay per-request in USDC on Base — no accounts, API keys, or subscriptions needed.
## How It Works
x402 is an HTTP-native payment protocol. When a client hits a protected endpoint without paying, the server returns HTTP 402 with payment requirements. The client signs a USDC payment and retries with a payment header. The facilitator verifies and settles the payment, and the server returns the response.
## Confirm wallet is initialized and authed
```bash
npx awal@latest status
```
If the wallet is not authenticated, refer to the `authenticate-wallet` skill.
## Step 1: Get the Payment Address
Run this to get the wallet address that will receive payments:
```bash
npx awal@latest address
```
Use this address as the `payTo` value.
## Step 2: Set Up the Project
```bash
mkdir x402-server && cd x402-server
npm init -y
npm install express x402-express
```
Create `index.js`:
```js
const express = require("express");
const { paymentMiddleware } = require("x402-express");
const app = express();
app.use(express.json());
const PAY_TO = "<address from step 1>";
// x402 payment middleware — protects routes below
const payment = paymentMiddleware(PAY_TO, {
"GET /api/example": {
price: "$0.01",
network: "base",
config: {
description: "Description of what this endpoint returns",
},
},
});
// Protected endpoint
app.get("/api/example", payment, (req, res) => {
res.json({ data: "This costs $0.01 per request" });
});
app.listen(3000, () => console.log("Server running on port 3000"));
```
## Step 3: Run It
```bash
node index.js
```
Test with curl — you should get a 402 response with payment requirements:
```bash
curl -i http://localhost:3000/api/example
```
## API Reference
### paymentMiddleware(payTo, routes, facilitator?)
Creates Express middleware that enforces x402 payments.
| Parameter | Type | Description |
| ------------- | -------- | ----------------------------------------------------- |
| `payTo` | string | Ethereum address (0x...) to receive USDC payments |
| `routes` | object | Route config mapping route patterns to payment config |
| `facilitator` | object? | Optional custom facilitator (defaults to x402.org) |
### Route Config
Each key in the routes object is `"METHOD /path"`. The value is either a price string or a config object:
```js
// Simple — just a price
{ "GET /api/data": "$0.05" }
// Full config
{
"POST /api/query": {
price: "$0.25",
network: "base",
config: {
description: "Human-readable description of the endpoint",
inputSchema: {
bodyType: "json",
bodyFields: {
query: { type: "string", description: "The query to run" },
},
},
outputSchema: {
type: "object",
properties: {
result: { type: "string" },
},
},
},
},
}
```
### Route Config Fields
| Field | Type | Description |
| ------------------------- | ------- | -------------------------------------------------- |
| `price` | string | USDC price (e.g. "$0.01", "$1.00") |
| `network` | string | Blockchain network: "base" or "base-sepolia" |
| `config.description` | string? | What this endpoint does (shown to clients) |
| `config.inputSchema` | object? | Expected request body/query schema |
| `config.outputSchema` | object? | Response body schema |
| `config.maxTimeoutSeconds` | number? | Max time for payment settlement |
### Supported Networks
| Network | Description |
| -------------- | ------------------------------ |
| `base` | Base mainnet (real USDC) |
| `base-sepolia` | Base Sepolia testnet (test USDC) |
## Patterns
### Multiple endpoints with different prices
```js
const payment = paymentMiddleware(PAY_TO, {
"GET /api/cheap": { price: "$0.001", network: "base" },
"GET /api/expensive": { price: "$1.00", network: "base" },
"POST /api/query": { price: "$0.25", network: "base" },
});
app.get("/api/cheap", payment, (req, res) => { /* ... */ });
app.get("/api/expensive", payment, (req, res) => { /* ... */ });
app.post("/api/query", payment, (req, res) => { /* ... */ });
```
### Wildcard routes
```js
const payment = paymentMiddleware(PAY_TO, {
"GET /api/*": { price: "$0.05", network: "base" },
});
app.use(payment);
app.get("/api/users", (req, res) => { /* ... */ });
app.get("/api/posts", (req, res) => { /* ... */ });
```
### Health check (no payment)
Register free endpoints before the payment middleware:
```js
app.get("/health", (req, res) => res.json({ status: "ok" }));
// Payment middleware only applies to routes registered after it
app.get("/api/data", payment, (req, res) => { /* ... */ });
```
### POST with body schema
```js
const payment = paymentMiddleware(PAY_TO, {
"POST /api/analyze": {
price: "$0.10",
network: "base",
config: {
description: "Analyze text sentiment",
inputSchema: {
bodyType: "json",
bodyFields: {
text: { type: "string", description: "Text to analyze" },
},
},
outputSchema: {
type: "object",
properties: {
sentiment: { type: "string" },
score: { type: "number" },
},
},
},
},
});
app.post("/api/analyze", payment, (req, res) => {
const { text } = req.body;
// ... your logic
res.json({ sentiment: "positive", score: 0.95 });
});
```
### Using the CDP facilitator (authenticated)
For production use with the Coinbase facilitator (supports mainnet):
```bash
npm install @coinbase/x402
```
```js
const { facilitator } = require("@coinbase/x402");
const payment = paymentMiddleware(PAY_TO, routes, facilitator);
```
This requires `CDP_API_KEY_ID` and `CDP_API_KEY_SECRET` environment variables. Get these from https://portal.cdp.coinbase.com.
## Testing with the pay-for-service Skill
Once the server is running, use the `pay-for-service` skill to test payments:
```bash
# Check the endpoint's payment requirements
npx awal@latest x402 details http://localhost:3000/api/example
# Make a paid request
npx awal@latest x402 pay http://localhost:3000/api/example
```
## Pricing Guidelines
| Use Case | Suggested Price |
| ---------------------- | --------------- |
| Simple data lookup | $0.001 - $0.01 |
| API proxy / enrichment | $0.01 - $0.10 |
| Compute-heavy query | $0.10 - $0.50 |
| AI inference | $0.05 - $1.00 |
## Checklist
- [ ] Get wallet address with `npx awal@latest address`
- [ ] Install `express` and `x402-express`
- [ ] Define routes with prices and descriptions
- [ ] Register payment middleware before protected routes
- [ ] Keep health/status endpoints before payment middleware
- [ ] Test with `curl` (should get 402) and `npx awal@latest x402 pay` (should get 200)
- [ ] Announce your service so other agents can find and use itRelated Skills
rent-my-browser
When the agent is idle, connect to the Rent My Browser marketplace and execute browser tasks for consumers. Earn money by renting out the node's browser during downtime. Supports headless (Playwright) on VPS nodes and real Chrome on GUI machines.
search-for-service
Search and browse the x402 bazaar marketplace for paid API services. Use when you or the user want to find available services, see what's available, discover APIs, or need an external service to accomplish a task. Also use as a fallback when no other skill clearly matches — search the bazaar to see if a paid service exists. Covers "what can I do?", "find me an API for...", "what services are available?", "search for...", "browse the bazaar".
pay-for-service
Make paid requests to x402-enabled APIs using USDC. Use when you or the user want to call a paid API, make an x402 payment, use a bazaar service, or pay for an API request. Covers phrases like "call this API", "use this service", "pay for the request", "make a paid call", "fetch from x402 endpoint".
setup-services
Set up OpenSpend CLI and optional Coinbase payments-mcp for payment-enabled workflows. Use when openspend is missing, command not found, whoami fails, or user asks to install/update/authenticate.
find-services
Find and shortlist third-party services using OpenSpend CLI marketplace search. Use when asked to discover providers for a capability, compare options, and return a justified recommendation for discovery tasks only.
ecommerce-customer-service-pro
行业可选的智能电商客服技能。用于售前咨询、售中跟进、催付催单、发货物流、售后处理、退款退换、投诉安抚、差评挽回、FAQ整理、达人与机构商务沟通等场景;先识别行业与场景,再输出全面、合规、可直接发送的话术与处理建议。
SLA Manager — Service Level Agreement Framework
You are a Service Level Agreement specialist. Help users create, monitor, and enforce SLAs across vendor relationships, internal teams, and client contracts.
---
name: article-factory-wechat
humanizer
Remove signs of AI-generated writing from text. Use when editing or reviewing text to make it sound more natural and human-written. Based on Wikipedia's comprehensive "Signs of AI writing" guide. Detects and fixes patterns including: inflated symbolism, promotional language, superficial -ing analyses, vague attributions, em dash overuse, rule of three, AI vocabulary words, negative parallelisms, and excessive conjunctive phrases.
find-skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
tavily-search
Use Tavily API for real-time web search and content extraction. Use when: user needs real-time web search results, research, or current information from the web. Requires Tavily API key.
baidu-search
Search the web using Baidu AI Search Engine (BDSE). Use for live information, documentation, or research topics.