model-diff
Compare LLM model outputs side-by-side with rich diff visualization.
Run the same prompt on multiple models simultaneously and see exactly what each model says differently.
Installation
pip install model-diff
Or install from source:
git clone https://github.com/yourname/model-diff
cd model-diff
pip install -e .
Requirements
Set the API keys for the providers you want to use:
export OPENAI_API_KEY=sk-...
export ANTHROPIC_API_KEY=sk-ant-...
Missing keys are handled gracefully — models without a key are skipped with a warning.
Usage
# Default: compare GPT-4o vs Claude Sonnet
model-diff "What is the best way to handle errors in Python?"
# Specify models explicitly
model-diff "Explain recursion" --models gpt-4o,claude-sonnet-4-6
# Use a prompt file
model-diff --prompt prompt.txt --models gpt-4o,claude-haiku-4-5-20251001,claude-sonnet-4-6
# Word-level diff
model-diff "Explain recursion" --diff words
# Show only differences (hide matching sections)
model-diff "Explain recursion" --only-diff
# Deterministic outputs
model-diff "Explain recursion" --temperature 0.0
# Save results to JSON
model-diff "Explain recursion" --output results.json
Supported Models
| Model ID | Provider | API Key |
|---|---|---|
gpt-4o |
OpenAI | OPENAI_API_KEY |
gpt-4o-mini |
OpenAI | OPENAI_API_KEY |
claude-opus-4-6 |
Anthropic | ANTHROPIC_API_KEY |
claude-sonnet-4-6 |
Anthropic | ANTHROPIC_API_KEY |
claude-haiku-4-5-20251001 |
Anthropic | ANTHROPIC_API_KEY |
Architecture
src/model_diff/
├── cli.py # Click-based CLI entry point
├── models.py # Provider-specific API callers, run concurrently via threading
└── differ.py # difflib-based diff engine + Rich output formatter
Model calls are issued concurrently using threading, so wall time equals the slowest model rather than the sum of all models.
License
MIT
Metadata
Release files for llm-model-diff 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| llm_model_diff-0.1.0.tar.gz | 14.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| llm_model_diff-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.7 kB
Release files / llm_model_diff-0.1.0.tar.gz
| Download URL | llm_model_diff-0.1.0.tar.gz |
|---|---|
| Size | 14.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a0982fbc72c8b55d687d6834dd45e054cb69377c278cb9c21fa14a727386100
|
|
BLAKE2b-256 checksum How to use checksums |
f81a201d60815136763a4a7b3486d250fba5d78a4c1edd7bd95d0e062b37460f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.6
|
Release files / llm_model_diff-0.1.0-py3-none-any.whl
| Download URL | llm_model_diff-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca14b53743d6aa63375b7159ebd0a403650edc88f20bcbd863eefd54f795ab63
|
|
BLAKE2b-256 checksum How to use checksums |
e1a1deb6ce44131e9f871f9a43c9dc60b27545f4b1f56aea09449a1594a09b25
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.6
|