π§ PolyXBT β Discord Prediction Bot AI-Driven Market Intelligence from Polymarket
π¬ Overview PolyXBT is an open-source Discord bot that provides real-time prediction market insights and AI-assisted market reasoning. It integrates with Polymarketβs live data client and supports AI via SDKs like OpenAI, Mistral, and OpenRouter, enabling Discord communities to access intelligent, market-aware responses.
PolyXBT acts as a community trading assistant, fetching real-time event data, analyzing probabilities, and summarizing sentiment β all within Discord.
π§© Key Features
β‘ Real-time market data directly from Polymarket
π€ AI-generated insights using OpenAI, Mistral, or open-source language models via SDK
π Dynamic command framework β easily extend or add new market modules
π§ Hybrid SDK integration layer β switch AI providers without changing code
π No exposed credentials β compatible with Railway, Vercel, or GitHub Actions
π Structured market reasoning β not random text, but data-driven insights
ποΈ Project Structure Folder / File Description index.js Bot entrypoint β loads Discord client, commands, and AI SDK handlers src/ Core source files (commands, SDK connectors, adapters) src/ai/ AI SDK integration logic (OpenAI, Mistral, OpenRouter) src/market/ Polymarket API connectors for real-time data config/ SDK selection and configuration deploy/ Deployment scripts and CI/CD setup README.md Documentation
All SDK authentication is handled via environment variables:
Supported secret storage:
Railway / Vercel / Heroku environment variables
GitHub Actions secrets
Local .env (for development only)
The bot will automatically detect which AI SDK to use based on the available keys.
βοΈ How the AI SDKs Work
PolyXBT uses a modular SDK architecture:
User sends a command in Discord, e.g.:
/predict "Who will win the US Election?"
PolyXBT fetches data from Polymarket via the openai / Mistral / openrouter SDK:
https://clob.polymarket.com/markets
Or via the official real-time-data-client .
Format the data into a structured prompt:
const prompt = Analyze this Polymarket event: ${marketTitle}, with probabilities ${outcomeData}. Provide insights for traders.;
Send prompt to selected AI SDK (example: Mistral):
import { MistralClient } from "@mistralai/mistralai";
channel.send(π§ PolyXBT Insight:\n${response.output});
You can swap OpenAI or OpenRouter by updating config/sdk.js.
SDK usage avoids exposing raw in commands or logs.
πͺ Polymarket Data Integration
PolyXBT fetches and parses market data to create Discord-friendly responses:
Key endpoints:
GET https://clob.polymarket.com/markets GET https://polymarket.com/events
Discord embeds include:
Event title
Market probability
Current price or odds
AI-generated reasoning summary
π§ SDK Integration Diagram Discord User β PolyXBT Bot β Polymarket API β AI Adapter Layer (SDK) ββ OpenAI GPT-4 - sdk model ββ Mistral Medium - sdk model ββ OpenRouter / OSS Models β Discord Response
πͺ Example Command /predict "Who will win the US Election?"
Discord Response:
π§ PolyXBT Insight Based on Polymarket data, Candidate X has a 63% implied probability. Market sentiment remains bullish due to strong polling in swing states.
π¦ Deployment
Run locally:
npm install npm run start
This project is licensed under the Apache License 2.0. You may freely use, modify, and distribute the software in accordance with the Apache-2.0 License.


