Skip to content

Add x402 monetization - let AI agents pay per API call#2

Open
sam00101011 wants to merge 1 commit intoMackDing:mainfrom
sam00101011:add-x402-monetization
Open

Add x402 monetization - let AI agents pay per API call#2
sam00101011 wants to merge 1 commit intoMackDing:mainfrom
sam00101011:add-x402-monetization

Conversation

@sam00101011
Copy link

@sam00101011 sam00101011 commented Mar 15, 2026

What is this?

x402 is an open protocol that lets AI agents pay for API calls using the HTTP 402 status code. Instead of API keys and billing dashboards, agents pay per call in USDC on Base.

This PR adds the foundation for monetizing MackDing/CodexClaw's API endpoints. We found 10 endpoints in your README that agents could pay to access.

Why agents would pay for MackDing/CodexClaw

Each of these capabilities becomes a pay-per-call endpoint that AI agents discover and pay for automatically:

  • Remote Codex access via Telegram for seamless mobile coding workflows — agents pay per call instead of needing credentials or rate-limited free tiers
  • Context-aware session management scoped to specific chats and repositories — agents pay per call instead of needing credentials or rate-limited free tiers
  • Automated task routing between Codex SDK, CLI, and specialized subagents — agents pay per call instead of needing credentials or rate-limited free tiers
  • Integrated GitHub and MCP subagents for direct repository and tool control — agents pay per call instead of needing credentials or rate-limited free tiers
  • Proactive cron-based automation for daily summaries and push notifications — agents pay per call instead of needing credentials or rate-limited free tiers

With x402, every feature above is instantly monetizable. Agents on Claude, Cursor, and any MCP client can discover and pay for access via 402.bot.

What's included

File Purpose
.well-known/x402.json Declares your endpoints, pricing, and wallet address - agents and routing networks use this for discovery
x402-middleware-example.ts Drop-in middleware that returns 402 and verifies payments

How it works

Agent -> calls your API
     <- 402 Payment Required (price: $0.01, wallet, network)
Agent -> signs USDC payment on Base
     -> retries with x-payment header
     <- normal API response

Settlement is instant. No intermediary holds funds. Revenue goes directly to your wallet.

What you'd earn

~$1500/mo projected (10 endpoints x ~150 agent calls/mo x $0.01)

To activate

  1. Replace YOUR_WALLET_ADDRESS in .well-known/x402.json with your Base wallet
  2. Add the middleware to your server (see x402-middleware-example.ts)
  3. Deploy - your API is now discoverable by every agent on the 402.bot routing network

Your endpoints will automatically appear in Claude, Cursor, and any MCP-compatible agent via the 402.bot MCP server.

Live demo

See how MackDing/CodexClaw works on the x402 network ->

Links


This PR was opened by 402.bot. x402 is an open protocol - you keep 100% of revenue. We just route agents to providers. If this isn't relevant, feel free to close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant