pi-free 2.2.6 → 2.2.8
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 -4
- package/README.md +3 -2
- package/config.ts +815 -803
- package/constants.ts +113 -121
- package/index.ts +6 -7
- package/lib/built-in-toggle.ts +426 -426
- package/lib/model-detection.ts +1 -1
- package/package.json +74 -74
- package/provider-helper.ts +29 -7
- package/providers/anyapi/anyapi.ts +270 -0
- package/providers/cline/cline-auth.ts +473 -473
- package/providers/cline/cline-xml-bridge.ts +1506 -1506
- package/providers/cline/cline.ts +205 -205
- package/providers/dynamic-built-in/index.ts +718 -718
- package/providers/kilo/kilo-auth.ts +152 -155
- package/providers/kilo/kilo.ts +14 -13
- package/providers/opencode-session.ts +514 -463
- package/providers/qoder/auth.ts +548 -548
- package/providers/qoder/qoder.ts +119 -119
- package/providers/qoder/stream.ts +585 -585
- package/providers/qoder/thinking-parser.ts +251 -251
- package/providers/qoder/transform.ts +192 -192
- package/providers/tokenrouter/tokenrouter.ts +636 -637
- package/providers/qwen/qwen-auth.ts +0 -416
- package/providers/qwen/qwen-models.ts +0 -101
- package/providers/qwen/qwen.ts +0 -200
package/constants.ts
CHANGED
|
@@ -1,121 +1,113 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared constants for pi-free-providers.
|
|
3
|
-
* Centralizes provider names, URLs, and configuration values.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
// =============================================================================
|
|
7
|
-
// Provider names (unique providers NOT built into pi)
|
|
8
|
-
// =============================================================================
|
|
9
|
-
|
|
10
|
-
export const PROVIDER_KILO = "kilo";
|
|
11
|
-
export const PROVIDER_CLINE = "cline";
|
|
12
|
-
export const PROVIDER_CLOUDFLARE = "cloudflare";
|
|
13
|
-
export const PROVIDER_OLLAMA = "ollama-cloud";
|
|
14
|
-
|
|
15
|
-
export const
|
|
16
|
-
export const
|
|
17
|
-
export const
|
|
18
|
-
export const
|
|
19
|
-
export const
|
|
20
|
-
export const
|
|
21
|
-
export const
|
|
22
|
-
export const
|
|
23
|
-
export const
|
|
24
|
-
export const
|
|
25
|
-
export const
|
|
26
|
-
export const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export const
|
|
32
|
-
|
|
33
|
-
export const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
//
|
|
59
|
-
|
|
60
|
-
export const
|
|
61
|
-
export const
|
|
62
|
-
export const
|
|
63
|
-
export const
|
|
64
|
-
export const
|
|
65
|
-
export const
|
|
66
|
-
|
|
67
|
-
export const
|
|
68
|
-
export const
|
|
69
|
-
export const
|
|
70
|
-
export const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
export const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
export const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
// =============================================================================
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
export const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
// =============================================================================
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
//
|
|
105
|
-
|
|
106
|
-
// =============================================================================
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
// =============================================================================
|
|
115
|
-
// Removed providers (now built into pi):
|
|
116
|
-
// - openrouter: use pi's built-in with OPENROUTER_API_KEY
|
|
117
|
-
// - zen/opencode: use pi's built-in with OPENCODE_API_KEY
|
|
118
|
-
// - go/opencode-go: use pi's built-in with OPENCODE_API_KEY
|
|
119
|
-
// - mistral: use pi's built-in with MISTRAL_API_KEY
|
|
120
|
-
// - ollama: add to ~/.pi/agent/models.json as custom provider
|
|
121
|
-
// =============================================================================
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants for pi-free-providers.
|
|
3
|
+
* Centralizes provider names, URLs, and configuration values.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// =============================================================================
|
|
7
|
+
// Provider names (unique providers NOT built into pi)
|
|
8
|
+
// =============================================================================
|
|
9
|
+
|
|
10
|
+
export const PROVIDER_KILO = "kilo";
|
|
11
|
+
export const PROVIDER_CLINE = "cline";
|
|
12
|
+
export const PROVIDER_CLOUDFLARE = "cloudflare";
|
|
13
|
+
export const PROVIDER_OLLAMA = "ollama-cloud";
|
|
14
|
+
export const PROVIDER_ZENMUX = "zenmux";
|
|
15
|
+
export const PROVIDER_CROFAI = "crofai";
|
|
16
|
+
export const PROVIDER_LLM7 = "llm7";
|
|
17
|
+
export const PROVIDER_DEEPINFRA = "deepinfra";
|
|
18
|
+
export const PROVIDER_SAMBANOVA = "sambanova";
|
|
19
|
+
export const PROVIDER_TOGETHER = "together";
|
|
20
|
+
export const PROVIDER_NOVITA = "novita";
|
|
21
|
+
export const PROVIDER_ROUTEWAY = "routeway";
|
|
22
|
+
export const PROVIDER_TOKENROUTER = "tokenrouter";
|
|
23
|
+
export const PROVIDER_ANYAPI = "anyapi";
|
|
24
|
+
export const PROVIDER_BAI = "bai";
|
|
25
|
+
export const PROVIDER_OPENMODEL = "openmodel";
|
|
26
|
+
export const PROVIDER_QODER = "qoder";
|
|
27
|
+
|
|
28
|
+
// Built-in pi providers that pi-free wraps with toggles
|
|
29
|
+
export const PROVIDER_OPENROUTER = "openrouter";
|
|
30
|
+
export const PROVIDER_OPENCODE = "opencode";
|
|
31
|
+
export const PROVIDER_FASTROUTER = "fastrouter";
|
|
32
|
+
|
|
33
|
+
export const ALL_UNIQUE_PROVIDERS = [
|
|
34
|
+
PROVIDER_KILO,
|
|
35
|
+
PROVIDER_CLINE,
|
|
36
|
+
PROVIDER_OLLAMA,
|
|
37
|
+
PROVIDER_ZENMUX,
|
|
38
|
+
PROVIDER_CROFAI,
|
|
39
|
+
PROVIDER_LLM7,
|
|
40
|
+
PROVIDER_DEEPINFRA,
|
|
41
|
+
PROVIDER_SAMBANOVA,
|
|
42
|
+
PROVIDER_TOGETHER,
|
|
43
|
+
PROVIDER_NOVITA,
|
|
44
|
+
PROVIDER_ROUTEWAY,
|
|
45
|
+
PROVIDER_TOKENROUTER,
|
|
46
|
+
PROVIDER_ANYAPI,
|
|
47
|
+
PROVIDER_BAI,
|
|
48
|
+
PROVIDER_OPENMODEL,
|
|
49
|
+
PROVIDER_QODER,
|
|
50
|
+
] as const;
|
|
51
|
+
|
|
52
|
+
// =============================================================================
|
|
53
|
+
// Provider base URLs
|
|
54
|
+
// =============================================================================
|
|
55
|
+
|
|
56
|
+
export const BASE_URL_KILO = "https://api.kilo.ai/api/gateway";
|
|
57
|
+
export const BASE_URL_CLOUDFLARE = "https://api.cloudflare.com/client/v4";
|
|
58
|
+
export const BASE_URL_OLLAMA = "https://ollama.com/v1"; // OpenAI-compatible API endpoint
|
|
59
|
+
export const BASE_URL_CLINE = "https://api.cline.bot/api/v1";
|
|
60
|
+
export const BASE_URL_ZENMUX = "https://zenmux.ai/api/v1";
|
|
61
|
+
export const BASE_URL_CROFAI = "https://crof.ai/v1";
|
|
62
|
+
export const BASE_URL_LLM7 = "https://api.llm7.io/v1";
|
|
63
|
+
export const BASE_URL_DEEPINFRA = "https://api.deepinfra.com/v1/openai";
|
|
64
|
+
export const BASE_URL_SAMBANOVA = "https://api.sambanova.ai/v1";
|
|
65
|
+
export const BASE_URL_TOGETHER = "https://api.together.xyz/v1";
|
|
66
|
+
export const BASE_URL_NOVITA = "https://api.novita.ai/openai/v1";
|
|
67
|
+
export const BASE_URL_ROUTEWAY = "https://api.routeway.ai/v1";
|
|
68
|
+
export const BASE_URL_TOKENROUTER = "https://api.tokenrouter.com/v1";
|
|
69
|
+
export const BASE_URL_ANYAPI = "https://api.anyapi.ai/v1";
|
|
70
|
+
export const BASE_URL_BAI = "https://api.b.ai/v1";
|
|
71
|
+
/**
|
|
72
|
+
* OpenModel is registered with `api: "anthropic-messages"`. The pi-ai
|
|
73
|
+
* Anthropic SDK appends `/v1/messages` to `baseURL`, so the base must
|
|
74
|
+
* NOT include `/v1`. See {@link PROVIDER_OPENMODEL}.
|
|
75
|
+
*/
|
|
76
|
+
export const BASE_URL_OPENMODEL = "https://api.openmodel.ai";
|
|
77
|
+
export const BASE_URL_QODER = "https://api2-v2.qoder.sh";
|
|
78
|
+
|
|
79
|
+
/** Cline fetches free models from OpenRouter */
|
|
80
|
+
export const BASE_URL_OPENROUTER = "https://openrouter.ai/api/v1";
|
|
81
|
+
|
|
82
|
+
// =============================================================================
|
|
83
|
+
// External URLs
|
|
84
|
+
// =============================================================================
|
|
85
|
+
|
|
86
|
+
export const URL_MODELS_DEV = "https://models.dev/api.json";
|
|
87
|
+
export const URL_KILO_TOS = "https://kilo.ai/terms";
|
|
88
|
+
export const URL_CLINE_TOS = "https://cline.bot/tos";
|
|
89
|
+
|
|
90
|
+
// =============================================================================
|
|
91
|
+
// Cline auth
|
|
92
|
+
// =============================================================================
|
|
93
|
+
|
|
94
|
+
export const CLINE_AUTH_TIMEOUT_MS = 5 * 60 * 1000; // 5 minutes
|
|
95
|
+
|
|
96
|
+
// =============================================================================
|
|
97
|
+
// Timeouts (milliseconds)
|
|
98
|
+
// =============================================================================
|
|
99
|
+
|
|
100
|
+
/** Timeout for fetch operations */
|
|
101
|
+
export const DEFAULT_FETCH_TIMEOUT_MS: number = 10_000;
|
|
102
|
+
|
|
103
|
+
export const KILO_POLL_INTERVAL_MS = 3_000;
|
|
104
|
+
export const KILO_TOKEN_EXPIRATION_MS = 365 * 24 * 60 * 60 * 1000; // 1 year
|
|
105
|
+
|
|
106
|
+
// =============================================================================
|
|
107
|
+
// Removed providers (now built into pi):
|
|
108
|
+
// - openrouter: use pi's built-in with OPENROUTER_API_KEY
|
|
109
|
+
// - zen/opencode: use pi's built-in with OPENCODE_API_KEY
|
|
110
|
+
// - go/opencode-go: use pi's built-in with OPENCODE_API_KEY
|
|
111
|
+
// - mistral: use pi's built-in with MISTRAL_API_KEY
|
|
112
|
+
// - ollama: add to ~/.pi/agent/models.json as custom provider
|
|
113
|
+
// =============================================================================
|
package/index.ts
CHANGED
|
@@ -43,6 +43,7 @@ import tokenRouter from "./providers/tokenrouter/tokenrouter.ts";
|
|
|
43
43
|
import ollama from "./providers/ollama/ollama.ts";
|
|
44
44
|
import zenmux from "./providers/zenmux/zenmux.ts";
|
|
45
45
|
import bai from "./providers/bai/bai.ts";
|
|
46
|
+
import anyapi from "./providers/anyapi/anyapi.ts";
|
|
46
47
|
import openmodel from "./providers/openmodel/openmodel.ts";
|
|
47
48
|
import qoder from "./providers/qoder/qoder.ts";
|
|
48
49
|
|
|
@@ -67,6 +68,7 @@ const UNIQUE_PROVIDERS: ReadonlyArray<(pi: ExtensionAPI) => Promise<void>> = [
|
|
|
67
68
|
novita,
|
|
68
69
|
routeway,
|
|
69
70
|
tokenRouter,
|
|
71
|
+
anyapi,
|
|
70
72
|
bai,
|
|
71
73
|
openmodel,
|
|
72
74
|
qoder,
|
|
@@ -400,13 +402,10 @@ export default async function piFreeEntry(pi: ExtensionAPI) {
|
|
|
400
402
|
// already-registered static providers rather than failing the whole
|
|
401
403
|
// extension load. Log full error (message + stack) to the structured
|
|
402
404
|
// log so the user can investigate, but never block startup.
|
|
403
|
-
_logger.error(
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
stack: err instanceof Error ? err.stack : undefined,
|
|
408
|
-
},
|
|
409
|
-
);
|
|
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
|
+
});
|
|
410
409
|
}
|
|
411
410
|
})();
|
|
412
411
|
|