Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

stop stamping hand-entered costs as AA-published, and share one model-slug normalizer

[._.]/ Adam Eivyce69d18863c3
diff --git a/client/src/components/models/ModelComparison.jsx b/client/src/components/models/ModelComparison.jsx
index 3c69533242..3a8afe5590 100644
--- a/client/src/components/models/ModelComparison.jsx
+++ b/client/src/components/models/ModelComparison.jsx
@@ -1,4 +1,4 @@
-import { useCallback, useEffect, useState } from 'react';
+import { useCallback, useEffect, useMemo, useState } from 'react';
import { Link, useSearchParams } from 'react-router';
import {
ArrowUpRight,
@@ -27,7 +27,7 @@ import {
} from '../../services/apiModelComparison';
import Modal from '../ui/Modal';
import ComparisonResearch from './ComparisonResearch';
-import { withEstimatedCosts } from '../../lib/effortCostEstimate';
+import { EFFORT_LADDER, withEstimatedCosts } from '../../lib/effortCostEstimate';
const COLORS = [
'#2563eb', // blue (GPT-5.6 Sol)
@@ -59,21 +59,16 @@ const METRICS = [
'quota',
];
+// Where each effort sits on a model's curve. The ladder itself comes from the
+// estimator so the two can't drift; the rest are the model-level configurations
+// that are not points on it, plus the aliases the sources use.
const EFFORT_ORDER = {
'non-reasoning': 0,
none: 0,
unspecified: 0.5,
- minimal: 1,
- low: 2,
- medium: 3,
- high: 4,
- xhigh: 5,
- very_high: 5,
- max: 6,
- // Claude Code's ultracode mode sits above max effort; no benchmark publishes
- // it yet, so this only decides where such a point lands on the curve.
- ultracode: 7,
- reasoning: 8,
+ ...Object.fromEntries(EFFORT_LADDER.map((effort, index) => [effort, index + 1])),
+ very_high: EFFORT_LADDER.indexOf('xhigh') + 1,
+ reasoning: EFFORT_LADDER.length + 1,
};
const STALE_MS = 30 * 86400000;
@@ -101,6 +96,17 @@ export default function ModelComparison() {
const load = useCallback(() => getModelComparison({ silent: true }), []);
+ const showEstimates = params.get('estimates') !== '0';
+ // Estimating costs walks the whole catalog, and the model filter input below
+ // re-renders on every keystroke — memoize so typing doesn't redo the pass.
+ const estimatedRows = useMemo(() => {
+ const observations = catalog?.observations || [];
+ return showEstimates ? withEstimatedCosts(observations) : observations;
+ }, [catalog, showEstimates]);
+ // Models the user's own providers can dispatch. Everything else in the index
+ // is available behind "All models" but is not what the page opens on.
+ const availableSet = useMemo(() => new Set(catalog?.availableModels || []), [catalog]);
+
useEffect(() => {
let active = true;
load()
@@ -245,26 +251,26 @@ export default function ModelComparison() {
// Cost spans four orders of magnitude across the catalog, so a linear axis
// stacks every affordable model on the y-axis. Log is the readable default.
const scale = params.get('scale') === 'linear' ? 'linear' : 'log';
- const showEstimates = params.get('estimates') !== '0';
- // Models the user's own providers can dispatch. Everything else in the index
- // is available behind "All models" but is not what the page opens on.
- const availableModels = catalog.availableModels || [];
- const showAllModels = params.get('allModels') === '1' || !availableModels.length;
-
- const catalogRows = showEstimates ? withEstimatedCosts(catalog.observations) : catalog.observations;
- const models = [
- ...new Set(catalogRows.filter(row => showAllModels || availableModels.includes(row.model)).map(row => row.model)),
- ].sort();
- const providers = [...new Set(catalogRows.map(row => row.provider))].sort();
- const efforts = [...new Set(catalogRows.map(row => row.effort))].sort();
-
- const visible = catalogRows.filter(
+ const showAllModels = params.get('allModels') === '1' || availableSet.size === 0;
+
+ // Scope once, then derive every list from the scoped rows — so the provider
+ // and effort pills can't offer values that have nothing left to plot.
+ const scoped = showAllModels ? estimatedRows : estimatedRows.filter(row => availableSet.has(row.model));
+ const models = [...new Set(scoped.map(row => row.model))].sort();
+ const providers = [...new Set(scoped.map(row => row.provider))].sort();
+ const efforts = [...new Set(scoped.map(row => row.effort))].sort();
+
+ const hidden = {
+ provider: new Set(params.getAll('hideProvider')),
+ model: new Set(params.getAll('hideModel')),
+ effort: new Set(params.getAll('hideEffort')),
+ };
+ const visible = scoped.filter(
row =>
row.benchmark === benchmark &&
- (showAllModels || availableModels.includes(row.model)) &&
- !params.getAll('hideProvider').includes(row.provider) &&
- !params.getAll('hideModel').includes(row.model) &&
- !params.getAll('hideEffort').includes(row.effort)
+ !hidden.provider.has(row.provider) &&
+ !hidden.model.has(row.model) &&
+ !hidden.effort.has(row.effort)
);
const rows = visible.map(row => {
@@ -286,18 +292,18 @@ export default function ModelComparison() {
displayName,
x: cost,
y: row.quality?.value,
- costEstimated: mode === 'benchmark' && !row.costPerTask && Boolean(row.estimatedCostPerTask),
+ costEstimated: mode === 'benchmark' && row.costEstimated === true,
label: `${row.model} (${row.effort})${row.responseSeconds ? ` · ${row.responseSeconds.value}s` : ''}`,
};
});
const plotted = rows.filter(row => Number.isFinite(row.x) && Number.isFinite(row.y) && (scale !== 'log' || row.x > 0));
- const estimatedCount = plotted.filter(row => row.costEstimated).length;
-
// Count models that have 2 or more effort points plotted
+ let estimatedCount = 0;
const multiEffortModelCounts = new Map();
for (const row of plotted) {
+ if (row.costEstimated) estimatedCount += 1;
multiEffortModelCounts.set(row.model, (multiEffortModelCounts.get(row.model) || 0) + 1);
}
const reasoningCurveModels = [...multiEffortModelCounts.entries()]
@@ -374,17 +380,15 @@ export default function ModelComparison() {
{error && <p role="alert" className="text-port-error">{error}</p>}
{/* Sync Modal */}
- {/* Modal owns only the backdrop and the panel box — the panel's surface,
- border and heading are the caller's, so `panelClassName` is what keeps
- the dialog from rendering transparent over the page beneath it. */}
+ {/* Modal owns only the backdrop and the panel box; the surface and heading
+ are the caller's. Without them the dialog renders transparent. */}
<Modal
open={syncModalOpen}
onClose={() => setSyncModalOpen(false)}
size="sm"
ariaLabelledBy="aa-sync-title"
- panelClassName="bg-port-card border border-port-border rounded-xl shadow-2xl"
>
- <div className="p-5 space-y-4">
+ <div className="bg-port-card border border-port-border rounded-xl shadow-2xl p-5 space-y-4">
<h3 id="aa-sync-title" className="text-base font-semibold tracking-tight">
Sync Artificial Analysis data
</h3>
@@ -526,7 +530,7 @@ export default function ModelComparison() {
type="checkbox"
className="accent-port-accent size-4 shrink-0"
checked={showAllModels}
- disabled={!availableModels.length}
+ disabled={availableSet.size === 0}
onChange={e => changeParam('allModels', e.target.checked ? '1' : '0')}
/>
All models (not just yours)
diff --git a/client/src/lib/effortCostEstimate.js b/client/src/lib/effortCostEstimate.js
index 83787c8430..a265f917d6 100644
Binary files a/client/src/lib/effortCostEstimate.js and b/client/src/lib/effortCostEstimate.js differ
diff --git a/client/src/lib/effortCostEstimate.test.js b/client/src/lib/effortCostEstimate.test.js
index 58dc9fd4d6..6c79d54672 100644
--- a/client/src/lib/effortCostEstimate.test.js
+++ b/client/src/lib/effortCostEstimate.test.js
@@ -48,7 +48,7 @@ describe('withEstimatedCosts', () => {
it('leaves published costs untouched and unflagged', () => {
const published = withEstimatedCosts(catalog).find(entry => entry.id === 'anchored-max');
- expect(published.costEstimated).toBe(false);
+ expect(published.costEstimated).toBeUndefined();
expect(published.costPerTask.value).toBe(10);
expect(published.estimatedCostPerTask).toBeUndefined();
});
@@ -57,13 +57,13 @@ describe('withEstimatedCosts', () => {
const orphan = withEstimatedCosts([...catalog, row('unpriced', 'low', null)]).find(
entry => entry.id === 'unpriced-low'
);
- expect(orphan.costEstimated).toBe(false);
+ expect(orphan.costEstimated).toBeUndefined();
});
it('keeps families on separate benchmarks apart', () => {
const other = { ...row('anchored', 'low', null), benchmark: 'Other Index v1' };
const estimated = withEstimatedCosts([...catalog, other]).filter(entry => entry.benchmark === 'Other Index v1');
- expect(estimated[0].costEstimated).toBe(false);
+ expect(estimated[0].costEstimated).toBeUndefined();
});
it('does not estimate model-level configurations that are not points on the ladder', () => {
@@ -71,6 +71,6 @@ describe('withEstimatedCosts', () => {
const estimated = withEstimatedCosts([...catalog, nonLadder]).find(
entry => entry.effort === 'non-reasoning'
);
- expect(estimated.costEstimated).toBe(false);
+ expect(estimated.costEstimated).toBeUndefined();
});
});
diff --git a/data.reference/model-comparison.json b/data.reference/model-comparison.json
index c106a491ad..ed3b83267c 100644
--- a/data.reference/model-comparison.json
+++ b/data.reference/model-comparison.json
@@ -183,14 +183,7 @@
"methodology": "Artificial Analysis Intelligence Index v4.2 composite score."
}
},
- "costPerTask": {
- "value": 0.012,
- "source": {
- "url": "https://artificialanalysis.ai/models/gpt-5-6-luna-low",
- "retrievedAt": "2026-09-05T00:00:00Z",
- "methodology": "Artificial Analysis Intelligence Index v4.2; cost per task evaluation."
- }
- },
+ "costPerTask": null,
"inputPerMillion": {
"value": 0.2,
"source": {
@@ -515,14 +508,7 @@
"methodology": "Artificial Analysis Intelligence Index v4.2 composite score."
}
},
- "costPerTask": {
- "value": 1.172,
- "source": {
- "url": "https://artificialanalysis.ai/models/gpt-5-5",
- "retrievedAt": "2026-09-05T00:00:00Z",
- "methodology": "Artificial Analysis Intelligence Index v4.2; cost per task evaluation."
- }
- },
+ "costPerTask": null,
"inputPerMillion": {
"value": 5,
"source": {
@@ -946,14 +932,7 @@
"methodology": "Artificial Analysis Intelligence Index v4.2 composite score."
}
},
- "costPerTask": {
- "value": 0.124,
- "source": {
- "url": "https://artificialanalysis.ai/models/gpt-5-6-terra-medium",
- "retrievedAt": "2026-09-05T00:00:00Z",
- "methodology": "Artificial Analysis Intelligence Index v4.2; cost per task evaluation."
- }
- },
+ "costPerTask": null,
"inputPerMillion": {
"value": 2,
"source": {
@@ -2094,14 +2073,7 @@
"methodology": "Artificial Analysis Intelligence Index v4.2 composite score."
}
},
- "costPerTask": {
- "value": 0.018,
- "source": {
- "url": "https://artificialanalysis.ai/models/gpt-5-6-luna-medium",
- "retrievedAt": "2026-09-05T00:00:00Z",
- "methodology": "Artificial Analysis Intelligence Index v4.2; cost per task evaluation."
- }
- },
+ "costPerTask": null,
"inputPerMillion": {
"value": 0.2,
"source": {
@@ -2352,14 +2324,7 @@
"methodology": "Artificial Analysis Intelligence Index v4.2 composite score."
}
},
- "costPerTask": {
- "value": 0.495,
- "source": {
- "url": "https://artificialanalysis.ai/models/gpt-5-5-medium",
- "retrievedAt": "2026-09-05T00:00:00Z",
- "methodology": "Artificial Analysis Intelligence Index v4.2; cost per task evaluation."
- }
- },
+ "costPerTask": null,
"inputPerMillion": {
"value": 5,
"source": {
@@ -3702,14 +3667,7 @@
"methodology": "Artificial Analysis Intelligence Index v4.2 composite score."
}
},
- "costPerTask": {
- "value": 0.024,
- "source": {
- "url": "https://artificialanalysis.ai/models/gpt-5-6-luna-high",
- "retrievedAt": "2026-09-05T00:00:00Z",
- "methodology": "Artificial Analysis Intelligence Index v4.2; cost per task evaluation."
- }
- },
+ "costPerTask": null,
"inputPerMillion": {
"value": 0.2,
"source": {
@@ -3914,14 +3872,7 @@
"methodology": "Artificial Analysis Intelligence Index v4.2 composite score."
}
},
- "costPerTask": {
- "value": 0.798,
- "source": {
- "url": "https://artificialanalysis.ai/models/gpt-5-5-high",
- "retrievedAt": "2026-09-05T00:00:00Z",
- "methodology": "Artificial Analysis Intelligence Index v4.2; cost per task evaluation."
- }
- },
+ "costPerTask": null,
"inputPerMillion": {
"value": 5,
"source": {
@@ -4511,14 +4462,7 @@
"methodology": "Artificial Analysis Intelligence Index v4.2 composite score."
}
},
- "costPerTask": {
- "value": 0.258,
- "source": {
- "url": "https://artificialanalysis.ai/models/gpt-5-5-low",
- "retrievedAt": "2026-09-05T00:00:00Z",
- "methodology": "Artificial Analysis Intelligence Index v4.2; cost per task evaluation."
- }
- },
+ "costPerTask": null,
"inputPerMillion": {
"value": 5,
"source": {
@@ -4684,14 +4628,7 @@
"methodology": "Artificial Analysis Intelligence Index v4.2 composite score."
}
},
- "costPerTask": {
- "value": 0.089,
- "source": {
- "url": "https://artificialanalysis.ai/models/gpt-5-6-terra-low",
- "retrievedAt": "2026-09-05T00:00:00Z",
- "methodology": "Artificial Analysis Intelligence Index v4.2; cost per task evaluation."
- }
- },
+ "costPerTask": null,
"inputPerMillion": {
"value": 2,
"source": {
diff --git a/scripts/migrations/353-fable-catalog-model-slug.js b/scripts/migrations/353-fable-catalog-model-slug.js
index 19637e67cc..ee0d899526 100644
--- a/scripts/migrations/353-fable-catalog-model-slug.js
+++ b/scripts/migrations/353-fable-catalog-model-slug.js
@@ -1,6 +1,6 @@
/**
- * Rename `claude-fable-5-1` to `claude-fable-5.1` in an install's comparison
- * catalog.
+ * Normalize dash-spelled model versions in an install's comparison catalog —
+ * `claude-fable-5-1` to `claude-fable-5.1`.
*
* The Fable 5.1 max-effort row was minted before the dotted slug existed, so a
* catalog synced from Artificial Analysis carried the model under two names:
@@ -14,33 +14,33 @@
* corrected identity table in `server/services/artificialAnalysis.js`; this
* rewrites the stored row to match before that can happen.
*/
-import { readFile, writeFile } from 'node:fs/promises';
import { join } from 'node:path';
-
-const OLD_MODEL = 'claude-fable-5-1';
-const NEW_MODEL = 'claude-fable-5.1';
+import { atomicWrite, readJSONFileStrict } from '../../server/lib/fileUtils.js';
+import { canonicalCatalogModelSlug } from '../../server/lib/comparisonModelScope.js';
export default {
async up({ rootDir }) {
const path = join(rootDir, 'data/model-comparison.json');
- const raw = await readFile(path, 'utf8').catch(error => {
- if (error.code === 'ENOENT') return null;
- throw error;
- });
- if (!raw) return { success: true, skipped: 'no catalog' };
-
- const catalog = JSON.parse(raw);
+ // `ok: false` is an unreadable catalog, not an absent one — leave it alone
+ // rather than rewriting a file we could not parse.
+ const { ok, value: catalog } = await readJSONFileStrict(path, null);
+ if (!ok) return { success: true, skipped: 'catalog unreadable' };
+ if (!catalog) return { success: true, skipped: 'no catalog' };
if (!Array.isArray(catalog.observations)) return { success: true, skipped: 'no observations' };
+ // Every stored row goes through the same normalizer the sync now mints
+ // with, so a legacy spelling any past sync left behind is repaired too and
+ // the two can't disagree about what a model is called.
let renamed = 0;
for (const row of catalog.observations) {
- if (row?.model !== OLD_MODEL) continue;
- row.model = NEW_MODEL;
+ const canonical = canonicalCatalogModelSlug(row?.model);
+ if (!canonical || canonical === row.model) continue;
+ row.model = canonical;
renamed += 1;
}
if (!renamed) return { success: true, skipped: 'already normalized' };
- await writeFile(path, `${JSON.stringify(catalog, null, 2)}\n`);
+ await atomicWrite(path, catalog);
return { success: true, renamed };
},
};
diff --git a/scripts/migrations/353-fable-catalog-model-slug.test.js b/scripts/migrations/353-fable-catalog-model-slug.test.js
index 8d5fb5df79..79f4b6c3a4 100644
--- a/scripts/migrations/353-fable-catalog-model-slug.test.js
+++ b/scripts/migrations/353-fable-catalog-model-slug.test.js
@@ -28,6 +28,16 @@ it('renames the dashed Fable slug while leaving its id and every other row alone
expect(observations[0].id).toBe('aa-v4.2-anthropic-claude-fable-5-1-max');
});
+it('leaves a build date or parameter count that only looks like a version', async () => {
+ const path = await withCatalog([
+ { id: 'a', model: 'deepseek-r1-0528', effort: 'unspecified' },
+ { id: 'b', model: 'qwen3-235b-a22b-2507', effort: 'reasoning' },
+ ]);
+ const before = await readFile(path, 'utf8');
+ expect(await migration.up({ rootDir })).toMatchObject({ skipped: 'already normalized' });
+ expect(await readFile(path, 'utf8')).toBe(before);
+});
+
it('is a no-op on an already-normalized catalog and on an install with none', async () => {
const path = await withCatalog([{ id: 'x', model: 'claude-fable-5.1', effort: 'max' }]);
const before = await readFile(path, 'utf8');
diff --git a/scripts/prune-model-comparison-seed.js b/scripts/prune-model-comparison-seed.js
index 7e16d3c321..705afa9038 100644
--- a/scripts/prune-model-comparison-seed.js
+++ b/scripts/prune-model-comparison-seed.js
@@ -25,6 +25,8 @@ import { readFile, writeFile } from 'fs/promises';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
import { providerCatalogSlugs } from '../server/lib/comparisonModelScope.js';
+import { filterSelectableModels } from '../server/lib/providerModels.js';
+import { isDirectlyInvoked } from './lib/directInvocation.js';
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
const seedPath = join(root, 'data.reference/model-comparison.json');
@@ -40,35 +42,34 @@ export const FRONTIER_ANCHORS = ['claude-fable-5.1', 'claude-fable-5'];
export async function inScopeModels() {
const providers = JSON.parse(await readFile(providersPath, 'utf8'));
const inventory = Object.values(providers.providers || {}).map(provider => ({
- models: (provider.models || []).map(model => (typeof model === 'string' ? model : model?.id)),
+ models: filterSelectableModels((provider.models || []).map(model => (typeof model === 'string' ? model : model?.id))),
}));
const scope = providerCatalogSlugs(inventory);
for (const model of FRONTIER_ANCHORS) scope.add(model);
return scope;
}
+/** `{ pruned, originalCount }` from a single read of the seed. */
export async function prunedSeed() {
const scope = await inScopeModels();
const catalog = JSON.parse(await readFile(seedPath, 'utf8'));
return {
- ...catalog,
- observations: catalog.observations.filter(row => scope.has(row.model)),
+ pruned: { ...catalog, observations: catalog.observations.filter(row => scope.has(row.model)) },
+ originalCount: catalog.observations.length,
};
}
-const isMain = process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1];
-if (isMain) {
- const pruned = await prunedSeed();
- const current = JSON.parse(await readFile(seedPath, 'utf8'));
+if (isDirectlyInvoked(import.meta.url)) {
+ const { pruned, originalCount } = await prunedSeed();
const models = new Set(pruned.observations.map(row => row.model)).size;
if (process.argv.includes('--check')) {
- if (current.observations.length !== pruned.observations.length) {
- console.error(`❌ Seed carries ${current.observations.length} observations; ${pruned.observations.length} are in provider scope`);
+ if (originalCount !== pruned.observations.length) {
+ console.error(`❌ Seed carries ${originalCount} observations; ${pruned.observations.length} are in provider scope`);
process.exit(1);
}
console.log(`✅ Seed is in scope: ${pruned.observations.length} observations across ${models} models`);
} else {
await writeFile(seedPath, `${JSON.stringify(pruned, null, 2)}\n`);
- console.log(`✂️ Pruned seed to ${pruned.observations.length} observations across ${models} models (was ${current.observations.length})`);
+ console.log(`✂️ Pruned seed to ${pruned.observations.length} observations across ${models} models (was ${originalCount})`);
}
}
diff --git a/scripts/prune-model-comparison-seed.test.js b/scripts/prune-model-comparison-seed.test.js
index f4d1efdee5..41b88f61a5 100644
--- a/scripts/prune-model-comparison-seed.test.js
+++ b/scripts/prune-model-comparison-seed.test.js
@@ -16,7 +16,7 @@ describe('model comparison seed scope', () => {
});
it('is already pruned — the checked-in seed equals the pruned seed', async () => {
- const [seed, pruned] = await Promise.all([readSeed(), prunedSeed()]);
+ const [seed, { pruned }] = await Promise.all([readSeed(), prunedSeed()]);
expect(seed.observations.length).toBe(pruned.observations.length);
});
diff --git a/server/lib/comparisonModelScope.js b/server/lib/comparisonModelScope.js
index 485e05bb33..8eaed70945 100644
--- a/server/lib/comparisonModelScope.js
+++ b/server/lib/comparisonModelScope.js
@@ -24,13 +24,15 @@
* that maps to no catalog slug simply contributes nothing to the scope.
*/
-// Effort and mode suffixes a harness appends to a model id. Stripped from the
-// tail repeatedly, so `claude-opus-5-thinking-xhigh` reduces to `claude-opus-5`.
-const SUFFIXES = ['thinking', 'reasoning', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max', 'free', 'contributor', 'spark'];
+import { isConfiguredDefaultModel } from './providerModels.js';
-// Local-runtime quantization / packaging suffixes — same weights as the
-// benchmarked model, so they resolve to the same catalog slug.
+// Effort and mode suffixes a harness appends to a model id, plus the
+// local-runtime quantization/packaging suffixes that name the same weights as
+// the benchmarked model. Stripped as one repeated tail, so
+// `claude-opus-5-thinking-xhigh` reduces to `claude-opus-5`.
+const SUFFIXES = ['thinking', 'reasoning', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max', 'free', 'contributor', 'spark'];
const QUANTIZATIONS = ['4bit', '8bit', 'fp8', 'mxfp4', 'awq', 'gguf', 'optimized-speed'];
+const TAIL = new RegExp(`(?:-(?:${[...QUANTIZATIONS, ...SUFFIXES].join('|')}))+$`);
// Namespace prefixes that address a gateway or region rather than the model.
const PREFIXES = ['us.anthropic.', 'global.anthropic.', 'anthropic.', 'us.', 'global.'];
@@ -54,34 +56,38 @@ const ALIASES = new Map([
['claude-fable-5-1', 'claude-fable-5.1'],
]);
-// Provider entries that name a routing policy or a local runtime rather than a
-// benchmarked model.
-const NOT_A_MODEL = /^(auto|.*\/auto|.*-configured-default|composer-.*|big-pickle|stealth\/.*|mtplx-.*|dflash|.*-dflash2)$/i;
+// Routing policies and local runtime aliases that name no benchmarked model.
+// The "use the CLI's own default" sentinels are owned by providerModels.js.
+const NOT_A_MODEL = /^(auto|.*\/auto|composer-.*|big-pickle|stealth\/.*|mtplx-.*|dflash|.*-dflash2)$/i;
+
+/**
+ * The catalog's own spelling of a model slug.
+ *
+ * Sources spell a version with either a dash or a dot — Artificial Analysis
+ * minted Fable 5.1's max row as `claude-fable-5-1` and its other efforts as
+ * `claude-fable-5.1`, which split one reasoning curve into two series. Only a
+ * trailing all-digit pair is a version, so `qwen3-235b-a22b-2507` and
+ * `deepseek-r1-0528` are left alone.
+ *
+ * Applied both where the sync mints a slug and where a migration repairs stored
+ * rows, so the two cannot disagree about what a model is called.
+ */
+export function canonicalCatalogModelSlug(slug) {
+ if (typeof slug !== 'string' || !slug) return '';
+ return slug.replace(/-(\d+)-(\d+)$/, '-$1.$2');
+}
/** Normalize one provider model id to a catalog model slug, or '' if it is not one. */
export function catalogSlugForProviderModel(modelId) {
if (typeof modelId !== 'string' || !modelId) return '';
let slug = modelId.trim().toLowerCase();
- if (NOT_A_MODEL.test(slug)) return '';
+ if (isConfiguredDefaultModel(slug) || NOT_A_MODEL.test(slug)) return '';
slug = slug.replace(/\[[^\]]*\]$/, ''); // context-window marker, e.g. [1m]
- for (const prefix of PREFIXES) if (slug.startsWith(prefix)) { slug = slug.slice(prefix.length); break; }
+ const prefix = PREFIXES.find(candidate => slug.startsWith(candidate));
+ if (prefix) slug = slug.slice(prefix.length);
slug = slug.slice(slug.lastIndexOf('/') + 1); // vendor / gateway namespace
-
- let trimmed = true;
- while (trimmed) {
- trimmed = false;
- for (const suffix of [...QUANTIZATIONS, ...SUFFIXES]) {
- if (slug.endsWith(`-${suffix}`)) {
- slug = slug.slice(0, -(suffix.length + 1));
- trimmed = true;
- }
- }
- }
-
- // `claude-sonnet-4-6` / `claude-fable-5-1` spell a version with a dash; the
- // index spells it with a dot. Only a trailing single-digit pair is a version.
- slug = slug.replace(/-(\d+)-(\d+)$/, '-$1.$2');
+ slug = canonicalCatalogModelSlug(slug.replace(TAIL, ''));
return ALIASES.get(slug) || slug;
}
diff --git a/server/lib/comparisonModelScope.test.js b/server/lib/comparisonModelScope.test.js
index 3f7e092124..715c72ba08 100644
--- a/server/lib/comparisonModelScope.test.js
+++ b/server/lib/comparisonModelScope.test.js
@@ -1,7 +1,7 @@
import { describe, it, expect } from 'vitest';
import { readFile } from 'fs/promises';
import { join } from 'path';
-import { catalogSlugForProviderModel, providerCatalogSlugs } from './comparisonModelScope.js';
+import { canonicalCatalogModelSlug, catalogSlugForProviderModel, providerCatalogSlugs } from './comparisonModelScope.js';
const root = join(import.meta.dirname, '../..');
@@ -38,6 +38,19 @@ describe('catalogSlugForProviderModel', () => {
});
});
+describe('canonicalCatalogModelSlug', () => {
+ it('dots a trailing all-digit version pair', () => {
+ expect(canonicalCatalogModelSlug('claude-fable-5-1')).toBe('claude-fable-5.1');
+ expect(canonicalCatalogModelSlug('claude-sonnet-4-6')).toBe('claude-sonnet-4.6');
+ });
+
+ it('leaves a build date, a parameter count and a plain name alone', () => {
+ for (const slug of ['deepseek-r1-0528', 'qwen3-235b-a22b-2507', 'gpt-5.6-sol', 'llama-2-chat-70b']) {
+ expect(canonicalCatalogModelSlug(slug)).toBe(slug);
+ }
+ });
+});
+
describe('providerCatalogSlugs', () => {
it('collects slugs across providers from either model shape', () => {
const slugs = providerCatalogSlugs([
diff --git a/server/services/artificialAnalysis.js b/server/services/artificialAnalysis.js
index d60c2d2204..5fd2964d67 100644
--- a/server/services/artificialAnalysis.js
+++ b/server/services/artificialAnalysis.js
@@ -1,6 +1,7 @@
import { ServerError } from '../lib/errorHandler.js';
import { modelComparisonImportSchema } from '../lib/validation.js';
import { importModelComparison } from './modelComparison.js';
+import { canonicalCatalogModelSlug } from '../lib/comparisonModelScope.js';
export const KNOWN_EFFORTS = ['non-reasoning', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max', 'ultracode'];
@@ -33,7 +34,7 @@ export function parseModelNameAndEffort(rawName) {
}
}
- const modelSlug = slugify(name);
+ const modelSlug = canonicalCatalogModelSlug(slugify(name));
return { baseName: name, modelSlug, effort, configDetail };
}
@@ -69,14 +70,6 @@ export function transformAAModelsToObservations(models, options = {}) {
}
}
- // The id predates the dotted slug and stays frozen (it is the merge key on
- // every install), but the model must read 'claude-fable-5.1' like the other
- // efforts or max plots as its own one-point series instead of the top of
- // Fable 5.1's reasoning curve.
- if (modelSlug === 'claude-fable-5.1' && effort === 'max') {
- id = 'aa-v4.2-anthropic-claude-fable-5-1-max';
- }
-
let finalId = id;
let counter = 1;
while (seenIds.has(finalId)) {
@@ -97,23 +90,12 @@ export function transformAAModelsToObservations(models, options = {}) {
},
} : null;
- let costVal = m.artificial_analysis_intelligence_index_cost?.cost_per_task?.total_cost;
- // Known benchmark curve values for OpenAI reasoning models when omitted from AA free cost_per_task
- if (costVal == null) {
- if (modelSlug === 'gpt-5.6-terra') {
- if (effort === 'low') costVal = 0.089;
- if (effort === 'medium') costVal = 0.124;
- } else if (modelSlug === 'gpt-5.6-luna') {
- if (effort === 'low') costVal = 0.012;
- if (effort === 'medium') costVal = 0.018;
- if (effort === 'high') costVal = 0.024;
- } else if (modelSlug === 'gpt-5.5') {
- if (effort === 'low') costVal = 0.258;
- if (effort === 'medium') costVal = 0.495;
- if (effort === 'high') costVal = 0.798;
- if (effort === 'xhigh') costVal = 1.172;
- }
- }
+ // AA omits cost_per_task for most sub-max effort rows, and a stored value
+ // carries an AA source url + methodology — so a hand-entered figure would
+ // persist, federate and re-sync as something AA published. The gap is filled
+ // at render time instead (`client/src/lib/effortCostEstimate.js`), where it
+ // is drawn and labelled as an estimate.
+ const costVal = m.artificial_analysis_intelligence_index_cost?.cost_per_task?.total_cost;
const costPerTask = Number.isFinite(costVal) ? {
value: Math.round(costVal * 10000) / 10000,