{
  "slug": "fourier-epicycles",
  "name": "Fourier epicycles",
  "title": "One prompt. Four models. No winner.",
  "date": "2026-07-09",
  "status": "published",
  "thesis": "For a well-specified, self-contained task with a built-in correctness check, model choice stops being the variable that matters.",
  "verdict": "All four shipped working math on the first pass, within a rounding error of each other. The only thing that diverged was the bill — by roughly 200×.",
  "prompt": "Build a single, self-contained HTML file (inline CSS and JavaScript, zero external dependencies, no CDN imports) that visualizes the Fourier series approximation of a square wave using rotating epicycles. Slider for the number of terms (1–50), a speed control, a pause button, and a live mean-squared-error readout comparing the traced wave to an ideal square wave.",
  "referee": "The live MSE readout is the built-in correctness check: if a model faked the math, the error rats it out.",
  "scoreLabel": "MSE vs ideal square wave",
  "seriesFormula": "f(t) = (4/π) · Σ sin((2k−1)·t) / (2k−1)",
  "xPost": {
    "url": "https://x.com/0xBakeer/status/2075686316461764641",
    "text": "Four AI models, same prompt, raced side by side. Yesterday I compared cost. This time I timed them.\n\n▎ Grok → 4:41\n▎ Gemini → 5:37\n▎ Fable 5 → 7:51\n▎ DeepSeek V4 Pro → 10:17\n\nThe $0.045 model finished last. And the two slowest were the only ones that tested their own work",
    "author": "Khaled Bakeer",
    "handle": "@0xBakeer",
    "date": "2026-07-10"
  },
  "models": [
    {
      "slug": "fable-5",
      "name": "Fable 5",
      "modelId": "claude-fable-5",
      "vendor": "Anthropic",
      "cli": "Claude Code",
      "confirmedVia": "session log in ~/.claude/projects",
      "accent": "#C07818",
      "bright": "#E8A33D",
      "score": 0.0402,
      "scoreDisplay": "0.0402",
      "lines": 555,
      "bytes": 17933,
      "costAsRun": 8.57,
      "costClean": 1,
      "costDisplay": "~$8.57 as run · ~$1 clean",
      "costBasis": "Measured tokens × published pricing ($10 / $50 per Mtok in/out). Most of the as-run figure is Claude Code harness cache traffic, not the file — a clean one-shot API call lands near $1.",
      "tokens": {
        "input": 20872,
        "output": 89314,
        "reasoning": null,
        "cacheRead": 1300000,
        "cacheWrite": 207000
      },
      "temperament": "Wrote the most and polished the hardest — a warm “harmonic synthesis” editorial look.",
      "firstRenderRank": 3,
      "raceTime": "7:51",
      "raceSeconds": 471,
      "selfTested": true
    },
    {
      "slug": "grok-build",
      "name": "Grok Build",
      "modelId": "grok-build · badged “Grok 4.3” · 512K ctx",
      "vendor": "xAI",
      "cli": "Grok CLI v0.2.93",
      "confirmedVia": "~/.grok/models_cache.json + config.toml",
      "accent": "#1E88AE",
      "bright": "#4FC3E8",
      "score": 0.04086,
      "scoreDisplay": "0.04086",
      "lines": 621,
      "bytes": 14729,
      "costAsRun": null,
      "costClean": null,
      "costDisplay": "subscription — no per-token price",
      "costBasis": "Ran on a subscription plan. The CLI logs a ~57K-token context peak but exposes no per-token price, so there is no honest dollar figure to put on a bar.",
      "tokens": {
        "input": null,
        "output": null,
        "reasoning": null,
        "cacheRead": null,
        "cacheWrite": null
      },
      "temperament": "The sprinter — its browser window lit up first. Clean, clinical green trace.",
      "firstRenderRank": 1,
      "raceTime": "4:41",
      "raceSeconds": 281,
      "selfTested": false
    },
    {
      "slug": "deepseek-v4-pro",
      "name": "DeepSeek V4 Pro",
      "modelId": "deepseek-v4-pro (max)",
      "vendor": "DeepSeek",
      "cli": "opencode",
      "confirmedVia": "opencode's SQLite session DB",
      "accent": "#2E9159",
      "bright": "#5BC98C",
      "score": 0.0408,
      "scoreDisplay": "0.0408",
      "lines": 565,
      "bytes": 15295,
      "costAsRun": 0.045,
      "costClean": 0.045,
      "costDisplay": "$0.045 — metered, itemized",
      "costBasis": "The only real, itemized bill of the four: 19,326 input + 7,676 output + 32,120 reasoning tokens, ~half a million cached — four and a half cents.",
      "tokens": {
        "input": 19326,
        "output": 7676,
        "reasoning": 32120,
        "cacheRead": 500000,
        "cacheWrite": null
      },
      "temperament": "Deliberate — logged 32,120 reasoning tokens before shipping a clean, clinical build.",
      "firstRenderRank": 4,
      "raceTime": "10:17",
      "raceSeconds": 617,
      "selfTested": true
    },
    {
      "slug": "gemini-3-5-flash",
      "name": "Gemini 3.5 Flash",
      "modelId": "gemini-3.5-flash",
      "vendor": "Google",
      "cli": "Gemini CLI",
      "confirmedVia": "the CLI's chat session log",
      "accent": "#B045C4",
      "bright": "#D774E8",
      "score": 0.04,
      "scoreDisplay": "~0.040 (matched visually)",
      "lines": 997,
      "bytes": 36141,
      "costAsRun": 0.02,
      "costClean": 0.02,
      "costDisplay": "~$0.01–0.03 (estimated)",
      "costBasis": "The Gemini CLI didn't record token usage at all. Based on Flash-tier rates and the output size, the real cost was almost certainly a cent or two.",
      "tokens": {
        "input": null,
        "output": null,
        "reasoning": null,
        "cacheRead": null,
        "cacheWrite": null
      },
      "temperament": "The economy tier quietly shipped the biggest, most feature-heavy file of the four — 997 lines.",
      "firstRenderRank": 2,
      "raceTime": "5:37",
      "raceSeconds": 337,
      "selfTested": false
    }
  ],
  "measurements": [
    {
      "slug": "accuracy",
      "name": "Accuracy",
      "unit": "mean-squared error",
      "verdict": "Four separate codebases, one rounding error apart. Nobody faked the math.",
      "spread": "0.0402 → 0.04086"
    },
    {
      "slug": "cost",
      "name": "Cost",
      "unit": "USD for the same file",
      "verdict": "The one thing that wasn't equal. Same output, ~200× price spread.",
      "spread": "$0.045 → ~$8.57"
    },
    {
      "slug": "size",
      "name": "Output size",
      "unit": "lines · kilobytes",
      "verdict": "The cheapest tier shipped the biggest file. Size tracked style, not quality.",
      "spread": "555 → 997 lines"
    },
    {
      "slug": "speed",
      "name": "Speed & temperament",
      "unit": "wall-clock, from the race video",
      "verdict": "The cheapest model finished last — and the two slowest were the only ones that tested their own work.",
      "spread": "4:41 → 10:17"
    }
  ]
}
