feat: extract models from command-code dist, load via models.json

- Add scripts/extract-models.ts to parse command-code npm dist file
- Generate models.json (21 models, 15 pricing entries) with contextWindow
  and maxOutputTokens pre-filled; no nulls or hardcoded fallbacks in index.ts
- Rewrite index.ts to load model list and costs from models.json
- Cap gateway model maxOutputTokens at 65536 (API limit for Baseten/Vercel)
- Add 'Update models' section to README documenting the generation flow
- Add npm run extract-models script
This commit is contained in:
Tao Yang
2026-05-25 16:37:08 +08:00
parent b5b109c63c
commit 960d0d1f23
5 changed files with 907 additions and 143 deletions
+3 -1
View File
@@ -21,6 +21,7 @@
"files": [
"index.ts",
"src/",
"models.json",
"README.md",
"LICENSE"
],
@@ -34,7 +35,8 @@
"test:abort": "tsx tests/test-abort.ts",
"test:stream": "tsx tests/test-stream.ts",
"test:pi-local": "node tests/test-pi-local.mjs",
"test:smoke": "node tests/test-smoke.mjs"
"test:smoke": "node tests/test-smoke.mjs",
"extract-models": "tsx scripts/extract-models.ts"
},
"pi": {
"extensions": [