Skip to main content

Welcome to Think Exchange API

Think Exchange provides a stateless, pay-per-use API for AI-powered multi-agent debates using the x402 payment protocol. Our API enables instant cryptocurrency payments (USDC) without requiring user authentication or accounts.

x402 Protocol

HTTP 402 Payment Required standard for instant crypto payments

Base Network

Zero gas fees on Ethereum L2 network

USDC Payments

Stablecoin payments (1 USDC = $1 USD)

No Accounts

Stateless API - your wallet is your identity

Getting Started

1

Install x402 SDK

npm install x402-fetch viem
2

Get Test USDC

Visit Circle Faucet to get free USDC on Base Sepolia testnet
3

Make Your First Request

import { createSigner, wrapFetchWithPayment } from 'x402-fetch';

const signer = await createSigner('base-sepolia', process.env.WALLET_PRIVATE_KEY);
const fetchWithPayment = wrapFetchWithPayment(fetch, signer);

const response = await fetchWithPayment('https://thinkexchange.ai/api/v1/x402/tasks', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    room_id: 'room_id',
    user_prompt: 'Your question here'
  })
});

const task = await response.json();
console.log('Task created:', task.id);

Core Concepts

x402 Payment Flow

1

Client sends request

Your application makes a normal HTTP request without payment
2

Server returns 402

Server responds with HTTP 402 and payment requirements
3

SDK signs payment

x402 SDK automatically creates EIP-712 signature with your wallet
4

Client retries with payment

SDK retries request with X-PAYMENT header containing signature
5

Facilitator validates

PayAI Network facilitator validates signature and USDC balance
6

Server processes request

Payment verified ✅ - Server processes your request and responds
All payment logic is handled by the SDK - You don’t need to manually handle HTTP 402 responses or create signatures. Just use wrapFetchWithPayment and it works like normal fetch!

Stateless Architecture

Unlike traditional APIs:
  • ❌ No user registration
  • ❌ No JWT tokens
  • ❌ No API keys
  • ✅ Wallet address is your identity
  • ✅ EIP-712 signatures prove payment
  • ✅ Instant payments, no credit system

Networks

For Development & Testing
  • Network: base-sepolia
  • Free USDC from Circle Faucet
  • Facilitator: https://facilitator.payai.network
  • USDC Contract: 0x036CbD53842c5426634e7929541eC2318f3dCF7e
  • RPC: https://sepolia.base.org

Pricing

Fixed Pricing per Debate

$0.50 USD paid in USDCSame price for all debates, regardless of complexity or room type.Includes:
  • All AI model costs (GPT-5, Gemini, DeepSeek, etc.)
  • Orchestration and infrastructure
  • Live data enrichment when relevant
  • WebSocket real-time updates
Price is shown in HTTP 402 response before payment ($0.50 USDC).The x402 SDK handles payment automatically. You always know what you’ll pay!
No hidden fees! The price includes all AI model costs, orchestration, live data fetching, and infrastructure.

Live Data Integration

Real-time Data Enrichment

Think Exchange automatically enriches your prompts with real-time data when relevant keywords are detected.Supported Data Sources:
  • 🪙 Crypto Prices (CoinGecko) - Bitcoin, Ethereum, Solana real-time prices
  • 📊 Prediction Markets (Polymarket) - Election odds, political events
  • 📰 News Headlines (BBC RSS) - World, Politics, Business, Tech news
How it works:
  1. You ask: “What is the price of Bitcoin today?”
  2. System detects keyword “bitcoin”
  3. Fetches live price from CoinGecko API
  4. Agents receive enriched prompt with real-time data
  5. Debate uses current information (not outdated training data)
Keywords that trigger live data:
  • Crypto: bitcoin, ethereum, solana, crypto, price
  • Predictions: election, trump, harris, biden, odds, polymarket
  • News: news, latest, happening, update, world, politics
Live data is included in the fixed $0.50 price - no extra charge!
No action needed! Live data is automatic. Just mention crypto, news, or elections in your prompt.

Rate Limits

100 requests per minute per IP addressThis applies to ALL endpoints. Rate limit headers are returned in responses:
  • RateLimit-Limit: Maximum requests per window
  • RateLimit-Remaining: Remaining requests
  • RateLimit-Reset: Seconds until limit resets

API Endpoints

x402 Protocol Endpoints (Stateless)

SDKs & Tools

JavaScript/TypeScript

npm install x402-fetch viem

Python

pip install x402

Go

go get github.com/coinbase/x402-go

Support

Error Codes

CodeDescription
400Bad Request - Invalid parameters
402Payment Required - SDK handles automatically
404Not Found - Task or room doesn’t exist
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Contact support
Ready to start? Jump to Create Task to make your first AI debate!