A web application that uses multiple LLMs via the OpenRouter API to help users design well-defined prediction market questions through a multi-stage drafting, review, and refinement process.
PM_tools guides users through a four-stage workflow to produce unambiguous, objective prediction markets:
The user provides a prediction market question, start/end dates, and selects a drafting model. The LLM generates a comprehensive market draft that includes:
- A refined, unambiguous question
- Detailed resolution criteria
- A complete set of mutually exclusive outcomes
- Edge case handling
- Potential sources for resolution
Inspired by the llm-council "Structure D" deliberation model, multiple reviewer models critique the draft:
- Independent Review — Up to 4 different models independently review the draft in parallel.
- Deliberation — If 2+ reviews succeed, the first reviewer acts as "chairman" and synthesizes a consolidated deliberated review incorporating insights from all reviewers.
- Human Feedback — The user can optionally add their own critiques before proceeding.
The original drafting model incorporates the deliberated review and any human feedback to produce an improved draft that addresses the identified issues.
The final draft is converted into structured JSON containing:
- Array of outcomes, each with resolution criteria
- Market start/end times in UTC
- Short description
- Full resolution rules
- Edge cases documentation
All sections are copyable to clipboard.
src/
├── App.jsx # Main UI component and workflow orchestration (~600 lines)
├── main.jsx # React entry point
├── api/
│ └── openrouter.js # OpenRouter API client with exponential backoff retries
├── hooks/
│ └── useMarketReducer.js # Central state management via useReducer
├── components/
│ └── ModelSelect.jsx # Reusable model selection dropdown
└── constants/
├── models.js # LLM model definitions and defaults
└── prompts.js # System prompts and prompt builders for each stage
- State management uses React's
useReducer(via theuseMarketReducercustom hook) rather than an external state library, keeping the dependency footprint minimal. - Prompt engineering is centralized in
src/constants/prompts.jswith distinct system prompts for the drafter, reviewer, and finalizer roles, plus builder functions for each stage's user prompt. - API resilience — The OpenRouter client (
src/api/openrouter.js) implements automatic retries with exponential backoff (3 retries at 1s/2s/4s intervals). - Model flexibility — 20+ models are available across 6 providers (OpenAI, Anthropic, Google, DeepSeek, Meta, Mistral). Default drafting model is GPT-5.1; default reviewer is Claude 3.5 Haiku.
- React 19 with Vite for development and bundling
- OpenRouter API for LLM inference
- No additional runtime dependencies beyond React and React-DOM
- Node.js 20+
- An OpenRouter API key
npm installCreate a .env file (or set the environment variable directly):
VITE_OPENROUTER_API_KEY=your_openrouter_api_key
npm run devThe app runs at http://localhost:5000.
npm run build
npm run previewnpm run lint