🦀 ClawHub
Metered API Marketplace
by @arshingleton
Build and operate a metered public API endpoint ("agent microservice") for OpenClaw skills/agents with API-key auth, per-request usage logging + pricing, pre...
TERMINAL
clawhub install metered-api-marketplace📖 About This Skill
name: metered-api-marketplace description: 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.
Metered API Marketplace
Provide a production-lean template for: OpenClaw Skill → Public API Endpoint → Usage Metering → Crypto Payment Gateway → BTC/ETH wallets.
This skill ships a runnable reference server (Fastify + SQLite) that:
Workflow (do this in order)
1) Pick the productized capability (the thing people pay for)
Choose ONE transformer that is:Good defaults:
If unclear, start with the included revenue-amplifier transformer and replace it later.
2) Run the reference server locally
Use the bundled server inscripts/server/.Typical run:
cd scripts/servernpm installcp .env.example .env and editnpm run devSet flat launch pricing in .env:
COST_CENTS_PER_CALL=25 # $0.25/call3) Create an API key
Usescripts/server/admin/create_key_pg.js (or the admin HTTP endpoint) to create a key and starting balance.4) Integrate from an OpenClaw skill / agent
Call the public endpoint with:x-api-keyx-timestamp (unix ms)x-signature = hex(HMAC_SHA256(api_secret, ${timestamp}.${rawBody}))5) Add real payments
Wire a payment processor webhook to/v1/payments/webhook/:provider.Providers are adapter-based:
6) Ship
Deploy behind TLS (Cloudflare / Fly.io / Render / AWS / GCP). Put rate limiting at the edge + in-app.Bundled resources
scripts/server/
Runnable reference implementation:scripts/nextjs-starter/
Vercel-ready Next.js API implementation:listen())references/
Read only when needed:references/api_reference.md – endpoint contracts + auth/signingreferences/billing_ledger.md – pricing, fee logic, idempotencyreferences/providers.md – provider adapters (Coinbase/BTCPay patterns)