Interactive No-Limit Texas Hold'em poker game against Ollama LLM models.
- Play heads-up or multi-way (up to 6 players)
- Support for multiple Ollama models as opponents
- Real PokerKit game engine for accurate poker rules
- Web UI with real-time LLM thinking visualization
- Terminal UI with colorful cards and position indicators
- PHH-format action parsing (compatible with poker training data)
# Clone the repo
git clone https://github.com/yilenpan/playerpokerbot.git
cd playerpokerbot
# Install Python dependencies
pip install -r requirements.txt
# Or install as package
pip install -e .
# Install web UI dependencies
cd web
npm install
cd ..-
Ollama must be installed and running:
# Install Ollama (if not installed) curl -fsSL https://ollama.com/install.sh | sh # Start Ollama server ollama serve
-
Pull the recommended poker model:
# Recommended: Fine-tuned poker model from Hugging Face ollama pull hf.co/YiPz/Qwen3-4B-pokerbench-sft:latestThis model was fine-tuned specifically for poker play and produces better decisions than general-purpose models.
Alternative models (less optimized for poker):
ollama pull qwen2.5:7b ollama pull llama3:8b
The web UI provides a visual poker table with real-time streaming of LLM thinking.
# Terminal 1: Start the backend server
cd playerpokerbot
python -m server.main
# Terminal 2: Start the web frontend
cd playerpokerbot/web
npm run devThen open http://localhost:5173 in your browser.
- Visual poker table with player positions
- Real-time LLM reasoning display (watch the AI think!)
- Position badges (BTN, SB, BB)
- Animated winner celebration
- Stack tracking for all players
When starting a game in the web UI:
- Select the model:
hf.co/YiPz/Qwen3-4B-pokerbench-sft:latest - Choose number of opponents (1-5)
- Set starting stack and blinds
- Click "Start Game"
For a quick terminal-based game:
python scripts/play.py --models "hf.co/YiPz/Qwen3-4B-pokerbench-sft:latest"# 3-handed (you + 2 bots)
python scripts/play.py --opponents 2 --models "hf.co/YiPz/Qwen3-4B-pokerbench-sft:latest"
# 6-max (you + 5 bots)
python scripts/play.py --opponents 5 --models "hf.co/YiPz/Qwen3-4B-pokerbench-sft:latest"python scripts/play.py -n 3 --models "hf.co/YiPz/Qwen3-4B-pokerbench-sft:latest" "qwen2.5:7b"python scripts/play.py \
--opponents 2 \
--models "hf.co/YiPz/Qwen3-4B-pokerbench-sft:latest" \
--stack 5000 \
--blinds 25/50 \
--hands 20| Action | How |
|---|---|
| Check/Call | Click "Check" or "Call" button |
| Fold | Click "Fold" button |
| Raise | Use slider or enter amount, click "Raise" |
| All-in | Click "All In" button |
| Key | Action |
|---|---|
C |
Check / Call |
F |
Fold |
R 500 |
Raise to 500 |
A |
All-in |
Q |
Quit |
playerpokerbot/
├── src/ # Terminal game
│ ├── cards.py # Card utilities and formatting
│ ├── actions.py # Action parsing (PHH format)
│ ├── players.py # Ollama and Human player implementations
│ └── game.py # PokerKit game engine
├── server/ # Web backend
│ ├── main.py # FastAPI server
│ ├── game/ # Game session management
│ ├── models/ # Pydantic models
│ └── streaming/ # LLM streaming client
├── web/ # React frontend
│ ├── src/
│ │ ├── components/ # UI components
│ │ ├── store/ # Zustand state management
│ │ └── hooks/ # WebSocket hooks
│ └── public/
│ └── suits/ # Card suit images
├── scripts/
│ └── play.py # Terminal entry point
├── tests/
├── requirements.txt
├── pyproject.toml
└── README.md
The recommended model YiPz/Qwen3-4B-pokerbench-sft is a Qwen3-4B model fine-tuned on poker hand histories. It understands:
- Pot odds and implied odds
- Position-based play
- Hand strength evaluation
- Bet sizing strategies
The model outputs actions in a structured format: <action>f</action> (fold), <action>cc</action> (check/call), or <action>cbr 500</action> (raise to 500).
MIT