CitePay helps AI research tools pay source owners when they cite their work.
AI tools use sources from feeds, blogs, docs, newsletters, and public links. The source owner usually gets no payment path, no usage record, and no claim flow.
CitePay adds a payment and receipt layer at the source/citation boundary. A research product can import sources, map each source to a payee, price citation use, run an agent with a budget, and record what was used, skipped, cached, blocked, or paid.
- Import source links from feeds or source records.
- Map each source to a payee.
- Mark payout state: registered, claimable, missing wallet, unverified, or test wallet.
- Set a citation price.
- Run the research agent with a budget.
- Record used, skipped, cached, blocked, and paid decisions.
- Reconcile payment records into the ledger.
- Feed/source import
- Source pool
- Payee readiness model
- Research-agent run flow
- x402-style paid content endpoint
- Circle/x402 Gateway adapter
- Supabase ledger
- Reconciliation scripts
- Metrics dashboard
CitePay is a Next.js App Router app written in TypeScript. The UI is built with Tailwind CSS. Supabase/Postgres stores source records, agent runs, citations, payments, and reconciled Gateway transfers.
Payment support is split into a local simulation rail and a Circle/x402 Gateway rail on Arc Testnet. A local JSON store exists for development only; deployed environments should use Supabase.
PAYMENT_MODE=simulation is the default for local development. It creates deterministic receipts and does not move funds.
PAYMENT_MODE=circle enables the Circle/x402 Gateway path for configured testnet environments. The no-spend smoke check validates configuration, quote generation, and the paid-resource challenge without signing or settling a payment.
The spend path is guarded by explicit environment variables, a selected source, a maximum amount, and a nonce. Gateway transfer history can be reconciled into the Supabase ledger after a payment attempt.
CitePay currently tracks 4 transfer-linked Circle/x402 Gateway Arc Testnet records totaling 0.26 USDC.
These records prove the payment path moved testnet USDC. They are not settled author earnings. Settled author earnings remains 0.00 unless a verified author wallet receives funds.
npm install
npm run dev
npm run lint
npm run build
npm run smoke:store
npm run smoke:paymentOpen http://localhost:3000 after
pm run dev`.
Existing Supabase deployments should run the current additive migrations before a final demo or release:
docs/supabase-agent-decision-status-migration.sqldocs/supabase-text-cleanup-migration.sql
The first keeps agent decision statuses aligned with the application. The second cleans public display text columns that may contain mojibake from older imports or seed data.
Use .env.example as the template.
Practical notes:
.env.localis not committed.- Supabase service-role keys are server-only.
CIRCLE_RESOURCE_BASE_URLmust match the deployed URL when testing paid resources.PAYMENT_SMOKE_SPENDmust be unset unless intentionally testing a known owned source.ENABLE_AGENT_LIVE_PAYMENTS=falsekeeps/askin no-spend decision-preview mode.
- Open
/feeds. - Paste a public feed URL.
- Preview and import a source.
- Inspect payee status and payment eligibility.
- Open
/askand run the agent against the source pool. - Review used, skipped, cached, blocked, and paid decisions.
- Open
/metricsto inspect payment evidence and receipt trails.
CitePay is testnet-first. It does not provide production custody, KYC, or automated ownership verification.
Third-party public sources are blocked for payment unless they are registered or permissioned. Source ownership verification is manual at this stage. The research agent is deterministic so decision behavior is repeatable during testing.
CitePay is an active product experiment for source-level AI payment infrastructure.