Open x402 protocol, paid in USDC
Pseudonymization and anonymization for AI agents, paid per call with x402
An AI agent sends a text, receives the price, pays in USDC and gets the text back pseudonymized or anonymized. No sign-up, no API key, no subscription: the agent handles it alone, in two HTTP requests.
Processed in the European Union, with no third-party AI. Nothing is kept.
POST /x402/v1/anonymize-text{"text": "Hi, I'm Marie Durand…", "mode": "pseudonymize"}402 Payment RequiredPAYMENT-REQUIRED: exact price, Base network, USDCPOST /x402/v1/anonymize-textsame request + PAYMENT-SIGNATURE200 OKpseudonymized text; payment settled only now
All it takes
- a USDC wallet on Base
- an x402 library
- a text of up to 100,000 characters
How a call works, step by step
Two HTTP requests. The agent knows the price before signing, and the payment is settled only if the text is returned.
x402: payment built into the web
x402 is an open payment protocol for the web. It finally puts HTTP status code 402 "Payment Required" to use: the code was planned in the early days of the web but never used, for lack of a suitable way to pay. The server states its price in a 402 response, the client pays and sends its request again. The protocol is run by the x402 Foundation, under the Linux Foundation.
For an AI agent, this is the missing piece. Opening an account, entering a card, storing an API key: those steps are made for humans. With x402, the agent finds the service, reads the price, pays for the call and carries on with its task, with no one stepping in.
Two modes
Pseudonymize replaces each piece of data with a stable label: the same person keeps the same label throughout the text, so a model can reason correctly without knowing who is involved.
Text sent
The agreement between John Smith and Morrison Partners sets a fee of £14,500.
Text returned, pseudonymize mode
The agreement between [PERSON_1] and [ORG_1] sets a fee of [AMOUNT_1].
Anonymize replaces the data for good, with no way back: the right choice when the text will be stored, shared or used as training data.
What agents do with it
A support agent
It pseudonymizes each ticket before sending it to the model that writes the summary.
Training data
The agent anonymizes real conversations before adding them to a training or evaluation dataset.
A monitoring agent
It removes personal data from collected emails or messages before storing or sharing them.
A third-party agent
It finds Safe-Doc in its workflow, reads the price, pays for the call and carries on, with no human creating an account.
A prototype
A developer tests a pipeline on real texts without taking out a subscription.
x402 or an account with an API key?
Both use the same engine. For documents and complete processes, see the MCP server.
| x402 | Account with API key | |
|---|---|---|
| Sign-up | None | Safe-Doc account, from the Pro plan |
| Payment | Per call, in USDC | Monthly subscription |
| What is processed | Text, up to 100,000 characters per call | Text, PDF, Word, spreadsheets, document batches |
| For whom | Autonomous agents, occasional use, trials | Regular use, teams, documents |
| Access | Any x402-compatible library | REST API, MCP server, Claude skill, Chrome extension |
Price and guarantees
- A price stated before you pay. It depends on the length of the text, up to 100,000 characters per call, and is given exactly in the 402 response. You can set a per-call cap in the agent's code.
- Paid only if the text is returned. If processing fails, nothing is charged. Without an account, 20 short texts (up to 5,000 characters) per day per IP address remain free.
- The same engine, in Europe. No third-party AI reads the text, nothing is kept, and Safe-Doc never has access to the agent's wallet.
For developers
The raw call, then the same thing with the x402 library for fetch, which chains the two requests on its own. The mode field is anonymize or pseudonymize.
POST /x402/v1/anonymize-text
Host: safe-doc.ai
Content-Type: application/json
{"text": "Hi, I'm Marie Durand.",
"mode": "anonymize"}
# response 1: 402 Payment Required
# PAYMENT-REQUIRED header = the price
# same request + PAYMENT-SIGNATURE header
# response 2: 200 OK, the anonymized text
// npm install @x402/fetch @x402/evm viem
import { x402Client, wrapFetchWithPayment } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const signer = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY);
const client = new x402Client();
registerExactEvmScheme(client, { signer });
const fetchWithPayment = wrapFetchWithPayment(fetch, client);
const res = await fetchWithPayment(
"https://safe-doc.ai/x402/v1/anonymize-text", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ text: "Hi, I'm Marie Durand.",
mode: "pseudonymize" }),
});
console.log(await res.json());
The agent's wallet must hold USDC on the Base network. Equivalent libraries exist for axios, Python and Go.
FAQ
Do I need a Safe-Doc account?
No. The agent pays for each call, with no sign-up and no key. For regular use or for documents (PDF, Word, spreadsheets), an account with an API key is a better fit.
How much does a call cost?
The price depends on the length of the text. It is stated exactly in the 402 response, before any payment.
What if processing fails?
Nothing is charged: the payment is settled only if the text is returned.
Which currency, on which network?
USDC, a digital currency pegged to the dollar, on the Base network.
Can I send a PDF or a Word file?
Not with x402, which processes text. Documents go through the API with an account, or through the MCP server.
Does Safe-Doc keep the text?
No. The text is processed in the European Union, with no third-party AI, and nothing is kept after processing.
Can I limit what my agent spends?
Yes. The agent knows the price before signing, and you can set a per-call cap in its code.
Our guides on this topic
One text, one price, one signed request.
For documents, batches and complete processes, the API and the MCP server take over with an account.
