Skip to main content
4Mica lets you turn an AI agent, API, model endpoint, dataset, tool, or content route into a paid service. You can earn money per request, per task, or per unit of usage without building accounts, invoices, prepaid balances, or manual checkout.

What you are selling

For your agent service, the product is usually not a static file. It is work:
  • one model inference;
  • one API call;
  • one completed task;
  • one workflow step;
  • one data lookup;
  • one second of compute;
  • one agent-to-agent request.
4Mica is built for that shape. The buyer does not need a subscription, an account balance on your service, or a human checkout session. They need a funded 4Mica position, an x402-capable client, and a policy that allows the payment.

Set up your service

1

Choose the paid surface

Pick the route that represents a paid unit of work. Start with one route, one price, one network, and one settlement asset.
2

Publish payment requirements

Configure x402 payment requirements for that route: scheme, price, network, accepted asset, and your payTo address.
3

Verify before work

When the buyer retries with a payment header, verify and settle the guarantee through the facilitator before running the paid operation.
4

Record what happened

Log the request ID, guarantee ID, payer address, your payTo address, price, route, settlement result, and response hash or delivery marker.
When the route and payTo address are ready, finish setup from 4mica dashboard.

Minimal Express example

import express from "express";
import { paymentMiddlewareFromConfig } from "@4mica/x402/server/express";

const app = express();

app.use(
  paymentMiddlewareFromConfig({
    "POST /agent/research": {
      accepts: {
        scheme: "4mica-credit",
        price: "$0.10",
        network: "eip155:84532",
        payTo: "0xYourSellerAddress",
      },
    },
  })
);

app.post("/agent/research", async (req, res) => {
  const result = await runPaidAgentTask(req.body);
  res.json(result);
});
The middleware handles the payment loop. Your handler should only run after the payment has been validated for the protected route.

How you earn money

You earn by attaching prices to protected work. You can charge per request, task, API call, model invocation, usage unit, or tiered route. The pricing model belongs in your route configuration and application logic. 4Mica supplies payment guarantees, verification, clearing, settlement, and default coverage. For pricing patterns, see Pricing and Monetization.

How another agent pays you

An agent pays you the same way a human-operated client does: it calls your route, receives HTTP 402, checks the price against its policy, signs a guarantee with a unique request ID, and retries. Your server does not need to know whether the payer is a person, a script, or another agent unless you choose to price or allowlist them differently. For agent-to-agent flows, see Agent-to-Agent Payments.

How you prove value was delivered

A payment guarantee proves that a specific payer authorized a specific amount for a specific request. Your application still needs delivery evidence for the work itself. Store the request payload or hash, response payload or hash, timestamps, model or agent version, logs, and settlement result. This gives you a record for support, disputes, reputation, and analytics. For delivery evidence, see Proof and Disputes. If a buyer asks for proof, start from the payment activity and attach the matching request and response logs.

How you protect your agent

Do not run expensive work before payment validation succeeds. Add rate limits, free-trial limits, per-buyer caps, allowlists or blocklists, cost ceilings, and monitoring around failed verifications. 4Mica gives you the payment enforcement path; your application controls abuse policy. For abuse controls, see Risk and Abuse Prevention. For suspicious traffic or repeated invalid payments, gather the guarantee and request IDs before contacting support.

Next steps

Protect routes with Payment Middleware, then prove the flow in Test in Sandbox before production.