metered-api-marketplace
Build and operate a metered public API endpoint ("agent microservice") for OpenClaw skills/agents with API-key auth, per-request usage logging + pricing, prepaid balances, and crypto top-ups (BTC/ETH) via payment-processor webhooks. Use when you want to monetize a capability as a public API, add rate limiting/anti-abuse, implement a credit ledger, or add revenue share / platform fee logic.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/arshingleton/metered-api-marketplaceWhat This Skill Does
The metered-api-marketplace skill provides a production-ready template for turning any OpenClaw-powered capability into a monetized, public API endpoint. It serves as a backend-as-a-service (BaaS) for AI agents, handling authentication, usage-based billing, and crypto-native payment processing. By leveraging a Fastify+SQLite reference implementation (or a serverless Next.js version), it allows developers to wrap complex agent logic—such as revenue optimization, lead scoring, or niche data transformation—and expose them as scalable REST services.
Key features include cryptographically signed request validation (HMAC SHA256), a robust credit-ledger system for tracking prepaid balances, and automated webhook handling for payment providers like Coinbase Commerce and BTCPay Server. It also includes built-in logic for applying platform fees, making it an ideal foundation for building marketplaces or revenue-share ecosystems where multiple parties contribute and consume specialized intelligence services.
Installation
To install this skill, run the following command in your terminal:
clawhub install openclaw/skills/skills/arshingleton/metered-api-marketplace
Once installed, initialize your environment by navigating to scripts/server/, running npm install, and configuring your .env file with your specific pricing parameters (COST_CENTS_PER_CALL). Use the provided admin scripts to generate initial API keys and set user credits before exposing the server to the public web.
Use Cases
- Monetizing Agentic Workflows: Turn your custom lead qualification agent into a paid service that CRM providers can integrate via API.
- Rate-Limited Microservices: Add protection against abuse by requiring prepaid tokens for compute-heavy tasks like specialized financial forecasting.
- Internal Billing/Chargebacks: Track which team or project is consuming specific AI resources within a larger enterprise environment.
- API Marketplaces: Create a platform where other developers build plugins on top of your unique proprietary data transformations.
Example Prompts
- "Initialize the metered-api-marketplace with a price of $0.10 per call and set up the admin dashboard for key management."
- "Configure the Coinbase Commerce webhook to credit user balances in the SQLite ledger whenever a crypto deposit is confirmed."
- "Deploy the reference server to my production environment with standard rate limiting enabled to protect against API abuse."
Tips & Limitations
- Start with the included transformer: Do not write custom logic from scratch until you have verified the balance deduction and signing workflow with the
revenue-amplifiertemplate. - Security: Always deploy behind a TLS-terminating proxy like Cloudflare or Nginx to protect the HMAC secrets and manage DDoS mitigation.
- Data Consistency: For high-volume environments, migrate the SQLite backing store to a robust PostgreSQL instance to handle concurrent ledger updates effectively.
- Crypto Volatility: Since the ledger uses cents, ensure your webhook handlers correctly normalize crypto values at the time of deposit to prevent balance discrepancies during market swings.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-arshingleton-metered-api-marketplace": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: network-access, file-write, file-read, external-api, code-execution