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/constants.ts
CHANGED
|
@@ -16,7 +16,6 @@ export const PROVIDER_QWEN = "qwen";
|
|
|
16
16
|
export const PROVIDER_MODAL = "modal";
|
|
17
17
|
export const PROVIDER_ZENMUX = "zenmux";
|
|
18
18
|
export const PROVIDER_CROFAI = "crofai";
|
|
19
|
-
export const PROVIDER_CODESTRAL = "codestral";
|
|
20
19
|
export const PROVIDER_LLM7 = "llm7";
|
|
21
20
|
export const PROVIDER_DEEPINFRA = "deepinfra";
|
|
22
21
|
export const PROVIDER_SAMBANOVA = "sambanova";
|
|
@@ -24,6 +23,7 @@ export const PROVIDER_TOGETHER = "together";
|
|
|
24
23
|
export const PROVIDER_NOVITA = "novita";
|
|
25
24
|
export const PROVIDER_ROUTEWAY = "routeway";
|
|
26
25
|
export const PROVIDER_TOKENROUTER = "tokenrouter";
|
|
26
|
+
export const PROVIDER_ANYAPI = "anyapi";
|
|
27
27
|
export const PROVIDER_BAI = "bai";
|
|
28
28
|
export const PROVIDER_OPENMODEL = "openmodel";
|
|
29
29
|
export const PROVIDER_QODER = "qoder";
|
|
@@ -42,7 +42,6 @@ export const ALL_UNIQUE_PROVIDERS = [
|
|
|
42
42
|
PROVIDER_OLLAMA,
|
|
43
43
|
PROVIDER_ZENMUX,
|
|
44
44
|
PROVIDER_CROFAI,
|
|
45
|
-
PROVIDER_CODESTRAL,
|
|
46
45
|
PROVIDER_LLM7,
|
|
47
46
|
PROVIDER_DEEPINFRA,
|
|
48
47
|
PROVIDER_SAMBANOVA,
|
|
@@ -50,6 +49,7 @@ export const ALL_UNIQUE_PROVIDERS = [
|
|
|
50
49
|
PROVIDER_NOVITA,
|
|
51
50
|
PROVIDER_ROUTEWAY,
|
|
52
51
|
PROVIDER_TOKENROUTER,
|
|
52
|
+
PROVIDER_ANYAPI,
|
|
53
53
|
PROVIDER_BAI,
|
|
54
54
|
PROVIDER_OPENMODEL,
|
|
55
55
|
PROVIDER_QODER,
|
|
@@ -68,7 +68,6 @@ export const BASE_URL_QWEN =
|
|
|
68
68
|
"https://dashscope.aliyuncs.com/compatible-mode/v1";
|
|
69
69
|
export const BASE_URL_ZENMUX = "https://zenmux.ai/api/v1";
|
|
70
70
|
export const BASE_URL_CROFAI = "https://crof.ai/v1";
|
|
71
|
-
export const BASE_URL_CODESTRAL = "https://codestral.mistral.ai/v1";
|
|
72
71
|
export const BASE_URL_LLM7 = "https://api.llm7.io/v1";
|
|
73
72
|
export const BASE_URL_DEEPINFRA = "https://api.deepinfra.com/v1/openai";
|
|
74
73
|
export const BASE_URL_SAMBANOVA = "https://api.sambanova.ai/v1";
|
|
@@ -76,6 +75,7 @@ export const BASE_URL_TOGETHER = "https://api.together.xyz/v1";
|
|
|
76
75
|
export const BASE_URL_NOVITA = "https://api.novita.ai/openai/v1";
|
|
77
76
|
export const BASE_URL_ROUTEWAY = "https://api.routeway.ai/v1";
|
|
78
77
|
export const BASE_URL_TOKENROUTER = "https://api.tokenrouter.com/v1";
|
|
78
|
+
export const BASE_URL_ANYAPI = "https://api.anyapi.ai/v1";
|
|
79
79
|
export const BASE_URL_BAI = "https://api.b.ai/v1";
|
|
80
80
|
/**
|
|
81
81
|
* OpenModel is registered with `api: "anthropic-messages"`. The pi-ai
|
package/index.ts
CHANGED
|
@@ -31,7 +31,6 @@ import {
|
|
|
31
31
|
} from "./lib/registry.ts";
|
|
32
32
|
// Import unique provider extensions (only providers NOT built into pi)
|
|
33
33
|
import cline from "./providers/cline/cline.ts";
|
|
34
|
-
import codestral from "./providers/codestral/codestral.ts";
|
|
35
34
|
import crofai from "./providers/crofai/crofai.ts";
|
|
36
35
|
import kilo from "./providers/kilo/kilo.ts";
|
|
37
36
|
import llm7 from "./providers/llm7/llm7.ts";
|
|
@@ -44,6 +43,7 @@ import tokenRouter from "./providers/tokenrouter/tokenrouter.ts";
|
|
|
44
43
|
import ollama from "./providers/ollama/ollama.ts";
|
|
45
44
|
import zenmux from "./providers/zenmux/zenmux.ts";
|
|
46
45
|
import bai from "./providers/bai/bai.ts";
|
|
46
|
+
import anyapi from "./providers/anyapi/anyapi.ts";
|
|
47
47
|
import openmodel from "./providers/openmodel/openmodel.ts";
|
|
48
48
|
import qoder from "./providers/qoder/qoder.ts";
|
|
49
49
|
|
|
@@ -61,7 +61,6 @@ const UNIQUE_PROVIDERS: ReadonlyArray<(pi: ExtensionAPI) => Promise<void>> = [
|
|
|
61
61
|
cline,
|
|
62
62
|
zenmux,
|
|
63
63
|
crofai,
|
|
64
|
-
codestral,
|
|
65
64
|
llm7,
|
|
66
65
|
deepinfra,
|
|
67
66
|
sambanova,
|
|
@@ -69,6 +68,7 @@ const UNIQUE_PROVIDERS: ReadonlyArray<(pi: ExtensionAPI) => Promise<void>> = [
|
|
|
69
68
|
novita,
|
|
70
69
|
routeway,
|
|
71
70
|
tokenRouter,
|
|
71
|
+
anyapi,
|
|
72
72
|
bai,
|
|
73
73
|
openmodel,
|
|
74
74
|
qoder,
|
|
@@ -386,28 +386,33 @@ export default async function piFreeEntry(pi: ExtensionAPI) {
|
|
|
386
386
|
// Setup model telemetry (tracks real-world performance)
|
|
387
387
|
setupTelemetry(pi);
|
|
388
388
|
|
|
389
|
-
// Load all unique providers
|
|
390
|
-
//
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
}
|
|
410
|
-
}
|
|
389
|
+
// Load all unique providers + dynamic built-in providers CONCURRENTLY.
|
|
390
|
+
// Running the dynamic phase (e.g. FastRouter) in parallel with the static
|
|
391
|
+
// providers avoids serializing two independent network windows at startup.
|
|
392
|
+
// Each provider registers itself with the global toggle system.
|
|
393
|
+
const dynamicSetup = (async () => {
|
|
394
|
+
try {
|
|
395
|
+
const { setupDynamicBuiltInProviders } = await import(
|
|
396
|
+
"./providers/dynamic-built-in/index.ts"
|
|
397
|
+
);
|
|
398
|
+
await setupDynamicBuiltInProviders(pi);
|
|
399
|
+
} catch (err) {
|
|
400
|
+
// Dynamic providers are a best-effort enhancement — if the import
|
|
401
|
+
// or init fails (e.g. upstream API change), continue with the
|
|
402
|
+
// already-registered static providers rather than failing the whole
|
|
403
|
+
// extension load. Log full error (message + stack) to the structured
|
|
404
|
+
// log so the user can investigate, but never block startup.
|
|
405
|
+
_logger.error("[pi-free] Dynamic built-in providers failed to load", {
|
|
406
|
+
error: err instanceof Error ? err.message : String(err),
|
|
407
|
+
stack: err instanceof Error ? err.stack : undefined,
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
})();
|
|
411
|
+
|
|
412
|
+
await Promise.allSettled([
|
|
413
|
+
...UNIQUE_PROVIDERS.map((setup) => setup(pi)),
|
|
414
|
+
dynamicSetup,
|
|
415
|
+
]);
|
|
411
416
|
|
|
412
417
|
// Setup toggles for pi's built-in providers (e.g., OpenCode)
|
|
413
418
|
setupBuiltInProviderToggles(pi);
|