Who's smarter: the crowd or the model?
PolyHubAI is an AI-powered prediction market explorer that enables you to compare AI-generated probabilities with live Polymarket odds. Discover where artificial intelligence diverges from collective market wisdom in real-time.
- Live Market Data: Real-time market feeds from Polymarket Gamma API
- AI Probability Analysis: GPT-powered forecasts that sum to 1.0 for every outcome
- Edge Detection: Instantly spot where AI thinks the market is mispriced
- Comparative Visualization: Side-by-side probability bars with smooth animations
- Dark Trading UI: Professional, crypto-native interface with gradient accents
- Animated Transitions: Smooth Framer Motion animations on cards and probability bars
- Fast & Lightweight: Optimized Next.js 14 with server-side rendering
- Read-Only Interface: No wallet connections, no trading capabilities
- Informational Only: Designed for research and analysis, not financial advice
- Open Source: Transparent codebase you can audit and fork
- Node.js 18+ and npm
- OpenAI API key (get one here)
-
Clone the repository
git clone https://github.com/polyhub-sol/polyhubai.git cd polyhubai -
Install dependencies
npm install
-
Configure environment variables
Create a
.env.localfile in the project root:OPENAI_API_KEY=sk-your-openai-api-key-here OPENAI_MODEL=gpt-4o-mini
Note:
gpt-4o-miniis recommended for cost efficiency, but you can usegpt-4ofor more accurate forecasts. -
Run the development server
npm run dev
-
Open your browser
Navigate to http://localhost:3000
- Browse Markets: Visit
/marketsto see live Polymarket questions sorted by volume - Select a Market: Click any market card to view detailed analysis
- Compare Probabilities: See AI vs market probabilities side-by-side with animated bars
- Read AI Reasoning: Review the AI's explanation and bullet points for its forecast
- View on Polymarket: Click "Open on Polymarket" to see the original market
- AI Probabilities: Structured forecasts generated by OpenAI that must sum to 1.0
- Market Probabilities: Current implied probabilities from Polymarket trading activity
- Edge: The difference (AI - Market) shows where the model sees opportunities
- Reasoning: Natural language explanation of the AI's forecast logic
polyhubai/
โโโ app/
โ โโโ api/
โ โ โโโ markets/
โ โ โโโ route.ts # Markets list endpoint
โ โ โโโ [id]/
โ โ โโโ route.ts # Single market endpoint
โ โ โโโ ai/route.ts # AI analysis endpoint
โ โโโ markets/
โ โ โโโ page.tsx # Markets listing page
โ โ โโโ [id]/
โ โ โโโ page.tsx # Market detail page
โ โ โโโ view.tsx # Market detail client component
โ โโโ agent-manager/
โ โ โโโ page.tsx # Agent manager (coming soon)
โ โโโ layout.tsx # Root layout with navbar/footer
โ โโโ page.tsx # Landing page
โ โโโ globals.css # Global styles
โโโ components/
โ โโโ MarketCard.tsx # Market card component
โ โโโ AIResultPanel.tsx # AI analysis display
โ โโโ ProbabilityBars.tsx # Animated probability comparison
โ โโโ ReasoningFeed.tsx # AI reasoning display
โโโ lib/
โ โโโ polymarket.ts # Polymarket Gamma API client
โโโ package.json
- Next.js 14: React framework with App Router
- TypeScript: Type-safe development
- Tailwind CSS: Utility-first styling
- Framer Motion: Smooth animations and transitions
- Custom dark theme with gradient accents and glow effects
- OpenAI API: GPT models for probability forecasting
- Polymarket Gamma API: Real-time market data
- ESLint: Code quality and consistency
- PostCSS: CSS processing
- Market Fetching: Server-side requests to Polymarket Gamma API fetch active markets
- Market Selection: User clicks a market to view detailed analysis
- AI Analysis: OpenAI receives market context and generates:
- Probability distribution (must sum to 1.0)
- Reasoning text
- Bullet points
- Optional sources
- Comparison Display: UI shows side-by-side comparison with animated probability bars
- Edge Calculation: System calculates
edge = AI_probability - Market_probabilityfor each outcome
- Read-only AI vs market explorer
- Live Polymarket Gamma integration
- OpenAI-powered probability forecasts
- Polished comparison UI
- Embedded wallets (account abstraction)
- Basic strategy templates
- User accounts and watchlists
- Market alerts and notifications
- Agent-powered auto trading
- Configurable trading playbooks
- Risk controls and position limits
- Detailed execution logs and P&L tracking
Note: Trading features are not yet live. Final features, jurisdictions, and integrations will depend on compliance and partner constraints.
| Variable | Description | Required | Default |
|---|---|---|---|
OPENAI_API_KEY |
Your OpenAI API key | โ Yes | - |
OPENAI_MODEL |
OpenAI model to use | โ No | gpt-4o-mini |
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes: Keep commits small and focused
- Test thoroughly: Ensure no breaking changes
- Submit a pull request: Describe your changes clearly
- Follow the existing code style
- Add JSDoc comments for new functions
- Keep components small and focused
- Use TypeScript types everywhere
- Test UI changes across screen sizes
This project is licensed under the MIT License - see the LICENSE file for details.
PolyHubAI is for informational and research purposes only.
- This tool does not provide financial or betting advice
- AI-generated probabilities may be inaccurate or outdated
- Always verify data independently before making decisions
- Trading on Polymarket is subject to their Terms of Service
- Respect jurisdictional restrictions and local regulations
Use at your own risk. The authors are not responsible for any losses or damages.
- GitHub Repository: polyhub-sol/polyhubai
- Twitter: @PolyHubAI
- Polymarket: polymarket.com
- Polymarket for providing the Gamma API
- OpenAI for GPT models
- The open-source community for amazing tools
Built with โค๏ธ by the PolyHubAI team
From research terminal to auto-trading cockpit โ one commit at a time.