So I've built this rather fun web app where AI models have a go at each other in a modern twist on the classic Turing Test. Basically, one AI tries to convince another that it's human, whilst the interrogator AI attempts to expose the whole charade.
This system orchestrates some genuinely fascinating conversations between AI models:
- The Participant: An AI model that gets detailed instructions to act human, complete with personality, memories, and emotions (it's surprisingly good at this!)
- The Interrogator: An AI model that asks probing questions to suss out whether it's chatting to a human or another AI
- Real-time Battle: You can watch the whole conversation unfold live in your browser
- Intelligent Judgement: The interrogator makes a final verdict based on the entire conversation
- Battle Archive: All conversations get saved to a database for later analysis (some are absolute crackers)
- 300+ AI Models: Choose from OpenRouter's extensive model catalog
- Live Conversation Stream: Watch the battle happen in real-time
- Smart Model Selection: Pick different models for different roles (creative vs analytical)
- Conversation History: All battles are saved with full context and verdicts
- Clean Web Interface: Simple, responsive design focused on the conversation
- Configurable Questions: Set how many rounds the interrogator gets
- Python 3.7+
- OpenRouter API key (get one here)
-
Clone and setup
git clone https://github.com/shakermakerk/turing_test_battle.git cd turing_test_battle python -m venv venv # Create virtual environment source venv/bin/activate # Enable virtual environment python setup.py # Installs dependencies and creates .env
-
Add your API key Edit
.env
and add your OpenRouter API key -
Run the application
python run.py
-
Open your browser Navigate to
http://localhost:5001
-
Clone the repository
git clone https://github.com/your-username/turing_test_battle.git cd turing_test_battle
-
Create and enable Virtual Environment
python -m venv venv source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Set up your API key
cp .env_example .env # Edit .env and add your OpenRouter API key
-
Run the application
python webapp/app.py
- Select Models: Choose a "Participant" model (tries to act human) and an "Interrogator" model (tries to detect AI)
- Set Questions: Decide how many questions the interrogator gets to ask (5-20 recommended)
- Start Battle: Watch as the interrogator tries to expose the participant
- See the Verdict: The interrogator makes a final judgment: Human or AI?
- Backend: Flask web server with real-time streaming
- Frontend: Vanilla JavaScript with Server-Sent Events
- Database: SQLite for conversation storage
- AI API: OpenRouter for access to 300+ models
turing_test_battle/
โโโ webapp/
โ โโโ app.py # Flask web server
โ โโโ static/ # CSS/JS assets
โ โโโ templates/ # HTML templates
โโโ game.py # Core Turing test logic
โโโ prompts.py # System prompts for each role
โโโ database.py # SQLite database management
โโโ get_models.py # OpenRouter model fetching
โโโ requirements.txt # Python dependencies
GET /
- Main web interfaceGET /api/models
- List available AI modelsGET /api/check_api_key
- Verify API key statusGET /api/play
- Start a game (Server-Sent Events stream)
Interrogator: "Tell me about a childhood memory that still makes you smile."
Participant: "Oh, that's easy! When I was about 7, my dad and I built this absolutely terrible birdhouse together. We used way too much glue, the roof was crooked, and we painted it this hideous orange color. But every morning that summer, I'd run outside to check if any birds had moved in. They never did, but I was so proud of that ugly little house."
Interrogator: "What did the wood smell like when you were building it?"
Participant: "You know, it's funny you ask that. I remember it smelled like... sawdust, obviously, but also kind of sweet? My dad said it was because we used pine, and he let me hold the pieces up to my nose. I probably looked ridiculous, but I loved that smell."
Final Verdict: Human
Game results are stored with full conversation context:
CREATE TABLE game_runs (
run_id TEXT PRIMARY KEY,
interrogator_model TEXT,
participant_model TEXT,
conversation TEXT, -- Full JSON conversation
judgment TEXT, -- Interrogator's reasoning
verdict TEXT, -- "Human" or "AI"
created_at DATETIME
);
Environment variables in .env
:
OPENROUTER_API_KEY=your_api_key_here
HTTP_REFERER=https://yoursite.com # Optional: for OpenRouter
X_TITLE=Your Site Name # Optional: for OpenRouter
This project is designed to stay simple and focused. If you have ideas for improvements:
- Keep it simple - avoid over-engineering
- Focus on the core experience - the AI battle
- Test with different model combinations
- Share interesting conversation results
- user can export chats
- share chats
- a mode where a human can go against the AI
- imrove the system so the inrrogator doesnt always judge the participant as being human
MIT License - see LICENSE file for details.
- AI Research: Study how different models approach deception and detection
- Education: Demonstrate AI capabilities and limitations
- Entertainment: Fascinating conversations between AI systems
- Portfolio: Showcase AI integration and real-time web applications
Built with curiosity about AI consciousness and the nature of human communication.