Files
ai-kit/package.json
T
CatoandClaude Opus 5.5 13c8e8c0cb feat(byok): "does this key work, and what can it use?" — probeByokKey (1.17.0) (#76)
The moment a reader pastes a key, a settings screen needs two answers: does
it work, and which models can it reach — so it can preselect the best one
instead of showing a text box and failing in the chat later. OrangeCat
answered the first and threw the second away; Loki had neither.

probeByokKey checks a key the way each vendor checks keys, verified against
the live endpoints on 2026-09-25:
- OpenRouter's /models is a public catalogue that answers 200 to a FAKE key,
  so its key is checked at /key.
- Anthropic's model list wants x-api-key plus a version header.
- Google and xAI reject a bad key with 400, not 401 — any non-2xx fails,
  in the vendor's own words, with the key masked if the vendor echoes it.
- An unreachable vendor is "couldn't check", never "your key is wrong".

The suggestion names no model (the newest ids that day were
claude-opus-5.5, gpt-6-luna-pro, grok-4.7 — none of which this package had
seen). It is the newest model in the strongest tier the key can use: tier
from the name, age from the vendor's dates or, where there are none
(Google), from the version in the name, with a vendor's -latest alias as
newest; speed variants never on top; a router's frontier-lab namespaces
first. Run live against real Groq, Gemini and OpenRouter keys it suggests
gpt-oss-120b, gemini-pro-latest and anthropic/claude-opus-5.5.

readCatalog is the one GET behind fetchCatalog, keeping the status and the
vendor's message that fetchCatalog deliberately collapses; ModelRecord gains
`created`. Additive: no existing export changes behaviour.


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

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 07:32:17 -07:00

129 lines
3.2 KiB
JSON

{
"name": "@bitbaum/ai-kit",
"version": "1.17.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"
},
"./sse": {
"types": "./dist/sse.d.ts",
"default": "./dist/sse.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"
},
"./byok": {
"types": "./dist/byok.d.ts",
"default": "./dist/byok.js"
},
"./seal": {
"types": "./dist/seal.d.ts",
"default": "./dist/seal.js"
},
"./byok-probe": {
"types": "./dist/byok-probe.d.ts",
"default": "./dist/byok-probe.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",
"check:vision": "pnpm run build && node scripts/probe-vision.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.6.1",
"eslint": "^10.10.0",
"globals": "^17.12.0",
"prettier": "3.9.7",
"typescript": "^6.0.3",
"typescript-eslint": "^8.70.0"
},
"dependencies": {
"ai-forms": "^0.1.2"
},
"peerDependencies": {
"react": ">=18"
},
"peerDependenciesMeta": {
"react": {
"optional": true
}
}
}