API DOCUMENTATION

Real-time predictive markets & AI-powered analysis

01

CLOUDFLARE WORKER

Primary API gateway handling all public endpoints. Built on Cloudflare Workers for edge deployment.

brightbet.tech/api/* VIEW ENDPOINTS →
02

QUANT ENGINE

Python FastAPI backend for data aggregation. Scrapes Polymarket, Finnhub, Wikipedia, and computes confidence scores.

localhost:8000/api/* VIEW ARCHITECTURE →
03

X402 PAYMENTS

Stripe-based payment gateway implementing the x402 protocol for micropayments and paywalled content.

/api/rickroll (paywalled) VIEW PROTOCOL →
04

AI GENERATION

Cloudflare Workers AI for cinematic image builds and meme synthesis using Stable Diffusion XL.

/api/generate-image VIEW AI ENDPOINTS →

// QUICK START

CURL get-ai-opinion
curl -X POST https://brightbet.tech/api/get-ai-opinion \
  -H "Content-Type: application/json" \
  -d '{"question": "Will Tesla hit $500 by 2026?"}'
RESPONSE JSON
{
  "confidence_score": 72,
  "sentiment": "bullish",
  "reasoning": "Based on current trajectory...",
  "sources": { ... }
}
CURL generate-image
curl -X POST https://brightbet.tech/api/generate-image \
  -H "Content-Type: application/json" \
  -d '{"question": "Visualize a neon planet surrounded by auroras", "sentiment": "neutral", "confidence": 64}'
RESPONSE JSON
{
  "type": "image",
  "prompt": "A glowing planet floating in deep space...",
  "sentiment": "neutral",
  "confidence": 64,
  "imageData": "data:image/png;base64,...."
}

// SYSTEM ARCHITECTURE

FRONTEND

  • React 18 / Vite
  • TypeScript
  • Three.js Visuals

BACKEND

  • Cloudflare Workers
  • Workers AI (SDXL)
  • KV Asset Store

QUANT ENGINE

  • FastAPI / Python 3
  • Llama 3.3 70B
  • Multi-Source Scraping

// DATA SOURCES (PLANETS)

The solar-system metaphor maps each planet to a unique data provider:

STOCKS: Finnhub CRYPTO: CoinGecko MARKETS: Polymarket SENTIMENT: Reddit MACRO: FRED KNOWLEDGE: Wikipedia

// ENDPOINT OVERVIEW

METHOD ENDPOINT DESCRIPTION
GET /api/health Health check with status metadata.
POST /api/get-ai-opinion Multi-source AI market reasoning.
POST /api/visualize Build planet visualization payload (GET with ?question= supported).
GET /api/planet-categories Retrieve UI category metadata.
POST /api/generate-image AI visualization image (alias: /api/generate-video).
POST /api/generate-meme Premium AI meme generator after x402 payment.
POST /api/candles OHLC + prediction series for charting.