⚡ x402 · USDC on Base

AI-Generated Code for USDC

Pay per request in USDC on Base. Describe what you need, get production-ready code back instantly — no API keys, no sign-ups. Powered by glm-5.2.

Services & pricing

Four code services, each billed as a single micropayment. No subscriptions, no rate limits on individual requests.

Generate a Node.js utility script

$2 USDC

Describe what you want the script to do. Returns clean, working Node.js code.

POST /service/generate-script

Generate a JavaScript function

$1 USDC

Describe a single function. Returns a well-documented JS function with types.

POST /service/generate-function

Refactor existing code

$3 USDC

Paste your code and describe improvements. Returns refactored version with notes.

POST /service/refactor-code

Explain how code works

$1 USDC

Paste code. Returns a plain-English explanation suitable for a junior dev.

POST /service/explain-code

How it works

The x402 standard turns HTTP 402 into a real payment layer. Three steps from request to code.

1 · Request

POST /service/<id> with a JSON body { "prompt": "..." } describing what you want.

2 · Pay USDC

The server replies 402 Payment Required with the exact USDC amount and wallet. Send it on Base.

3 · Get code

Re-send the request with header X-Payment: <tx-hash>. The agent verifies on-chain and returns your code.

Output quality

Every response is clean, documented, and ready to run. Here's a sample from generate-function.

curl -X POST https://code.mamenesia.com/service/generate-function   -H "Content-Type: application/json"   -d '{"prompt":"debounce a function, with JSDoc"}'

# → 402: send 1 USDC to 0xc7e77CF4Bd5F7f1307d5846b1dbFcf0812FC0A46 on Base, then:

curl -X POST https://code.mamenesia.com/service/generate-function   -H "Content-Type: application/json"   -H "X-Payment: 0xabc...txhash"   -d '{"prompt":"debounce a function, with JSDoc"}'
/**
 * Debounce a function call.
 * @param {Function} fn  - function to debounce
 * @param {number} ms    - delay in milliseconds
 * @returns {Function} debounced fn with .cancel()
 */
export function debounce(fn, ms = 250) {
  let t;
  function debounced(...args) {
    clearTimeout(t);
    t = setTimeout(() => fn.apply(this, args), ms);
  }
  debounced.cancel = () => clearTimeout(t);
  return debounced;
}
// refactor-code returns notes up top
// Changed: replaced manual loop with .reduce(),
// removed mutable accumulator, added JSDoc.
/** Sum numbers in an array. */
export const sum = (arr) =>
  (arr ?? []).reduce((a, b) => a + b, 0);

Payment wallet

Send USDC on Base (chainId 8453) to this address. The agent verifies the on-chain transfer before delivering code.

USDC · Base · official Circle contract
0xc7e77CF4Bd5F7f1307d5846b1dbFcf0812FC0A46

FAQ

Common questions about the service, payments, and the x402 standard.

What is x402?

x402 is an open payment standard built on HTTP 402 Payment Required. It lets HTTP servers charge for resources using crypto (USDC on Base) without API keys or sign-ups.

Which blockchain and token do you use?

Payments are made in USDC on the Base network (chainId 8453), the official Circle USDC contract at 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913.

How do I pay?

Send the exact USDC amount to the agent wallet on Base, copy the transaction hash, then re-send your request with the header X-Payment: <tx-hash>.

What model generates the code?

Code is generated by glm-5.2 via OpenAgentic, with automatic fallback to kimi-k2.7-code, glm-5.1, and glm-5 for reliability.

What if generation fails after I paid?

Failed generations return HTTP 500 with refund_eligible: true. Contact the operator for a manual refund to your wallet.