pi-free 2.2.5 → 2.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/README.md +3 -2
- package/banner.svg +1 -1
- package/config.ts +821 -779
- package/constants.ts +3 -3
- package/index.ts +29 -24
- package/lib/built-in-toggle.ts +426 -427
- package/lib/provider-cache.ts +22 -0
- package/package.json +74 -74
- package/provider-failover/benchmark-lookup.ts +4 -1
- package/provider-failover/benchmarks-chunk-0.ts +570 -570
- package/provider-failover/benchmarks-chunk-1.ts +676 -676
- package/provider-failover/benchmarks-chunk-2.ts +673 -673
- package/provider-failover/benchmarks-chunk-3.ts +680 -680
- package/provider-failover/benchmarks-chunk-4.ts +683 -683
- package/provider-failover/benchmarks-chunk-5.ts +816 -474
- package/provider-helper.ts +64 -0
- package/providers/anyapi/anyapi.ts +270 -0
- package/providers/bai/bai.ts +8 -2
- package/providers/crofai/crofai.ts +8 -2
- package/providers/deepinfra/deepinfra.ts +8 -2
- package/providers/dynamic-built-in/index.ts +36 -26
- package/providers/kilo/kilo.ts +42 -28
- package/providers/novita/novita.ts +8 -2
- package/providers/opencode-session.ts +69 -18
- package/providers/openmodel/openmodel.ts +8 -2
- package/providers/routeway/routeway.ts +8 -2
- package/providers/sambanova/sambanova.ts +12 -6
- package/providers/together/together.ts +8 -2
- package/providers/tokenrouter/tokenrouter.ts +12 -7
- package/providers/zenmux/zenmux.ts +8 -2
- package/providers/codestral/codestral.ts +0 -128
package/lib/provider-cache.ts
CHANGED
|
@@ -128,6 +128,28 @@ export async function saveProviderCache(
|
|
|
128
128
|
_logger.debug(`Saved ${models.length} models to cache for ${providerId}`);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Persist models to the cache, but refuse to overwrite a healthy existing
|
|
133
|
+
* entry with a drastically smaller list (a transient partial/error response).
|
|
134
|
+
* Also never caches an empty list. Returns true when the cache was written.
|
|
135
|
+
*/
|
|
136
|
+
export async function saveProviderCacheGuarded(
|
|
137
|
+
providerId: string,
|
|
138
|
+
models: ProviderModelConfig[],
|
|
139
|
+
): Promise<boolean> {
|
|
140
|
+
if (!models || models.length === 0) return false;
|
|
141
|
+
const existing = getProviderCacheEntry(providerId);
|
|
142
|
+
const existingCount = existing?.models.length ?? 0;
|
|
143
|
+
if (existingCount > 0 && models.length < existingCount * 0.5) {
|
|
144
|
+
_logger.debug(
|
|
145
|
+
`Not caching ${providerId}: ${models.length} models vs ${existingCount} cached (likely transient shrink)`,
|
|
146
|
+
);
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
await saveProviderCache(providerId, models);
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
|
|
131
153
|
/**
|
|
132
154
|
* Clear cached models for a provider.
|
|
133
155
|
*/
|
package/package.json
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pi-free",
|
|
3
|
-
"version": "2.2.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "AI model providers for Pi with free model filtering and dynamic model fetching",
|
|
6
|
-
"keywords": [
|
|
7
|
-
"pi-package",
|
|
8
|
-
"pi-extension",
|
|
9
|
-
"free-models",
|
|
10
|
-
"paid-models",
|
|
11
|
-
"model-filter",
|
|
12
|
-
"nvidia-nim",
|
|
13
|
-
"kilo",
|
|
14
|
-
"cline",
|
|
15
|
-
"zenmux",
|
|
16
|
-
"crofai",
|
|
17
|
-
"ollama-cloud"
|
|
18
|
-
],
|
|
19
|
-
"license": "MIT",
|
|
20
|
-
"author": "Apostolos Mantzaris",
|
|
21
|
-
"homepage": "https://github.com/apmantza/pi-free#readme",
|
|
22
|
-
"bugs": {
|
|
23
|
-
"url": "https://github.com/apmantza/pi-free/issues"
|
|
24
|
-
},
|
|
25
|
-
"repository": {
|
|
26
|
-
"type": "git",
|
|
27
|
-
"url": "git+https://github.com/apmantza/pi-free.git"
|
|
28
|
-
},
|
|
29
|
-
"engines": {
|
|
30
|
-
"node": ">=20.0.0"
|
|
31
|
-
},
|
|
32
|
-
"files": [
|
|
33
|
-
"index.ts",
|
|
34
|
-
"providers/**/*.ts",
|
|
35
|
-
"lib/**/*.ts",
|
|
36
|
-
"provider-failover/**/*.ts",
|
|
37
|
-
"config.ts",
|
|
38
|
-
"constants.ts",
|
|
39
|
-
"provider-helper.ts",
|
|
40
|
-
"README.md",
|
|
41
|
-
"LICENSE",
|
|
42
|
-
"CHANGELOG.md",
|
|
43
|
-
"banner.svg",
|
|
44
|
-
"scripts/check-extensions.mjs"
|
|
45
|
-
],
|
|
46
|
-
"scripts": {
|
|
47
|
-
"audit:prod": "npm audit --omit=dev --audit-level=high",
|
|
48
|
-
"check": "node scripts/check-extensions.mjs",
|
|
49
|
-
"check:lockfile": "node scripts/check-lockfile-sync.mjs",
|
|
50
|
-
"check:tarball": "node scripts/check-tarball.mjs",
|
|
51
|
-
"lint": "tsc --noEmit",
|
|
52
|
-
"test": "vitest",
|
|
53
|
-
"test:ui": "vitest --ui",
|
|
54
|
-
"test:run": "vitest run",
|
|
55
|
-
"smoke:cline": "tsx scripts/smoke-cline-xml-bridge.ts",
|
|
56
|
-
"smoke:openmodel": "tsx scripts/smoke-openmodel-wire-format.ts"
|
|
57
|
-
},
|
|
58
|
-
"peerDependencies": {
|
|
59
|
-
"@earendil-works/pi-ai": "
|
|
60
|
-
"@earendil-works/pi-coding-agent": "
|
|
61
|
-
"@earendil-works/pi-tui": "
|
|
62
|
-
},
|
|
63
|
-
"devDependencies": {
|
|
64
|
-
"@vitest/ui": "^4.1.
|
|
65
|
-
"tsx": "^4.
|
|
66
|
-
"typescript": "^6.0.3",
|
|
67
|
-
"vitest": "^4.1.
|
|
68
|
-
},
|
|
69
|
-
"pi": {
|
|
70
|
-
"extensions": [
|
|
71
|
-
"./index.ts"
|
|
72
|
-
]
|
|
73
|
-
}
|
|
74
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "pi-free",
|
|
3
|
+
"version": "2.2.7",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "AI model providers for Pi with free model filtering and dynamic model fetching",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"pi-package",
|
|
8
|
+
"pi-extension",
|
|
9
|
+
"free-models",
|
|
10
|
+
"paid-models",
|
|
11
|
+
"model-filter",
|
|
12
|
+
"nvidia-nim",
|
|
13
|
+
"kilo",
|
|
14
|
+
"cline",
|
|
15
|
+
"zenmux",
|
|
16
|
+
"crofai",
|
|
17
|
+
"ollama-cloud"
|
|
18
|
+
],
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": "Apostolos Mantzaris",
|
|
21
|
+
"homepage": "https://github.com/apmantza/pi-free#readme",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/apmantza/pi-free/issues"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/apmantza/pi-free.git"
|
|
28
|
+
},
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=20.0.0"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"index.ts",
|
|
34
|
+
"providers/**/*.ts",
|
|
35
|
+
"lib/**/*.ts",
|
|
36
|
+
"provider-failover/**/*.ts",
|
|
37
|
+
"config.ts",
|
|
38
|
+
"constants.ts",
|
|
39
|
+
"provider-helper.ts",
|
|
40
|
+
"README.md",
|
|
41
|
+
"LICENSE",
|
|
42
|
+
"CHANGELOG.md",
|
|
43
|
+
"banner.svg",
|
|
44
|
+
"scripts/check-extensions.mjs"
|
|
45
|
+
],
|
|
46
|
+
"scripts": {
|
|
47
|
+
"audit:prod": "npm audit --omit=dev --audit-level=high",
|
|
48
|
+
"check": "node scripts/check-extensions.mjs",
|
|
49
|
+
"check:lockfile": "node scripts/check-lockfile-sync.mjs",
|
|
50
|
+
"check:tarball": "node scripts/check-tarball.mjs",
|
|
51
|
+
"lint": "tsc --noEmit",
|
|
52
|
+
"test": "vitest",
|
|
53
|
+
"test:ui": "vitest --ui",
|
|
54
|
+
"test:run": "vitest run",
|
|
55
|
+
"smoke:cline": "tsx scripts/smoke-cline-xml-bridge.ts",
|
|
56
|
+
"smoke:openmodel": "tsx scripts/smoke-openmodel-wire-format.ts"
|
|
57
|
+
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"@earendil-works/pi-ai": ">=0.80.0",
|
|
60
|
+
"@earendil-works/pi-coding-agent": ">=0.80.0",
|
|
61
|
+
"@earendil-works/pi-tui": ">=0.80.0"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@vitest/ui": "^4.1.10",
|
|
65
|
+
"tsx": "^4.23.0",
|
|
66
|
+
"typescript": "^6.0.3",
|
|
67
|
+
"vitest": "^4.1.10"
|
|
68
|
+
},
|
|
69
|
+
"pi": {
|
|
70
|
+
"extensions": [
|
|
71
|
+
"./index.ts"
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -27,7 +27,10 @@ export { HARDCODED_BENCHMARKS, type HardcodedBenchmark };
|
|
|
27
27
|
|
|
28
28
|
const LOG_DIR = join(homedir(), ".pi");
|
|
29
29
|
const LOG_FILE = join(LOG_DIR, "modelmatch.log");
|
|
30
|
-
|
|
30
|
+
// Debug logging writes one sync appendFileSync per model per attempt — far too
|
|
31
|
+
// expensive to leave on during startup (hundreds–thousands of blocking writes).
|
|
32
|
+
// Opt in via PI_FREE_BENCHMARK_DEBUG=1 (or setDebugLogging(true)).
|
|
33
|
+
let debugEnabled = process.env.PI_FREE_BENCHMARK_DEBUG === "1";
|
|
31
34
|
|
|
32
35
|
/**
|
|
33
36
|
* Enable/disable debug logging
|