explaingit

marianovilla/trolley-to-llm

Analysis updated 2026-06-24

15TypeScriptAudience · researcherComplexity · 3/5Setup · 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
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

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

What is it built with?

FastAPIPydanticReactTypeScriptViteTailwindOpenRouter

How does it compare?

marianovilla/trolley-to-llmceelog/openwereadellismosss/strip-silence
Stars151515
LanguageTypeScriptTypeScriptTypeScript
Setup difficultymoderatemoderatehard
Complexity3/52/52/5
Audienceresearcherdevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get 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

Frequently asked questions

What is trolley-to-llm?

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.

What language is trolley-to-llm written in?

Mainly TypeScript. The stack also includes FastAPI, Pydantic, React.

How hard is trolley-to-llm to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is trolley-to-llm for?

Mainly researcher.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.