Skip to main content

Compare LLM model outputs side-by-side with rich diff visualization

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_model_diff-0.1.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_model_diff-0.1.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file llm_model_diff-0.1.0.tar.gz.

File metadata

  • Download URL: llm_model_diff-0.1.0.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.6

File hashes

Hashes for llm_model_diff-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5a0982fbc72c8b55d687d6834dd45e054cb69377c278cb9c21fa14a727386100
MD5 bc930aeb7e2419b58d92d5efcf67c5b1
BLAKE2b-256 f81a201d60815136763a4a7b3486d250fba5d78a4c1edd7bd95d0e062b37460f

See more details on using hashes here.

File details

Details for the file llm_model_diff-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: llm_model_diff-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.6

File hashes

Hashes for llm_model_diff-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ca14b53743d6aa63375b7159ebd0a403650edc88f20bcbd863eefd54f795ab63
MD5 35f2b54117cd247613e977d94dabc18d
BLAKE2b-256 e1a1deb6ce44131e9f871f9a43c9dc60b27545f4b1f56aea09449a1594a09b25

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page