SPB Git forge

spb/polyllm

Public
15commits 1branches 0releases
2.2 MBsize
maindefault branch
13 days agolast push
TypeScript 97.4% SQL 1% JavaScript 0.9% CSS 0.6%
1.7 KB · 27 lines typescript
Raw Blame History
1// Probe 06: which generateContent-capable text models actually answer with this (free-tier) key?2// One tiny request per model, serial and paced. Classifies: ok / 404 gone / 429 free-tier-zero / other.3import { readFileSync } from "node:fs";4import { ai, save, errInfo, quotaKind, sleep, PACE_MS, shortText } from "./lib.js";56const models: any[] = JSON.parse(readFileSync("out/models.json", "utf8"));7const skip = /embedding|veo|lyria|tts|image|aqa|transcribe|live|native-audio|robotics|computer-use|deep-research|antigravity|nano-banana/;8const targets = models.filter((m) => m.supportedGenerationMethods?.includes("generateContent") && !skip.test(m.name)).map((m) => m.name.replace("models/", ""));9console.log("targets:", targets.join(", "));1011const results: any = {};12for (const model of targets) {13  const t0 = Date.now();14  try {15    const res = await ai.models.generateContent({ model, contents: "Reply with the single word: pong", config: { maxOutputTokens: 100 } });16    results[model] = { status: "ok", text: shortText(res), modelVersion: res.modelVersion, usage: res.usageMetadata, finishReason: res.candidates?.[0]?.finishReason, ms: Date.now() - t0 };17  } catch (e) {18    const info = errInfo(e);19    const kind = quotaKind(e);20    results[model] = { status: info.httpStatus === 404 ? "gone-404" : kind === "day" ? "free-tier-zero-429" : `error-${info.httpStatus}`, error: info, ms: Date.now() - t0 };21  }22  const r = results[model];23  console.log(model.padEnd(36), r.status.padEnd(20), r.status === "ok" ? `"${r.text}" v=${r.modelVersion} thoughts=${r.usage?.thoughtsTokenCount ?? 0}` : r.error.message.slice(0, 110).replace(/\n/g, " "));24  await sleep(1500);25}26save("06-availability.json", results);27