Watch Grok (xAI's AI) autonomously play through Pokémon Red, Blue, or Yellow! This web application lets viewers watch in real-time as the AI makes decisions, catches Pokémon, battles trainers, and works toward becoming the Pokémon Champion.
- Autonomous AI Gameplay: Grok analyzes the game screen and makes intelligent decisions using the xAI Vision API
- Real-time Viewer Experience: Watch the game with live playtime counter, action log, and AI commentary
- ROM Upload Support: Upload your own Pokemon Red, Blue, or Yellow ROM files
- Game State Tracking: View current Pokémon team, items, location, badges, and more
- AI Commentary: Read Grok's thoughts and reasoning as it plays
- Action Log: Track every button press and game action in real-time
- Loop Detection: Smart detection to prevent the AI from getting stuck
- Python 3.8+
- PyBoy emulator
- Flask web framework
- xAI API Key (for autonomous gameplay)
- A legal copy of Pokémon Red/Blue/Yellow ROM (not included)
git clone https://github.com/NYTEMODEONLY/grok-plays-pokemon.git
cd grok-plays-pokemon
pip install -r requirements.txtCopy the example environment file and add your xAI API key:
cp .env.example .envEdit .env and add your xAI API key:
XAI_API_KEY=your_xai_api_key_here
Get your API key from: https://console.x.ai/
python app.pyGo to http://localhost:8000
- Upload your legally obtained Pokémon ROM file (.gb or .gbc)
- Click "Start Game"
- Watch as Grok plays autonomously!
See the setup documentation for detailed instructions.
The web interface allows you to:
- Upload Pokemon Red, Blue, or Yellow ROM files
- Start and stop the game
- Select which AI controls the player and Pokémon
- Toggle between single AI and dual AI modes
- Watch the game screen, AI commentary, and action log in real-time
- View detailed game state including Pokemon team, items, and location
For advanced users, you can run the AI controller from the command line:
python multi_ai_controller.py --player grok --pokemon claude --mode dualSee the multi-AI documentation for more details.
The application exposes several API endpoints:
| Endpoint | Method | Description |
|---|---|---|
/api/status |
GET | Get emulator and game status |
/api/state |
GET | Get current game state |
/api/gameplay_stats |
GET | Get playtime and action statistics |
/api/screenshot |
GET | Get current game screenshot |
/api/upload_rom |
POST | Upload a ROM file |
/api/start_game |
GET | Start the game |
/api/stop_game |
GET | Stop the game |
/api/autonomous/start |
POST | Start autonomous AI gameplay |
/api/autonomous/stop |
POST | Stop autonomous AI gameplay |
- Screen Capture: The PyBoy emulator captures the game screen
- AI Analysis: The screenshot is sent to xAI's Grok Vision API
- Decision Making: Grok analyzes the screen and decides the next button press
- Execution: The action is executed in the emulator
- Commentary: Grok provides real-time commentary explaining its decisions
- Repeat: The loop continues autonomously
Comprehensive documentation is available in the docs directory:
This project is licensed under the MIT License - see the LICENSE file for details.
For full functionality with the Game Boy emulator, deploy on a server that supports Python native extensions:
# On your server
git clone https://github.com/NYTEMODEONLY/grok-plays-pokemon.git
cd grok-plays-pokemon
pip install -r requirements.txt
cp .env.example .env
# Edit .env with your XAI_API_KEY
python app.pyRecommended platforms: DigitalOcean, Linode, AWS EC2, Railway, Render
The Vercel deployment provides the AI decision-making API only. The emulator must run separately:
- Deploy to Vercel:
vercel deploy - Set
XAI_API_KEYin Vercel environment variables - The API endpoints will be available for external emulator clients
# Build and run with Docker
docker build -t grok-plays-pokemon .
docker run -p 8000:8000 -e XAI_API_KEY=your_key grok-plays-pokemon| Variable | Required | Description |
|---|---|---|
XAI_API_KEY |
Yes | Your xAI API key for Grok Vision |
FLASK_ENV |
No | Set to production for deployment |
PORT |
No | Server port (default: 8000) |
- PyBoy for the Game Boy emulator
- xAI for the Grok Vision API
- Original Pokémon game creators (Game Freak and Nintendo)
This project is not affiliated with or endorsed by Nintendo, Game Freak, The Pokémon Company, or xAI. Pokémon is a registered trademark of Nintendo. The creators of this project do not distribute any copyrighted ROM files.