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/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
- /** @deprecated Qwen provider is deprecated. The 1,000 req/day free tier is no longer available. */
15
- export const PROVIDER_QWEN = "qwen";
16
- export const PROVIDER_MODAL = "modal";
17
- export const PROVIDER_ZENMUX = "zenmux";
18
- export const PROVIDER_CROFAI = "crofai";
19
- export const PROVIDER_LLM7 = "llm7";
20
- export const PROVIDER_DEEPINFRA = "deepinfra";
21
- export const PROVIDER_SAMBANOVA = "sambanova";
22
- export const PROVIDER_TOGETHER = "together";
23
- export const PROVIDER_NOVITA = "novita";
24
- export const PROVIDER_ROUTEWAY = "routeway";
25
- export const PROVIDER_TOKENROUTER = "tokenrouter";
26
- export const PROVIDER_BAI = "bai";
27
- export const PROVIDER_OPENMODEL = "openmodel";
28
- export const PROVIDER_QODER = "qoder";
29
-
30
- // Built-in pi providers that pi-free wraps with toggles
31
- export const PROVIDER_OPENROUTER = "openrouter";
32
- export const PROVIDER_OPENCODE = "opencode";
33
- export const PROVIDER_FASTROUTER = "fastrouter";
34
-
35
- export const ALL_UNIQUE_PROVIDERS = [
36
- PROVIDER_KILO,
37
- PROVIDER_CLINE,
38
- /** @deprecated Qwen free tier no longer available */
39
- PROVIDER_QWEN,
40
- PROVIDER_MODAL,
41
- PROVIDER_OLLAMA,
42
- PROVIDER_ZENMUX,
43
- PROVIDER_CROFAI,
44
- PROVIDER_LLM7,
45
- PROVIDER_DEEPINFRA,
46
- PROVIDER_SAMBANOVA,
47
- PROVIDER_TOGETHER,
48
- PROVIDER_NOVITA,
49
- PROVIDER_ROUTEWAY,
50
- PROVIDER_TOKENROUTER,
51
- PROVIDER_BAI,
52
- PROVIDER_OPENMODEL,
53
- PROVIDER_QODER,
54
- ] as const;
55
-
56
- // =============================================================================
57
- // Provider base URLs
58
- // =============================================================================
59
-
60
- export const BASE_URL_KILO = "https://api.kilo.ai/api/gateway";
61
- export const BASE_URL_CLOUDFLARE = "https://api.cloudflare.com/client/v4";
62
- export const BASE_URL_OLLAMA = "https://ollama.com/v1"; // OpenAI-compatible API endpoint
63
- export const BASE_URL_CLINE = "https://api.cline.bot/api/v1";
64
- export const BASE_URL_MODAL = "https://api.us-west-2.modal.direct/v1";
65
- export const BASE_URL_QWEN =
66
- "https://dashscope.aliyuncs.com/compatible-mode/v1";
67
- export const BASE_URL_ZENMUX = "https://zenmux.ai/api/v1";
68
- export const BASE_URL_CROFAI = "https://crof.ai/v1";
69
- export const BASE_URL_LLM7 = "https://api.llm7.io/v1";
70
- export const BASE_URL_DEEPINFRA = "https://api.deepinfra.com/v1/openai";
71
- export const BASE_URL_SAMBANOVA = "https://api.sambanova.ai/v1";
72
- export const BASE_URL_TOGETHER = "https://api.together.xyz/v1";
73
- export const BASE_URL_NOVITA = "https://api.novita.ai/openai/v1";
74
- export const BASE_URL_ROUTEWAY = "https://api.routeway.ai/v1";
75
- export const BASE_URL_TOKENROUTER = "https://api.tokenrouter.com/v1";
76
- export const BASE_URL_BAI = "https://api.b.ai/v1";
77
- /**
78
- * OpenModel is registered with `api: "anthropic-messages"`. The pi-ai
79
- * Anthropic SDK appends `/v1/messages` to `baseURL`, so the base must
80
- * NOT include `/v1`. See {@link PROVIDER_OPENMODEL}.
81
- */
82
- export const BASE_URL_OPENMODEL = "https://api.openmodel.ai";
83
- export const BASE_URL_QODER = "https://api2-v2.qoder.sh";
84
-
85
- /** Cline fetches free models from OpenRouter */
86
- export const BASE_URL_OPENROUTER = "https://openrouter.ai/api/v1";
87
-
88
- // =============================================================================
89
- // External URLs
90
- // =============================================================================
91
-
92
- export const URL_MODELS_DEV = "https://models.dev/api.json";
93
- export const URL_KILO_TOS = "https://kilo.ai/terms";
94
- export const URL_CLINE_TOS = "https://cline.bot/tos";
95
- export const URL_QWEN_TOS = "https://terms.alicloud.com/";
96
- export const URL_MODAL_TOS = "https://modal.com/terms";
97
-
98
- // =============================================================================
99
- // Cline auth
100
- // =============================================================================
101
-
102
- export const CLINE_AUTH_TIMEOUT_MS = 5 * 60 * 1000; // 5 minutes
103
-
104
- // =============================================================================
105
- // Timeouts (milliseconds)
106
- // =============================================================================
107
-
108
- /** Timeout for fetch operations */
109
- export const DEFAULT_FETCH_TIMEOUT_MS: number = 10_000;
110
-
111
- export const KILO_POLL_INTERVAL_MS = 3_000;
112
- export const KILO_TOKEN_EXPIRATION_MS = 365 * 24 * 60 * 60 * 1000; // 1 year
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
- "[pi-free] Dynamic built-in providers failed to load",
405
- {
406
- error: err instanceof Error ? err.message : String(err),
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