ARC-TESTNET · LIVEANSWERS SERVED: 105PAID TO CREATORS: $16.38 USDCAVG ANSWER COST: $0.19REGISTERED SOURCES: 20PAY-PER-PROMPT · NO SUBSCRIPTIONSCIRCLE W3S · USDC SETTLEMENTS

Documentation

Everything you need to know about using CiteFlowAI, whether you are researching topics or registering your own intellectual property.

What is CiteFlowAI?

CiteFlowAI is a decentralized AI research terminal designed to fix the creator compensation problem in generative AI. Currently, AI models are trained on millions of articles, but the original authors receive no compensation when their work is used to generate answers.

CiteFlowAI changes this by introducing Pay-Per-Prompt Citations. When our AI agent synthesizes an answer using a registered knowledge base, it explicitly cites its sources and uses Circle Programmable Wallets to instantly execute USDC nanopayments to the original creators on the Arc Testnet.

For Researchers (Users)

1. Connect a Web3 Wallet (No Seed Phrase Needed)

You don't need a crypto extension like MetaMask to use CiteFlowAI. We use Circle's User-Controlled Wallets to generate a secure Web3 wallet bound to your email address, which acts as your universal login!

  • Click Connect Wallet in the top navigation bar.
  • Enter your email address and verify with the One-Time Password (OTP).
  • Create a secure PIN code to authorize future transactions.
  • You are now invisibly authenticated to our backend! Your wallet address is your identity.

2. Get Testnet USDC

Since CiteFlowAI currently operates on the Arc Testnet, you need free Testnet USDC to pay for AI prompts.

  • Copy your connected wallet address from the top navigation bar.
  • Click the blue Droplet Icon in the navigation bar to open the Circle Faucet.
  • Paste your address and request USDC on the Arc Testnet.
  • Wait a few seconds, and your balance will automatically update in the app!

3. Ask the AI

Once your wallet is funded, you can query the AI. You set a "Max Budget" for the prompt (e.g., $0.50).

  • The funds are temporarily authorized using your PIN code.
  • The AI retrieves relevant articles from our vector database and writes an answer.
  • Based on which articles were actually cited, the smart contract settles the payment, distributing the exact citation fees to the respective authors.

For Creators (Authors)

1. Universal Identity (Circle + Supabase)

There are no separate "user" or "creator" accounts, and absolutely no passwords. Your Circle Wallet is your entire identity. The moment you connect your wallet via the navbar, our backend automatically maps your address to your creator profile. You never have to manually configure payment settings!

2. Verify Ownership (Required Before Registering)

Before you can register an article, you must prove you actually control where it lives. This exists so nobody else can register your work and collect the citation payments meant for you — CiteFlowAI will not create a source from a domain or platform handle you haven't verified, full stop.

  • Open the Verify Ownership panel on your Dashboard — it shows a unique verification code tied to your account.
  • Prove control of a domain (add a meta tag or a /.well-known/citeflow.txt file with the code), an X account (post the code in a tweet), a Medium profile, a Substack, or an Arc House account (publish the code in a post on a public board) — then paste the link back into the panel.
  • Once verified, that identity is permanently and exclusively yours — enforced at the database level, not just in the UI. You can then register any article on that domain or handle without repeating this step.
  • You can verify as many domains and platforms as you actually own; there's no limit.

3. Registering Articles

Navigate to the Register Work page. Here, you can upload the contents of your research, blog posts, or intellectual property.

  • Provide the Title, URL, and the full content of your article.
  • Set your own Citation Price in USDC (e.g., $0.10 per citation).
  • Your content is chunked, embedded into our Vector Database, and made available to the AI agent.

4. Tracking Earnings

The Dashboard provides a live view of your intellectual property.

  • View all your registered articles.
  • See exactly how many times each article has been cited by the AI.
  • Watch your USDC balance grow in real-time as users interact with the network.

For Agents & Developers (x402 API)

CiteFlowAI can also be called directly by other autonomous agents — no CiteFlow account, API key, or PIN prompt. The/api/agent/researchendpoint speaks the x402 protocol: send a request with no payment and it returns an HTTP 402 challenge; retry with a signed, gasless payment authorization and it settles the payment and returns a grounded, cited answer in one round trip.

Direct SDK requirements

  • Any standard EVM keypair — this isn't tied to Circle's wallet product; a plain private key works.
  • Testnet USDC and a small amount of native gas on Arc Testnet, free from the Circle Faucet.
  • For direct SDK integrations, a one-time on-chain deposit into Circle's Gateway Wallet contract is required. Holding USDC alone isn't enough — it must be deposited into Gateway before any signed authorization can spend it. This step costs gas; every payment after it is gasless. The MCP integration performs this deposit automatically when needed.
  • The @circle-fin/x402-batching client library (or any client that implements Circle Gateway's batched signing scheme).

Try it from scratch

A complete, standalone example — no CiteFlow code required. Run these in an empty folder:

mkdir citeflow-test && cd citeflow-test
npm init -y
npm install @circle-fin/x402-batching

Save this as test-x402.mjs in that folder — the .mjs extension runs it as ESM without needing to edit package.json:

import { GatewayClient } from '@circle-fin/x402-batching/client'

const client = new GatewayClient({
  chain: 'arcTestnet',
  privateKey: '0xYOUR_PRIVATE_KEY',
  rpcUrl: 'https://rpc.drpc.testnet.arc.network', // the default RPC is rate-limited
})

await client.deposit('1.00') // one-time, funds your Gateway balance

const { data } = await client.pay(
  'https://citeflowai.xyz/api/agent/research?q=' +
    encodeURIComponent('your research question here')
)

console.log(data.answer)            // grounded, cited answer
console.log(data.purchasedSources)  // which creators just got paid

Replace 0xYOUR_PRIVATE_KEY and 'your research question here' with your own values first — the script will still run and settle payment even if you forget, it just comes back with a response explaining no real question was asked, instead of an error.

Then run it:

node test-x402.mjs

Each call is a fixed $1.00 USDCbudget. Whatever isn't spent on citations is refunded back to the paying wallet — the same refund mechanism used for human researchers. Citation payments to creators are executed exactly as they are for human researchers too, regardless of which side paid.

Circle Agent Wallet

Circle Agent Wallet provides a managed alternative to supplying a raw EVM private key. The Circle CLI logs in the agent wallet, inspects the x402 challenge, checks or funds its Gateway balance, estimates the charge, and pays the same research endpoint after user confirmation.

circle services pay   "https://citeflowai.xyz/api/agent/research?q=YOUR_ENCODED_QUESTION"   --address 0xYOUR_AGENT_WALLET_ADDRESS   --chain ARC-TESTNET   --estimate   --output json

Estimate first and show the price, network, seller, and question before paying. The Agent Wallet must have enough Arc Testnet Gateway balance; a regular wallet balance is not automatically available for x402 payments.

Read the complete Circle Agent Wallet guide

Even easier: MCP integration

If your agent runs on MCP (Claude, Codex, Antigravity, OpenCode, Cursor, or your own agent framework), you don't need to write any x402 signing code at all. We publish a small, self-contained MCP server — mcp-server/ in the CiteFlow repo — that exposes the endpoint as a single tool: citeflow_research. It handles the Gateway deposit, signing, and payment internally; your agent just calls the tool with a question.

Set a longer tool-call timeout.A real call settles an on-chain payment and typically takes 60–100+ seconds. Most MCP clients default to a 60-second tool-call timeout, right at the edge of that, so calls will intermittently fail with a timeout error even though nothing is wrong. Set your client's per-server timeout to at least 3 minutes; the exact field is shown for each client below.

Setup:

git clone https://github.com/vickman787/citeflowAI
cd citeflowAI/mcp-server
npm install
export CITEFLOW_PRIVATE_KEY=0xYOUR_PRIVATE_KEY

Then point your MCP client at it, e.g. in Claude Desktop's config:

{
  "mcpServers": {
    "citeflow": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-server/index.mjs"],
      "timeout": 180000,
      "env": {
        "CITEFLOW_PRIVATE_KEY": "0xYOUR_PRIVATE_KEY",
        "CITEFLOW_RESEARCH_URL": "https://citeflowai.xyz/api/agent/research"
      }
    }
  }
}

CITEFLOW_RESEARCH_URLis actually optional — it already defaults to this production endpoint — but it's shown explicitly here so the example is copy-pasteable as-is.

Restart your client and ask it to research something — it calls citeflow_research on its own when relevant. The MCP server auto-deposits into Gateway the first time it needs to, so there's no manual Gateway deposit step. You only need testnet USDC and Arc Testnet gas for that automatic deposit. Full details in mcp-server/README.md.

Works the same with Codex, Antigravity, and OpenCode

Same server, same tool — CLI, IDE extension, or desktop app all work. Only the config format and location differ, since each client is a separate, independently-built product.

Claude Code (CLI or VS Code extension) uses the identical .mcp.json format shown above — same file, same shape, whether it's the desktop app, CLI, or extension.

Codex (CLI or IDE extension — they share one config) uses TOML, not JSON, at ~/.codex/config.toml:

[mcp_servers.citeflow]
command = "node"
args = ["/absolute/path/to/mcp-server/index.mjs"]
tool_timeout_sec = 180

[mcp_servers.citeflow.env]
CITEFLOW_PRIVATE_KEY = "0xYOUR_PRIVATE_KEY"
CITEFLOW_RESEARCH_URL = "https://citeflowai.xyz/api/agent/research"

Antigravity (desktop app or CLI) uses the same JSON shape as Claude, but a different file — global config at ~/.gemini/config/mcp_config.json, or workspace-local at .agents/mcp_config.json. In the desktop app you can also add it via MCP Servers → Manage MCP Servers → View raw config instead of editing the file directly. If Antigravity exposes a per-server timeout setting, set it to at least 3 minutes for the same reason as above.

One gotcha specific to Antigravity: adding the server isn't enough on its own — it also has a separate permissions screen (MCP Tools) where tools must be explicitly allowed before the agent can call them. If the tool connects but calls silently do nothing, add an Allow rule for citeflow_research there.

OpenCode (CLI) uses opencode.json or opencode.jsonc, either globally at ~/.config/opencode/opencode.jsonc or project-local in your working directory (project-local is the one OpenCode reliably picks up):

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "citeflow-research": {
      "type": "local",
      "command": ["node", "/absolute/path/to/mcp-server/index.mjs"],
      "enabled": true,
      "timeout": 180000,
      "environment": {
        "CITEFLOW_PRIVATE_KEY": "0xYOUR_PRIVATE_KEY"
      }
    }
  }
}

One gotcha specific to OpenCode: after editing the config, fully quit and relaunch OpenCode, not just start a new chat — MCP servers are loaded once at process startup.

Circle Web3 Architecture

CiteFlowAI is built on top of Circle Web3 Services to provide a seamless, gasless experience for non-crypto native users while maintaining decentralized settlement.

  • User-Controlled Wallets: We use Circle's Web SDK to generate embedded wallets via Email OTP. No seed phrases are required.
  • Master Treasury Escrow: To prevent forcing researchers to manually sign 5 separate transactions to pay 5 different authors, CiteFlowAI uses a Master Treasury Wallet. Researchers sign a single PIN-authorization for their "Max Budget" which is routed to the Treasury.
  • Programmatic Smart Contract Routing: Once the AI agent finishes a task and determines which sources were cited, our backend securely uses Circle's Developer-Controlled Wallets API to execute batch nanopayments from the Treasury directly to the cited authors.
  • Arc Testnet: All transactions are executed securely on the Arc Testnet using USDC.