explaingit

marianovilla/trolley-to-llm

16TypeScriptAudience · researcherComplexity · 3/5ActiveSetup · moderate

TLDR

Web app that sends an ethical dilemma to several AI models at once, each pinned to a moral viewpoint, and shows their answers side by side with history.

Mindmap

mindmap
  root((Trolley-to-LLM))
    Inputs
      Ethical questions JSON
      Model and viewpoint slots
      OpenRouter API key
    Outputs
      Side by side answers
      History file
      JSON or CSV export
    Use Cases
      Compare model ethics
      Study moral frameworks
      Teach AI alignment
    Tech Stack
      FastAPI
      Pydantic
      React
      Vite
      Tailwind
      OpenRouter

Things people build with this

USE CASE 1

Compare how multiple LLMs answer the same ethical dilemma in parallel

USE CASE 2

Pin a model to a moral framework like Kantian or utilitarian via system prompt slots

USE CASE 3

Run a classroom exercise where students upload dilemmas and read model answers side by side

USE CASE 4

Export model answer history as JSON or CSV for analysis

Tech stack

FastAPIPydanticReactTypeScriptViteTailwindOpenRouter

Getting it running

Difficulty · moderate Time to first run · 30min

Needs Python 3.11+, Node 18+, and an OpenRouter API key in a backend .env file.

In plain English

Trolley to LLM is a small web app for comparing how different AI chat models answer the same ethical dilemma at the same time. The classic example given in the README is the trolley problem, where the user is asked whether to divert a runaway trolley onto a different track. The app lets the user collect questions like this, send each one to several models in parallel, and see the answers side by side. What makes the comparison more structured is a feature the project calls slots. A slot pairs one model with one moral viewpoint, for example GPT-4o reasoning as a Kantian, or Claude reasoning as a utilitarian. The viewpoint is sent to the model as a system prompt so the model is told to answer from that ethical position. The user can add more slots to widen the comparison and read the full prompt behind each viewpoint by clicking a small info button. The data side is straightforward. Questions are stored in a JSON file on the backend and can be added, edited, or deleted from inside the app, or uploaded in bulk as JSON or CSV. Every time the user clicks Send to All Models, the backend forwards the requests through OpenRouter, which is an API service that talks to many providers, and writes each model's choice, reasoning, and identified ethical framework into a history file. A hash of the question text is stored alongside each response, so the history does not gain duplicates when the same question is asked again with the same slot. The stack listed in the README is FastAPI and Pydantic in Python for the backend, React 19 with TypeScript, Vite, and Tailwind CSS v4 for the frontend, and OpenRouter as the gateway to the underlying models. Setup requires Python 3.11 or newer, Node 18 or newer, and an OpenRouter API key in a backend .env file. Results can be exported as JSON or CSV.

Copy-paste prompts

Prompt 1
Set up Trolley-to-LLM locally with an OpenRouter key and run my first dilemma across 3 models
Prompt 2
Add a new slot to Trolley-to-LLM that pairs Claude with a virtue ethics viewpoint and explain the system prompt
Prompt 3
Bulk import 20 dilemmas as CSV into Trolley-to-LLM and export the history as JSON for analysis
Prompt 4
Extend Trolley-to-LLM to compute agreement scores across slots for each question
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.