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

  • Testnet (Base Sepolia)
  • Mainnet (Base)
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 Price per Debate

$0.50 USD paid in USDCIncludes:
  • 5 specialized AI agents (CTO, Security Engineer, Solutions Architect, etc.)
  • Up to 5 rounds of debate (default 3)
  • Real-time WebSocket updates
  • Full conversation history
  • 120 seconds maximum processing time
No hidden fees! The price includes all AI model costs, orchestration, and infrastructure.

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!