xGate Logo
Pay-Per-Tool AI Agent Router

xGate Logo
Stripe for
Single API Calls

Open source gateway where every tool call is a micro-payment via x402.No accounts. No keys. Just pay-as-you-go.

No Keys Required
Zero Setup
$0.01+ per call
Micro Payments
HTTP 402 Flow
Instant Access
// No API keys needed - just HTTP
const response = await fetch('https://gateway.xgate.fi/tools/ocr', {
  method: 'POST',
  body: JSON.stringify({ image: '...' })
});

// If payment required, get 402 with payment details
if (response.status === 402) {
  const { payment_url, amount } = await response.json();
  await payWithUSDC(payment_url, amount);
  // Retry with payment proof header
  return fetch('https://gateway.xgate.fi/tools/ocr', {
    headers: { 'x-payment-proof': proof }
  });
}

// Done! Get your result
const result = await response.json();

Why Choose xGate?

Open source trust, managed convenience

Open Source

MIT licensed. Self-host if you want, or use our managed gateway for convenience.

Zero Setup

No API keys, no accounts, no infrastructure. Just make HTTP requests and pay per call.

Pay $0.01 per Call

Cheaper than running your own infrastructure ($160+/month). Only pay for what you use.

Trustless Payments

Every transaction is on-chain via x402. No custody, no intermediaries, fully transparent.

Premium API Access

Access GPT-4, Google Vision, AWS, and more. We handle bulk pricing and reliability.

Coming Soon: Marketplace

Developers publish tools, earn 70% revenue share. Users access 100+ tools from one gateway.

Why xGate?

The code is open source. You could self-host. But here's why you won't.

Self-Hosting

$160+/month

Deploy infrastructure: Next.js ($20/mo), Postgres ($10/mo), Redis ($10/mo)

Pay for LLM APIs: OpenAI, Anthropic, Google ($100+/mo)

Setup time: 20+ hours configuring x402, database, monitoring

Maintenance: Updates, security patches, scaling, debugging (5+ hrs/mo)

Tool access: Only tools you build/integrate yourself

Support: Community forums only

Total: $160+/mo + 25+ hours

RECOMMENDED

xGate Hosted

$0.01/call

Zero infrastructure: No servers, no databases, no config

Premium APIs included: GPT-4, Claude, Google Vision at bulk pricing

Instant setup: Make your first call in under 60 seconds

Zero maintenance: 99.9% uptime, auto-scaling, monitoring included

Marketplace access: 100+ tools from multiple developers (coming soon)

Support: Discord community + enterprise SLA available

Total: ~$16 for 1,600 calls

Break-even at just 160 calls/month. After that, 10x cheaper than self-hosting.

The Vercel/Supabase model: Open source builds trust.Managed hosting wins on convenience.

View on GitHub

Pricing Comparison

Open source, but way cheaper than self-hosting. Break-even at just 160 calls/month.

Self-Host (Available Now)

$160+/mo

Deploy your own gateway

  • ❌ Next.js hosting: $20/mo
  • ❌ PostgreSQL: $10/mo
  • ❌ Redis: $10/mo
  • ❌ LLM APIs: $100+/mo
  • ❌ 20+ hours setup
  • ❌ Ongoing maintenance
Self-Host Guide
RECOMMENDED

Hosted (Coming Soon)

$0.01/call

Use our managed gateway

  • ✅ Zero infrastructure
  • ✅ Zero maintenance
  • ✅ Premium API access
  • ✅ 99.9% uptime
  • ✅ Instant setup
  • ✅ ~$16 for 1,600 calls
Coming Soon

Enterprise

$299+/mo

For teams and high-volume users

  • Dedicated infrastructure
  • Advanced analytics
  • Priority support (SLA)
  • Custom rate limits
  • White-label options
  • Volume discounts
Contact Sales

How It Works

Simple HTTP flow with built-in payment handling

01

Make Request

Agent or human hits your endpoint (e.g., /tools/ocr, /tools/vision)

fetch('/tools/ocr', {
  method: 'POST',
  body: JSON.stringify({ image })
})
02

Get 402 Payment Required

Gateway responds with HTTP 402 + payment details (amount, asset, facilitator URL)

HTTP/1.1 402 Payment Required
{
  "amount": "0.02",
  "asset": "USDC",
  "payment_url": "https://facilitator..."
}
03

Auto-Pay & Retry

Client SDK pays automatically (USDC on Base), retries with payment header

// Auto-pay happens
await payWithUSDC(payment_url, amount)

// Retry with proof
fetch('/tools/ocr', {
  headers: { 'x-payment-proof': proof }
})
04

Get Result

Gateway verifies payment, proxies to provider, returns payload

HTTP/1.1 200 OK
{
  "text": "Extracted text...",
  "confidence": 0.98
}

Architecture Flow

See how requests flow through the xGate system

STEP 1

Client Request

Agent or app makes API call

POST /tools/ocr
STEP 2

xGate Gateway

Check payment status

if (!paid) 402
💳
STEP 3

Pay & Retry

USDC on Base chain

x-payment-proof
STEP 4

Get Result

Proxied response

200 OK + data

Built With

Modern stack for maximum performance

Next.js
Fastify
Prisma
Neon
Redis
x402
USDC
Base

Use Cases

Built for agents, developers, and enterprises

AI Agents

Give your agents access to 100+ tools without managing keys, billing, or infrastructure.

Agent pays $0.02 for OCR, $0.01 for web scraping, $0.03 for GPT-4 — all from one gateway.

Developers

Build faster without setting up payment processing, API management, or backend infra.

Prototype your MVP in hours, not weeks. Scale to production without changing code.

Tool Developers (Coming Soon)

Publish your API on our marketplace, earn 70% revenue share with zero infra costs.

Build a sentiment analysis tool, set price at $0.03/call, earn $21 from 1,000 monthly calls.

Enterprises

White-label xGate for your customers or deploy internally with premium support.

Launch your own AI tool marketplace in days. We handle payments, routing, and scaling.

Technical Deep Dive

Implementation details and developer experience

Gateway Implementation

Node/Next.js API routes or Fastify intercept calls like /tools/ocr, /tools/search, /tools/vision. Price map by endpoint (e.g., /vision: $0.03, /scrape: $0.01/KB).

// Next.js API Route
export async function POST(req: Request) {
  const endpoint = req.url.split('/').pop();
  const price = getPrice(endpoint);
  
  if (!hasPaymentProof(req)) {
    return new Response(JSON.stringify({
      amount: price,
      payment_url: facilitatorUrl
    }), { status: 402 });
  }
  
  verifyPaymentProof(req);
  return proxyToProvider(req);
}

Database Schema

Neon + Prisma stores price rules, usage, receipts (tx hash, payer, endpoint, bytes, cost). Built-in analytics and refund tracking.

model Receipt {
  id        String   @id @default(cuid())
  txHash    String   @unique
  payer     String
  endpoint  String
  amount    Decimal
  bytes     Int?
  createdAt DateTime @default(now())
  
  @@index([payer])
  @@index([endpoint])
}

Facilitator Integration

Use Coinbase x402 facilitator (managed) or self-hosted per spec. Sign challenges with facilitator key; verify payment proofs server-side before proxying.

// Verify payment proof
async function verifyPayment(
  proof: string,
  challenge: string
): Promise<boolean> {
  const result = await facilitator.verify({
    proof,
    challenge,
    amount,
    asset: 'USDC'
  });
  return result.valid;
}

Security & DX

Price editing UI, real-time receipts, webhook for payment confirmations, per-tool analytics. Redis for idempotency, Edge Runtime support.

// Developer Console API
PUT /api/prices/:endpoint
{
  "price": "0.03",
  "currency": "USDC",
  "unit": "request"
}

GET /api/analytics?endpoint=/tools/ocr
{
  "requests": 1523,
  "revenue": "30.46",
  "avgResponseTime": "234ms"
}
Live on Pump.fun

$XGATE Token

The official xGate token. Community-driven, launched on Pump.fun.

Contract Address (CA)

KgQvCMw8JD5mDFazXYnN3LC4Fy7j499qzFMYX2opump

Launch Status

🟢 LIVE NOW

Launched on Pump.fun

Blockchain

Solana

SPL Token

Disclaimer: This token is for community and governance purposes. It does not represent equity, ownership, or revenue share in xGate. Always DYOR (Do Your Own Research) before trading.

Ready to Build?

Open source gateway. Managed hosting. Pay $0.01/call instead of $160/month.No signup, no keys, no infrastructure.

# Clone the gateway
git clone https://github.com/xgatefi/xgate.git
cd xgate

# Install dependencies
npm install

# Configure environment
cp .env.example .env

# Start the gateway
npm run dev