Files
ai-kit/package.json
T
CatoandClaude Opus 5 982b26f909 feat(chain): a third vendor that is actually free — Gemini (#61)
The free chain had two vendors and both are shared. Groq's daily TOKEN pool is
org-wide and OpenRouter's 50 requests a day are account-wide, so on a box where
several apps hold the same key they share the exhaustion too. A Google project
is per-app, which is the property being bought here — not the model.

Nothing below rests on an inference. Verified with a real key 2026-09-15:

  GET  /v1beta/openai/models          -> 200, 56 models
  POST /v1beta/openai/chat/completions
       models/gemini-flash-latest       -> NATIVE tool_call {"city":"Zurich"}
       models/gemini-flash-lite-latest  -> NATIVE tool_call
       models/gemma-4-31b-it            -> NATIVE tool_call
       plain completion                 -> non-empty, finish=stop

THE 404 WAS AUTH, NOT ABSENCE. A consumer wrote this vendor off on the reasoning
that "the compat layer likely serves /chat/completions without a catalogue, so
its ids could never be rot-checked". That came from an UNKEYED 404 on
/v1beta/openai/models; with a key the same path answers 200. An unkeyed probe
cannot separate "absent" from "hidden behind auth" in either direction — the
same blind spot that let a paid vendor in elsewhere on a 403.

THE `models/` PREFIX IS LOAD-BEARING. The catalogue lists all 56 ids prefixed,
with no bare form anywhere, while /chat/completions accepts both (checked across
max_tokens 64/256/1024 — identical answers). A bare id therefore serves
perfectly AND is reported missing by checkCatalog on every run: a permanent
false rot alarm about a working model, which is worse than no alarm because it
teaches the reader to ignore the one that matters. Pinned by a test.

ALIASES, NOT VERSIONS. `-latest` is repointed by Google as the model behind it
retires — the property that makes `openrouter/free` the most durable entry in
the list. Not theoretical: `gemini-2.5-flash`, the id reached for from memory
while writing this, is already refused for new accounts with "no longer
available to new users, please update your code to use models/gemini-3.6-flash".
`gemma-4-31b-it` sits last and earns its place differently: Google's pricing
gives it a free column and no paid one, so it is the single id here that cannot
be quietly reclassified as billable.

ORDERING IS CAPACITY, NOT PREFERENCE. Google sits before OpenRouter for the same
reason Groq does: OpenRouter's unpaid tier is the scarcest pool in the chain, so
it is drained last. Now pinned by a test, since it was previously only a comment.

`dailyTokens: 50_000` is a deliberate under-estimate, not a figure. Google
publishes no fixed free-tier table — limits are per project, shown in AI Studio
— and no rate-limit headers come back on a completion either. Per this field's
contract, estimating high is what produces the wall the rationing exists to
prevent.

Also fixes a test that only worked while the chain had exactly two vendors: it
hard-coded two key names and compared against the sum over EVERY provider. It
now derives keys from the chain, and gains the assertion that only became
possible with a third vendor — that a keyed SUBSET contributes exactly its own
capacity.

The free-tier trade, for consumers to weigh: Google's free tier states content
is used to improve its products; the paid tier states the opposite. This is the
second-to-last link, reached only when the pools above it are spent.

266 tests pass, verify clean.


Claude-Session: https://claude.ai/code/session_01HJRuvHJEBd8t7iRA9Sb1iw

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-14 20:42:44 -07:00

112 lines
2.7 KiB
JSON

{
"name": "@bitbaum/ai-kit",
"version": "1.8.0",
"license": "MIT",
"author": "Mao Nakamoto",
"homepage": "https://github.com/bitbaum/ai-kit#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/bitbaum/ai-kit.git"
},
"bugs": {
"url": "https://github.com/bitbaum/ai-kit/issues"
},
"keywords": [
"ai",
"llm",
"form-fill",
"fallback",
"failover",
"health-check",
"free-tier",
"rate-limit",
"quota",
"fair-share",
"groq",
"openrouter"
],
"type": "module",
"sideEffects": false,
"packageManager": "pnpm@11.25.0",
"engines": {
"node": ">=20"
},
"publishConfig": {
"access": "public",
"provenance": true
},
"files": [
"dist",
"dist-cjs",
"src"
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./forms": {
"types": "./dist/forms.d.ts",
"default": "./dist/forms.js"
},
"./react": {
"types": "./dist/react.d.ts",
"default": "./dist/react.js"
},
"./server": {
"types": "./dist/server.d.ts",
"default": "./dist/server.js"
},
"./registry": {
"types": "./dist/registry.d.ts",
"require": "./dist-cjs/registry.js",
"default": "./dist/registry.js"
},
"./web": {
"types": "./dist/web/index.d.ts",
"default": "./dist/web/index.js"
},
"./capability": {
"types": "./dist/capability/index.d.ts",
"default": "./dist/capability/index.js"
},
"./grounding": {
"types": "./dist/grounding/index.d.ts",
"require": "./dist-cjs/grounding/index.js",
"default": "./dist/grounding/index.js"
}
},
"scripts": {
"build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && node -e \"require('fs').writeFileSync('dist-cjs/package.json', JSON.stringify({type:'commonjs'})+'\\n')\"",
"lint": "eslint .",
"typecheck": "tsc -p tsconfig.json --noEmit",
"test": "node --test test/*.test.js",
"check:catalog": "pnpm run build && node scripts/check-catalog.mjs",
"smoke": "pnpm run build && node scripts/smoke.mjs",
"verify": "pnpm run format:check && pnpm run lint && pnpm run typecheck && pnpm run build && pnpm test",
"prepare": "pnpm run build",
"format": "prettier --write .",
"format:check": "prettier --check ."
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@types/node": "^26.5.0",
"eslint": "^10.10.0",
"globals": "^17.12.0",
"prettier": "3.9.6",
"typescript": "^6.0.3",
"typescript-eslint": "^8.70.0"
},
"dependencies": {
"ai-forms": "^0.1.2"
},
"peerDependencies": {
"react": ">=18"
},
"peerDependenciesMeta": {
"react": {
"optional": true
}
}
}