Inspiration
A student opens an AI assistant at midnight and asks, "How does photosynthesis work?" Seconds later, a clear answer appears.
Somewhere, a teacher spent a weekend writing the explanation that answer came from. She will never know it was read. No visit, no credit, no money.
This is happening everywhere. In one year, Stack Overflow lost about a third of its visitors and Chegg about half of its non-subscriber traffic, as people moved from searching the web to asking AI. Today a writer's only defense is to block AI bots, and then nobody wins: the AI gets worse, and the writer still earns nothing.
The web actually planned for this back in 1997. It reserved a special response for it, HTTP 402 "Payment Required", labelled "for future use". Nobody ever used it.
So we asked two questions:
- What if an AI agent simply had to pay for what it reads?
- What stops it from copying the article word for word once it has paid?
Fairfetch answers both.
What it does
Fairfetch is a gateway, a checkpoint that sits in front of any website. When an AI agent asks for a page, it doesn't get the page. It gets a price.
1. Knock: the agent gets a price, not a page. The checkpoint replies "402 Payment Required" with the price, the usage rules (the license) and a short free preview, so the agent can decide if the page is worth paying for.
2. Pay: with PayPal money, within rules a human set. The agent's owner adds money to a wallet once with PayPal Checkout and writes a budget in plain English, like "never more than 5 cents per article and \$1 a day". The agent buys only pages that add something, explains why, and gets a digital ticket (a signed pass) that lets it read that page for a limited time.
3. Prove: the part nobody else does. Before the agent's answer goes out, Fairfetch's license guard compares it with the original page. It catches copied passages, missing credit and expired tickets, fixes them automatically, and issues a signed receipt the writer can check for themselves, without having to trust us.
For writers and publishers, joining takes under a minute: paste your website's address, Fairfetch finds all your pages, an AI suggests a price for each one based on how original it is, you choose the rules and which pages to protect, and you go live. Every paid read appears with 90% of the price and the agent's own reason for buying, and the money is paid out with PayPal Payouts.
Why PayPal fits perfectly: one read costs a few cents, which is far too small for a card payment each time. So Fairfetch works like a prepaid transit card: top up once with PayPal Checkout, pay for many tiny reads from the balance, and pay every publisher together with one PayPal Payouts batch.
How we built it
Fairfetch is three separate pieces, built the way a real payments company would build them.
1. The gateway: the checkpoint in front of every website. It answers "402", checks tickets, and fetches the real page from the publisher's own website for paying agents. It never handles money, which keeps it simple and safe. It lets an agent in only if every one of these is true:
$$ \text{signature valid} \;\wedge\; \text{ticket belongs to this agent} \;\wedge\; \text{ticket is for this page} \;\wedge\; \text{not expired} \;\wedge\; \text{not cancelled} $$
In short: a ticket can't be forged, shared, reused on another page, or used after it expires.
2. The platform: wallets, payments, rules and receipts. Money is stored in whole numbers (one unit is \$0.0001) so there are never rounding errors. Every money movement is recorded as a balanced set of entries, the way accountants do it (double-entry bookkeeping):
$$ \sum_{\text{entries in a transaction}} \text{amount} = 0 $$
In short: money is never created or lost. Whatever leaves one account arrives in another.
When an agent buys a page of price $p$, the money splits in one step:
$$ \text{agent's wallet} \;-p \quad\rightarrow\quad \text{publisher} \;+\,90\% \;\text{ of } p, \qquad \text{Fairfetch} \;+\,10\% \;\text{ of } p $$
In short: the writer gets 90% of every read, instantly.
Records are never edited or deleted (mistakes are corrected with new, reversing entries), and a wallet can never go below zero, even if two purchases happen at the same moment.
3. The AI agent: the reader that pays. It is a real program that searches, reads prices, decides, pays and writes answers. You can watch every one of its requests live on the "Under the hood" page.
How the AI sets a fair price. When a website joins, an AI model scores each page's originality from 0 to 100, which becomes a price between 1 and 5 cents:
$$ \text{price} = 1¢ + 4¢ \times \frac{\text{originality score}}{100} $$
In short: original work, like real test results, earns more than generic tips anyone could write.
How the license guard spots copying. It finds the longest stretch of words that appears, word for word, in both the answer and the original page, and compares it with what the license allows (for example, 8 words):
$$ \text{copying detected} \iff \text{longest identical word run} > \text{words allowed by the license} $$
In short: quoting a short phrase is fine; pasting whole sentences is not. The guard also checks that the source is credited and the ticket is still valid. Problems are rewritten by AI, checked again, and sealed in a signed receipt.
Never charging twice. If an agent crashes and tries again, it sends the same request ID, built from its task and the page:
$$ \text{request ID} = \text{SHA-256}(\text{task} \,|\, \text{page}) $$
In short: the second attempt is recognised as a repeat, so the agent gets its original ticket back instead of paying again. Every PayPal call carries its own request ID for the same reason.
PayPal, in and out.
- PayPal Checkout (Orders v2) adds money to wallets. Before crediting anything, we confirm the payment really completed, for the right amount, in the right currency, for the right order.
- PayPal Payouts pays publishers in whole cents:
$$ \text{payout} = \left\lfloor \frac{\text{balance}}{1¢} \right\rfloor \text{ cents} $$
In short: fractions of a cent stay safely owed until the next payout, and a failed payout is reversed, never lost.
AI throughout, with a safety net.
The agent and the platform use Groq (openai/gpt-oss-120b) for five jobs: choosing what to buy and why, writing answers with credit, rewriting copied passages, turning plain-English budgets into enforced limits, and pricing pages. Every AI step has a non-AI backup, so payments and licensing keep working even if the AI is unavailable.
Sponsor tools.
- Render hosts the live app and three real, separately hosted publisher websites.
- AG Grid powers the publisher's content table: change a price there and the gateway charges the new price immediately.
- Postman includes a "be the agent yourself" collection that walks through the whole process with automatic checks.
Challenges we ran into
- Turning "fair use" into something a computer can check. The rules had to be strict enough to catch copying, yet simple enough for any writer to understand. A word-run limit, a credit check and ticket expiry, always measured against the original page, turned out to be both.
- Keeping money correct when things go wrong. Crashes, retries and simultaneous purchases all had to leave the books balanced. Request IDs, safe database updates and reverse-don't-edit corrections made "never charge twice, never go negative" a guarantee.
- Working with real websites. Publishers live on their own websites, so the gateway fetches real pages, and the license guard reads exactly the same text the agent read.
- Explaining a two-sided product. Writers and agent owners need very different things, so each has its own view and colour, and a guided tour lets anyone click through every real step.
Accomplishments that we're proud of
- The whole journey works for real: PayPal in → price check → AI decision → signed ticket → read from a real website → fair-use check → signed receipt → PayPal out.
- Any website can join live, from its address to paid-and-protected in under a minute.
- The books always balance, checked after every run, and every receipt can be verified by the writer.
- Graceful AI: if the AI is down, the product still works.
What we learned
The 402 "Payment Required" response is a natural fit for AI agents. Unlike people, agents can read a price list and decide in milliseconds whether something is worth buying.
But payment alone doesn't create trust. What matters is what happens after payment: proving the work was used the way its writer allowed. That is where trust between AI and the people who write for the web will be won.
What's next for Fairfetch
- Verified bot identity, so publishers know exactly which AI agent is paying.
- Compatibility with new web standards for paid content (x402 and RSL).
- An MCP server, so any AI agent can use Fairfetch with one line of setup.
- One-click domain setup for any website, plus accounts for publishers and agent owners.
- Refunds when a page doesn't help the agent, so prices stay honest.
Built With
- ag-grid
- alembic
- css3
- docker
- es256
- fastapi
- github-actions
- gpt-oss-120b
- groq
- html5
- javascript
- jwt
- paypal
- paypal-checkout
- paypal-orders-api
- paypal-payouts
- playwright
- postgresql
- postman
- python
- redis
- render
- sarvam-ai
- sqlalchemy