Skip to content

sebreuer/Aidiff

Repository files navigation

Aidiff

Aidiff

Compare multiple AI models in parallel — answers, differences, and costs in one place.

React 18 Vite 5 OpenAI Anthropic Google Gemini

Aidiff — empty state with model picker and composer


What is Aidiff?

Aidiff is a local web app for side-by-side LLM comparison. Send the same task to two or three models (or test multiple prompt variants on one model) and get structured output: raw answers, an AI-powered difference analysis, and performance metrics (latency, tokens, estimated cost).

Great for prompt engineering, model selection, quality checks, and quick A/B tests — without juggling chat tabs.

Three models compared with results and composer


Composer modes

Compare models

Pick two or three models (OpenAI, Anthropic, Google), write one prompt, and send it to every column in parallel.

Compare Models composer with model pickers

Compare prompts

Keep a single model and A/B test two or three prompt variants on the same task — ideal for tone, length, and constraint tweaks.

Compare Prompts mode with two prompt columns


Results

Results

Answers side by side with latency and estimated cost per column — switch tabs without losing the run.

Results tab with two models compared

Differences

AI summary: keywords per answer, a six-row mini comparison (tone, length, structure…), and a short assessment in your prompt’s language.

Difference analysis with assessment and mini comparison

Performance

Latency, output tokens, tokens per second, and cost per request — spot the fastest or cheapest model at a glance.

Performance metrics per model

API keys

On first launch, enter at least one provider key in the app (saved to your local .env), or add keys to .env before starting. Later, use Manage API Keys in the header to update them.

API key setup on first launch


Features

Area Description
Model compare 2–3 columns: GPT (OpenAI), Claude (Anthropic), Gemini (Google) — mix freely
Prompt compare Same model setup, different prompt variants side by side
Difference analysis Auto summary: keywords, mini comparison (tone, length, structure…), assessment — in your prompt’s language
Performance tab Latency, output tokens, tokens/s, cost per request (estimate from built-in pricing table)
File attachment Attach a local file as extra context in the prompt
Settings Manage API keys in the UI; saved to your local .env
UI Glass design, light/dark mode, searchable model picker with provider catalog
i18n-ready Extend UI and analysis prompts via locale files (default: English)

Quick start

Prerequisites

Install

git clone https://github.com/<your-user>/aidiff.git
cd aidiff
npm install
cp .env.example .env

Add at least one key to .env:

ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
GOOGLE_API_KEY=AIza...

Start the dev server:

npm run dev

Open http://localhost:5173. On first launch you can also enter keys in Settings — they are written to your local .env.


Tutorial

1. Add API keys

Open Manage API Keys (gear in the header). At least one provider is required. Restart the dev server after saving if the proxy does not pick up new keys.

2. Choose compare mode

  • Compare Models — one prompt, different models in 2–3 columns
  • Compare Prompts — one model, two (optional three) prompt variants

3. Send a prompt

Type your prompt, optionally attach a file, pick models/variants in the slots, press Send.

4. Read the results

Tab Content
Results Model/variant answers side by side
Differences AI analysis: keywords, mini comparison, assessment
Performance Latency, cost, and token metrics per column

Older runs can be collapsed; new comparisons stack below.


Architecture

flowchart LR
  subgraph Browser["Browser (React)"]
    UI[App + Composer]
    Tabs[Results / Diff / Perf]
  end

  subgraph Vite["Vite Dev / Preview"]
    Proxy["API proxy\n/api/openai · anthropic · google"]
    Keys["/api/settings/keys\n→ .env"]
  end

  subgraph Providers["LLM APIs"]
    OAI[OpenAI]
    ANT[Anthropic]
    GEM[Google Gemini]
  end

  UI --> Proxy
  UI --> Keys
  Proxy --> OAI
  Proxy --> ANT
  Proxy --> GEM
  Tabs --> UI
Loading
  • Frontend: React 18, Vite 5, JSX (no separate backend repo)
  • API access: In dev and preview, Vite proxies provider requests and injects keys from .env server-side — avoids CORS and browser key restrictions
  • Difference analysis: After a parallel run, Aidiff calls a fixed model (gemini-2.5-flash) with structured system prompts; the response is parsed and rendered in the UI
  • Cost estimates: From MODEL_PRICING in src/constants/appConfig.js (input/output per 1M tokens)

Project layout

aidiff/
├── docs/screenshots/    # README images (add your PNGs here)
├── public/              # Logo, favicon, static assets
├── src/
│   ├── App.jsx          # Main UI, run orchestration
│   ├── components/      # Composer, tabs, diff cards, settings…
│   ├── constants/       # Providers, models, pricing, tabs
│   ├── i18n/            # Locale catalog, diff-analysis prompts
│   ├── lib/             # API clients, diff parser, model catalog
│   ├── locales/         # UI strings (e.g. en.js)
│   └── theme/           # Design tokens, glass CSS
├── vite.config.js       # Proxy + /api/settings/keys
├── .env.example
└── package.json

NPM scripts

Command Description
npm run dev Dev server with HMR
npm run build Production build to dist/
npm run preview Preview build locally (proxy active)
npm run lint ESLint

Configuration

Environment (.env)

Variable Description
OPENAI_API_KEY OpenAI / GPT
ANTHROPIC_API_KEY Anthropic / Claude
GOOGLE_API_KEY Google Gemini
VITE_AIDIFF_LOCALE Optional UI locale (must exist in src/i18n/catalog.js, e.g. en)

.env is gitignored — never commit API keys.

Add a locale

  1. Add src/locales/de.js (same shape as en.js)
  2. Register it in src/i18n/catalog.js
  3. Set VITE_AIDIFF_LOCALE=de or call setLocale('de') at runtime

Important notes

  • Local-first: Keys stay on your machine (.env). Aidiff is not a hosted SaaS.
  • Proxy requires Vite: /api/settings/keys and provider proxies run under npm run dev and npm run preview. Static hosting of dist/ alone does not forward API calls.
  • Costs: Every run and the difference analysis use API credits on your providers.
  • Meta analysis: Prepared in code; UI is currently disabled (META_ANALYSIS_ENABLED).

Development

npm install
npm run dev

On 401/CORS errors: restart the dev server and check keys in .env (no stray spaces). For Google: enable the Generative Language API and billing on your cloud project.


License

MIT — Copyright (c) 2026 Sebastian Breuer


Built with React + Vite · See what actually makes models different.

About

Side-by-side LLM comparison — A/B test models and prompts with diff analysis and cost metrics. Your API keys stay in local .env.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors