From 8b380cd8612973482b6b2f5438d9299c13fee16c Mon Sep 17 00:00:00 2001 From: Dominic Nguyen Date: Fri, 31 Jul 2026 16:27:12 -0700 Subject: [PATCH 1/2] Remove models.dev attribution from price snapshots Drop source/version fields and the snapshotPrices helper from the shipped tree for licensing. Keep pinned rates only. --- ts/packages/benchmarks/package.json | 1 - .../src/core/model-prices.generated.json | 2 - ts/packages/benchmarks/src/core/prices.ts | 3 +- .../scripts/snapshotPrices.ts | 99 ------------------- 4 files changed, 1 insertion(+), 104 deletions(-) delete mode 100644 ts/packages/benchmarks/src/translationBench/scripts/snapshotPrices.ts diff --git a/ts/packages/benchmarks/package.json b/ts/packages/benchmarks/package.json index 23aaeecfc..755aac74a 100644 --- a/ts/packages/benchmarks/package.json +++ b/ts/packages/benchmarks/package.json @@ -17,7 +17,6 @@ "gen-catalog": "pnpm run build && node dist/translationBench/scripts/genCatalog.js", "prettier": "prettier --check package.json tsconfig.json src scripts --ignore-path ../../.prettierignore", "prettier:fix": "prettier --write package.json tsconfig.json src scripts --ignore-path ../../.prettierignore", - "snapshot-prices": "pnpm run build && node dist/translationBench/scripts/snapshotPrices.js", "test": "pnpm run build", "test:local": "pnpm run test", "tsc": "tsc -b" diff --git a/ts/packages/benchmarks/src/core/model-prices.generated.json b/ts/packages/benchmarks/src/core/model-prices.generated.json index 75a325f24..f5eff6979 100644 --- a/ts/packages/benchmarks/src/core/model-prices.generated.json +++ b/ts/packages/benchmarks/src/core/model-prices.generated.json @@ -1,6 +1,4 @@ { - "source": "https://models.dev/api.json", - "version": "2026-07-31T02:08:45.776Z", "unit": "USD per 1M tokens", "provider": "openai", "rates": { diff --git a/ts/packages/benchmarks/src/core/prices.ts b/ts/packages/benchmarks/src/core/prices.ts index 48f8c4a8b..5486c66e8 100644 --- a/ts/packages/benchmarks/src/core/prices.ts +++ b/ts/packages/benchmarks/src/core/prices.ts @@ -7,9 +7,8 @@ import type { Prices } from "./types.js"; const require = createRequire(import.meta.url); export interface PriceTable { - source: string; - version: string; unit?: string; + provider?: string; rates: Record; } diff --git a/ts/packages/benchmarks/src/translationBench/scripts/snapshotPrices.ts b/ts/packages/benchmarks/src/translationBench/scripts/snapshotPrices.ts deleted file mode 100644 index bd17f45a2..000000000 --- a/ts/packages/benchmarks/src/translationBench/scripts/snapshotPrices.ts +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -import { writeFileSync } from "node:fs"; - -const API_URL = "https://models.dev/api.json"; - -/** OpenAI model ids to pin (models.dev `openai` provider). */ -const MODELS = [ - "gpt-4.1", - "gpt-4.1-mini", - "gpt-5", - "gpt-5-mini", - "gpt-5.4", - "gpt-5.4-mini", - "gpt-5.4-nano", - "gpt-5.6-luna", - "gpt-5.6-sol", - "gpt-5.6-terra", -] as const; - -interface Cost { - input?: number; - output?: number; - cache_read?: number; -} - -async function main(): Promise { - const res = await fetch(API_URL, { - headers: { "User-Agent": "typeagent-benchmarks/1.0" }, - }); - if (!res.ok) { - throw new Error(`${API_URL} -> ${res.status} ${res.statusText}`); - } - const catalog = (await res.json()) as Record< - string, - { models?: Record } - >; - const openai = catalog.openai?.models; - if (!openai) { - throw new Error("models.dev response missing openai.models"); - } - - const rates: Record< - string, - { inUsdPer1M: number; cachedUsdPer1M: number; outUsdPer1M: number } - > = {}; - const missing: string[] = []; - - for (const id of MODELS) { - const cost = openai[id]?.cost; - if ( - typeof cost?.input !== "number" || - typeof cost?.output !== "number" - ) { - missing.push(id); - continue; - } - rates[id] = { - inUsdPer1M: cost.input, - cachedUsdPer1M: - typeof cost.cache_read === "number" - ? cost.cache_read - : cost.input, - outUsdPer1M: cost.output, - }; - } - - if (missing.length > 0) { - throw new Error(`models.dev missing cost for: ${missing.join(", ")}`); - } - - const outPath = process.argv[2] ?? "src/core/model-prices.generated.json"; - writeFileSync( - outPath, - `${JSON.stringify( - { - source: API_URL, - version: new Date().toISOString(), - unit: "USD per 1M tokens", - provider: "openai", - rates, - }, - null, - 2, - )}\n`, - ); - process.stderr.write( - `[snapshotPrices] wrote ${outPath}: ${MODELS.length} models (${MODELS.join(", ")})\n`, - ); -} - -main().then( - () => process.exit(0), - (e) => { - process.stderr.write(`snapshotPrices failed: ${e}\n`); - process.exit(1); - }, -); From b771e9fe304377d08e34178c24b9c5b49a1dfc10 Mon Sep 17 00:00:00 2001 From: typeagent-bot Date: Fri, 31 Jul 2026 23:35:37 +0000 Subject: [PATCH 2/2] docs: regenerate README.AUTOGEN.md, command reference, and action browser --- ts/packages/benchmarks/README.AUTOGEN.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ts/packages/benchmarks/README.AUTOGEN.md b/ts/packages/benchmarks/README.AUTOGEN.md index 858fe035d..ff256fff3 100644 --- a/ts/packages/benchmarks/README.AUTOGEN.md +++ b/ts/packages/benchmarks/README.AUTOGEN.md @@ -3,7 +3,7 @@ - + # @typeagent/benchmarks — AI-generated documentation @@ -34,10 +34,10 @@ External: _None at runtime._ ### Files of interest -`./src/core/model-prices.generated.json`, `./src/core/paths.ts`, `./src/core/prices.ts`, …and 5 more under `./src/`. +`./src/core/model-prices.generated.json`, `./src/core/paths.ts`, `./src/core/prices.ts`, …and 4 more under `./src/`. --- -_Auto-generated against commit `3bc153f3a186261d47ef517dc8cd0af4c161092b` on `2026-07-31T17:39:11.834Z` by `docs-generate.yml`. Links validated at that commit; the working tree may have drifted by up to 24h. Re-run `pnpm --filter @typeagent/benchmarks docs:verify-links` to spot-check._ +_Auto-generated against commit `8b380cd8612973482b6b2f5438d9299c13fee16c` on `2026-07-31T23:33:26.795Z` by `docs-generate.yml`. Links validated at that commit; the working tree may have drifted by up to 24h. Re-run `pnpm --filter @typeagent/benchmarks docs:verify-links` to spot-check._