A pay-per-prompt AI chat application that monetizes an Ollama LLM behind the x402 payment protocol. Users connect a wallet, pay micro-amounts in USDC per request, and chat with the model. Responses are generated and signed inside an Oyster CVM TEE for end-to-end verifiability.
x402-ollama is an early-stage TypeScript project in the AI payments / x402 ecosystem. It currently has 1 GitHub stars and 0 forks.
A pay-per-prompt AI chat application that monetizes an Ollama LLM behind the x402 payment protocol. Users connect a wallet, pay micro-amounts in USDC per request, and chat with the model. Responses are generated and signed inside an Oyster CVM TEE for end-to-end verifiability.

┌────────────┐ ┌──────────────────┐ ┌──────────────┐
│ Frontend │──────▶│ x402 Gateway │──────▶│ Ollama │
│ (Next.js) │ x402 │ (Rust / Axum) │ HTTP │ LLM Server │
│ port 5000 │◀──────│ port 3000 │◀──────│ port 11434 │
└────────────┘ └──────────────────┘ └──────────────┘
The gateway is a high-performance Rust/Axum reverse proxy that intercepts HTTP requests, enforces x402 payment, and signs responses.
For full documentation, see marlinprotocol/x402-gateway.
The gateway is configured via a config.json file.
| Field | Description |
|---|---|
gateway_port |
Port the gateway listens on (default 3000) |
facilitator_url |
x402 facilitator service URL (e.g., https://www.x402.org/facilitator) |
target_api_url |
Backend API to proxy requests to (e.g., http://127.0.0.1:11434) |
networks[].type |
Type of blockchain network ("evm" or "solana") |
networks[].network |
Network ID (e.g., "base-sepolia", "solana-devnet") |
networks[].payment_address |
Wallet address for receiving payments (e.g., 0xd232A8b0F63a555d054134f67b298ffE955f3BAf for EVM or EGBQqKn968sVv5cQh5Cr72pSTHfxsuzq7o7asqYB5uEV for Solana) |
protected_routes[].path |
Protected API route (e.g., "/api/chat") |
protected_routes[].usdc_amount |
USDC amount required for accessing the route (e.g., 100) |
A Next.js 16 + React 19 chat interface with wallet integration and x402 payment handling.
cd x402-frotend
npm install
npm run dev
The frontend will start on http://localhost:5000. Open it in your browser, connect your wallet, and start chatting.
| Script | Description |
|---|---|
npm run dev |
Start dev server on port 5000 |
npm run build |
Create optimised production build |
npm start |
Serve production build on port 5000 |
Simulate locally:
oyster-cvm simulate --docker-compose docker-compose.yml \
--init-params "config.json:1:0:file:./config.json" -p 3000
Deploy to production:
oyster-cvm deploy \
--wallet-private-key <key> \
--duration-in-minutes 30 \
--arch amd64 \
--docker-compose docker-compose.yml \
--init-params "config.json:1:0:file:./config.json"
Get the expected public key from Oyster KMS:
oyster-cvm kms-derive \
--image-id <IMAGE_ID> \
--path signing-server \
--key-type secp256k1/public
If both public keys match, the response is verified as originating from the expected Oyster enclave running the correct image.
EVM Mainnets: Base, Polygon, Avalanche, Sei, XDC, XRPL EVM, Peaq, IoTeX, Celo
EVM Testnets: Base Sepolia, Polygon Amoy, Avalanche Fuji, Sei Testnet, Celo Sepolia
Solana: Mainnet, Devnet
The agent-native LLM router for autonomous agents. 55+ models (8 free), <1ms local routing, USDC payments on Base & Solana via x402.
A payments protocol for the internet. Built on HTTP.
A local-first AI agent with persistent memory, emotional intelligence, and a peer-to-peer skills economy.
The trust layer for agent-to-agent commerce — natural-language mandates, ERC-7710 delegated permissions, x402 payments, escrow, and dispute resolution as one open, catch-all Agent Skill / Claude Code plugin.
Self-healing infrastructure for AI agent payments. 90.3% auto-recovery.
The AI agent with a wallet — spends USDC autonomously to get real work done. Apache-2.0, TypeScript.