pi-free 1.0.8 → 2.0.0

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +107 -1
  2. package/README.md +95 -46
  3. package/config.ts +165 -120
  4. package/constants.ts +22 -61
  5. package/index.ts +186 -0
  6. package/lib/json-persistence.ts +11 -10
  7. package/lib/logger.ts +2 -2
  8. package/lib/model-enhancer.ts +20 -20
  9. package/lib/open-browser.ts +41 -0
  10. package/lib/provider-cache.ts +106 -0
  11. package/lib/registry.ts +144 -0
  12. package/package.json +67 -82
  13. package/provider-factory.ts +25 -41
  14. package/provider-failover/benchmark-lookup.ts +247 -0
  15. package/provider-failover/benchmarks-chunk-0.ts +2010 -0
  16. package/provider-failover/benchmarks-chunk-1.ts +1988 -0
  17. package/provider-failover/benchmarks-chunk-2.ts +2010 -0
  18. package/provider-failover/benchmarks-chunk-3.ts +2010 -0
  19. package/provider-failover/benchmarks-chunk-4.ts +1969 -0
  20. package/provider-failover/hardcoded-benchmarks.ts +22 -10025
  21. package/provider-helper.ts +38 -37
  22. package/providers/{cline-auth.ts → cline/cline-auth.ts} +2 -2
  23. package/providers/cline/cline-models.ts +128 -0
  24. package/providers/{cline.ts → cline/cline.ts} +300 -257
  25. package/providers/cloudflare/cloudflare.ts +368 -0
  26. package/providers/dynamic-built-in/index.ts +513 -0
  27. package/providers/{kilo-auth.ts → kilo/kilo-auth.ts} +3 -20
  28. package/providers/{kilo-models.ts → kilo/kilo-models.ts} +2 -2
  29. package/providers/kilo/kilo.ts +235 -0
  30. package/providers/{modal.ts → modal/modal.ts} +4 -3
  31. package/providers/{nvidia.ts → nvidia/nvidia.ts} +152 -113
  32. package/providers/ollama/ollama.ts +172 -0
  33. package/providers/opencode-session.ts +34 -34
  34. package/providers/{qwen-auth.ts → qwen/qwen-auth.ts} +24 -40
  35. package/providers/{qwen-models.ts → qwen/qwen-models.ts} +101 -95
  36. package/providers/qwen/qwen.ts +202 -0
  37. package/provider-failover/auto-switch.ts +0 -350
  38. package/provider-failover/errors.ts +0 -275
  39. package/provider-failover/index.ts +0 -238
  40. package/providers/cline-models.ts +0 -77
  41. package/providers/factory.ts +0 -125
  42. package/providers/fireworks.ts +0 -49
  43. package/providers/go.ts +0 -216
  44. package/providers/kilo.ts +0 -146
  45. package/providers/mistral.ts +0 -144
  46. package/providers/ollama.ts +0 -113
  47. package/providers/openrouter.ts +0 -175
  48. package/providers/qwen.ts +0 -127
  49. package/providers/zen.ts +0 -371
  50. package/usage/commands.ts +0 -17
  51. package/usage/cumulative.ts +0 -193
  52. package/usage/formatters.ts +0 -115
  53. package/usage/index.ts +0 -46
  54. package/usage/limits.ts +0 -148
  55. package/usage/metrics.ts +0 -222
  56. package/usage/sessions.ts +0 -355
  57. package/usage/store.ts +0 -99
  58. package/usage/tracking.ts +0 -329
  59. package/usage/types.ts +0 -26
  60. package/usage/widget.ts +0 -90
  61. package/widget/data.ts +0 -113
  62. package/widget/format.ts +0 -26
  63. package/widget/render.ts +0 -117
package/config.ts CHANGED
@@ -5,67 +5,75 @@
5
5
  * 1. Environment variable
6
6
  * 2. ~/.pi/free.json
7
7
  *
8
- * Per-provider paid model flags:
9
- * KILO_SHOW_PAID=true or kilo_show_paid: true
10
- * OPENROUTER_SHOW_PAID=true or openrouter_show_paid: true
11
- * NVIDIA_SHOW_PAID=true or nvidia_show_paid: true
12
- * FIREWORKS_SHOW_PAID=true or fireworks_show_paid: true
13
- * CLINE_SHOW_PAID=true or cline_show_paid: true
14
- * GO_SHOW_PAID=true or go_show_paid: true
15
- * OLLAMA_SHOW_PAID=true or ollama_show_paid: true
16
- *
17
- * PI_FREE_KILO_FREE_ONLY=true — restrict Kilo to free models even after login.
8
+ * All exported values are getter functions so that runtime changes
9
+ * (e.g. after /{provider}-toggle or /free) are visible immediately.
18
10
  */
19
11
 
20
12
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
21
13
  import { join } from "node:path";
14
+ import {
15
+ PROVIDER_CLINE,
16
+ PROVIDER_KILO,
17
+ PROVIDER_MODAL,
18
+ PROVIDER_NVIDIA,
19
+ PROVIDER_QWEN,
20
+ } from "./constants.ts";
22
21
  import { createLogger } from "./lib/logger.ts";
23
22
 
24
23
  const _logger = createLogger("config");
25
24
 
26
25
  interface PiFreeConfig {
27
- openrouter_api_key?: string;
28
26
  nvidia_api_key?: string;
29
- opencode_api_key?: string;
30
- opencode_go_api_key?: string;
31
- fireworks_api_key?: string;
32
- mistral_api_key?: string;
27
+ cloudflare_api_token?: string;
28
+ cloudflare_account_id?: string;
33
29
  ollama_api_key?: string;
34
30
  modal_api_key?: string;
31
+ opencode_api_key?: string;
32
+ mistral_api_key?: string;
33
+ groq_api_key?: string;
34
+ cerebras_api_key?: string;
35
+ xai_api_key?: string;
36
+ hf_token?: string;
37
+ openrouter_api_key?: string;
35
38
  kilo_free_only?: boolean;
36
39
  hidden_models?: string[];
37
- // Per-provider paid model flags
40
+ free_only?: boolean;
38
41
  kilo_show_paid?: boolean;
39
- openrouter_show_paid?: boolean;
40
42
  nvidia_show_paid?: boolean;
41
- fireworks_show_paid?: boolean;
42
- cline_show_paid?: boolean;
43
- zen_show_paid?: boolean;
44
- go_show_paid?: boolean;
45
- mistral_show_paid?: boolean;
43
+ cloudflare_show_paid?: boolean;
46
44
  ollama_show_paid?: boolean;
45
+ cline_show_paid?: boolean;
46
+ qwen_show_paid?: boolean;
47
+ modal_show_paid?: boolean;
48
+ openrouter_show_paid?: boolean;
49
+ opencode_show_paid?: boolean;
47
50
  }
48
51
 
49
52
  const CONFIG_TEMPLATE: PiFreeConfig = {
50
- openrouter_api_key: "",
51
53
  nvidia_api_key: "",
52
- opencode_api_key: "",
53
- opencode_go_api_key: "",
54
- fireworks_api_key: "",
55
- mistral_api_key: "",
54
+ cloudflare_api_token: "",
55
+ cloudflare_account_id: "",
56
56
  ollama_api_key: "",
57
57
  modal_api_key: "",
58
+ opencode_api_key: "",
59
+ mistral_api_key: "",
60
+ groq_api_key: "",
61
+ cerebras_api_key: "",
62
+ xai_api_key: "",
63
+ hf_token: "",
64
+ openrouter_api_key: "",
58
65
  kilo_free_only: false,
59
66
  hidden_models: [],
67
+ free_only: true,
60
68
  kilo_show_paid: false,
61
- openrouter_show_paid: false,
62
69
  nvidia_show_paid: false,
63
- fireworks_show_paid: false,
64
- cline_show_paid: false,
65
- zen_show_paid: false,
66
- go_show_paid: false,
67
- mistral_show_paid: false,
70
+ cloudflare_show_paid: false,
68
71
  ollama_show_paid: false,
72
+ cline_show_paid: false,
73
+ qwen_show_paid: false,
74
+ modal_show_paid: false,
75
+ openrouter_show_paid: false,
76
+ opencode_show_paid: false,
69
77
  };
70
78
 
71
79
  const PI_DIR = join(process.env.HOME || process.env.USERPROFILE || "", ".pi");
@@ -75,7 +83,6 @@ function ensureConfigFile(): void {
75
83
  try {
76
84
  mkdirSync(PI_DIR, { recursive: true });
77
85
  if (existsSync(CONFIG_PATH)) {
78
- // Merge: add any new template keys without touching existing values
79
86
  const existing = JSON.parse(
80
87
  readFileSync(CONFIG_PATH, "utf8"),
81
88
  ) as PiFreeConfig;
@@ -102,7 +109,7 @@ function ensureConfigFile(): void {
102
109
  }
103
110
  }
104
111
 
105
- function loadConfigFile(): PiFreeConfig {
112
+ export function loadConfigFile(): PiFreeConfig {
106
113
  try {
107
114
  return JSON.parse(readFileSync(CONFIG_PATH, "utf8")) as PiFreeConfig;
108
115
  } catch {
@@ -111,16 +118,13 @@ function loadConfigFile(): PiFreeConfig {
111
118
  }
112
119
 
113
120
  ensureConfigFile();
114
- const file = loadConfigFile();
115
121
 
116
122
  // Resolve each value: env var takes priority over config file.
117
- // Treat empty strings in the config file as unset.
118
123
  function resolve(envKey: string, fileVal?: string): string | undefined {
119
124
  return process.env[envKey] || (fileVal?.trim() ? fileVal : undefined);
120
125
  }
121
126
 
122
127
  // Resolve boolean flag: env var takes priority, then config file.
123
- // If neither is set, defaults to false (free-only mode).
124
128
  function resolveBool(envKey: string, fileVal?: boolean): boolean {
125
129
  const envValue = process.env[envKey];
126
130
  if (envValue === "true") return true;
@@ -128,104 +132,134 @@ function resolveBool(envKey: string, fileVal?: boolean): boolean {
128
132
  return fileVal === true;
129
133
  }
130
134
 
131
- // Global fallback (deprecated, use per-provider flags)
132
- // Returns true only if explicitly enabled via env var
133
- export const SHOW_PAID = process.env.PI_FREE_SHOW_PAID === "true";
135
+ // =============================================================================
136
+ // Per-provider paid-model flags (getters so toggles reflect immediately)
137
+ // =============================================================================
134
138
 
135
- // Per-provider paid model flags - default to false (free-only) if not set
136
- export const KILO_SHOW_PAID = resolveBool(
137
- "KILO_SHOW_PAID",
138
- file.kilo_show_paid,
139
- );
139
+ export function getKiloShowPaid(): boolean {
140
+ return resolveBool("KILO_SHOW_PAID", loadConfigFile().kilo_show_paid);
141
+ }
140
142
 
141
- export const OPENROUTER_SHOW_PAID = resolveBool(
142
- "OPENROUTER_SHOW_PAID",
143
- file.openrouter_show_paid,
144
- );
143
+ export function getNvidiaShowPaid(): boolean {
144
+ return resolveBool("NVIDIA_SHOW_PAID", loadConfigFile().nvidia_show_paid);
145
+ }
145
146
 
146
- export const NVIDIA_SHOW_PAID = resolveBool(
147
- "NVIDIA_SHOW_PAID",
148
- file.nvidia_show_paid,
149
- );
147
+ export function getClineShowPaid(): boolean {
148
+ return resolveBool("CLINE_SHOW_PAID", loadConfigFile().cline_show_paid);
149
+ }
150
150
 
151
- export const FIREWORKS_SHOW_PAID = resolveBool(
152
- "FIREWORKS_SHOW_PAID",
153
- file.fireworks_show_paid,
154
- );
151
+ /** @deprecated Qwen provider is deprecated. */
152
+ export function getQwenShowPaid(): boolean {
153
+ return resolveBool("QWEN_SHOW_PAID", loadConfigFile().qwen_show_paid);
154
+ }
155
155
 
156
- export const CLINE_SHOW_PAID = resolveBool(
157
- "CLINE_SHOW_PAID",
158
- file.cline_show_paid,
159
- );
156
+ export function getModalShowPaid(): boolean {
157
+ return resolveBool("MODAL_SHOW_PAID", loadConfigFile().modal_show_paid);
158
+ }
160
159
 
161
- export const ZEN_SHOW_PAID = resolveBool("ZEN_SHOW_PAID", file.zen_show_paid);
160
+ export function getOllamaShowPaid(): boolean {
161
+ return resolveBool("OLLAMA_SHOW_PAID", loadConfigFile().ollama_show_paid);
162
+ }
162
163
 
163
- export const GO_SHOW_PAID = resolveBool("GO_SHOW_PAID", file.go_show_paid);
164
+ export function getCloudflareShowPaid(): boolean {
165
+ return resolveBool(
166
+ "CLOUDFLARE_SHOW_PAID",
167
+ loadConfigFile().cloudflare_show_paid,
168
+ );
169
+ }
164
170
 
165
- export const MISTRAL_SHOW_PAID = resolveBool(
166
- "MISTRAL_SHOW_PAID",
167
- file.mistral_show_paid,
168
- );
171
+ export function getOpenrouterShowPaid(): boolean {
172
+ return resolveBool(
173
+ "OPENROUTER_SHOW_PAID",
174
+ loadConfigFile().openrouter_show_paid,
175
+ );
176
+ }
169
177
 
170
- export const OLLAMA_SHOW_PAID = resolveBool(
171
- "OLLAMA_SHOW_PAID",
172
- file.ollama_show_paid,
173
- );
178
+ export function getOpencodeShowPaid(): boolean {
179
+ return resolveBool("OPENCODE_SHOW_PAID", loadConfigFile().opencode_show_paid);
180
+ }
174
181
 
175
- export const KILO_FREE_ONLY = resolveBool(
176
- "PI_FREE_KILO_FREE_ONLY",
177
- file.kilo_free_only,
178
- );
182
+ // =============================================================================
183
+ // Global free-only mode
184
+ // =============================================================================
179
185
 
180
- const HIDDEN: Set<string> = new Set(file.hidden_models ?? []);
186
+ export function getFreeOnly(): boolean {
187
+ return resolveBool("PI_FREE_ONLY", loadConfigFile().free_only);
188
+ }
181
189
 
182
- /** Removes any models whose id appears in hidden_models. */
183
- export function applyHidden<T extends { id: string }>(models: T[]): T[] {
184
- if (HIDDEN.size === 0) return models;
185
- return models.filter((m) => !HIDDEN.has(m.id));
186
- }
187
-
188
- export const OPENROUTER_API_KEY = resolve(
189
- "OPENROUTER_API_KEY",
190
- file.openrouter_api_key,
191
- );
192
- export const NVIDIA_API_KEY = resolve("NVIDIA_API_KEY", file.nvidia_api_key);
193
- export const OPENCODE_API_KEY = resolve(
194
- "OPENCODE_API_KEY",
195
- file.opencode_api_key,
196
- );
197
- export const OPENCODE_GO_API_KEY = resolve(
198
- "OPENCODE_GO_API_KEY",
199
- file.opencode_go_api_key,
200
- );
201
- export const FIREWORKS_API_KEY = resolve(
202
- "FIREWORKS_API_KEY",
203
- file.fireworks_api_key,
204
- );
205
- export const MISTRAL_API_KEY = resolve("MISTRAL_API_KEY", file.mistral_api_key);
206
- export const OLLAMA_API_KEY = resolve("OLLAMA_API_KEY", file.ollama_api_key);
207
- export const MODAL_API_KEY = resolve("MODAL_API_KEY", file.modal_api_key);
190
+ export function getKiloFreeOnly(): boolean {
191
+ return resolveBool("PI_FREE_KILO_FREE_ONLY", loadConfigFile().kilo_free_only);
192
+ }
208
193
 
209
- // Re-export provider names for consistency
210
- export {
211
- PROVIDER_CLINE,
212
- PROVIDER_FIREWORKS,
213
- PROVIDER_GO,
214
- PROVIDER_KILO,
215
- PROVIDER_MISTRAL,
216
- PROVIDER_NVIDIA,
217
- PROVIDER_OLLAMA,
218
- PROVIDER_OPENROUTER,
219
- PROVIDER_QWEN,
220
- PROVIDER_ZEN,
221
- PROVIDER_MODAL,
222
- } from "./constants.ts";
194
+ // =============================================================================
195
+ // API Keys (getters so runtime config changes are visible)
196
+ // =============================================================================
197
+
198
+ export function getNvidiaApiKey(): string | undefined {
199
+ return resolve("NVIDIA_API_KEY", loadConfigFile().nvidia_api_key);
200
+ }
201
+
202
+ export function getModalApiKey(): string | undefined {
203
+ return resolve("MODAL_API_KEY", loadConfigFile().modal_api_key);
204
+ }
205
+
206
+ export function getOllamaApiKey(): string | undefined {
207
+ return resolve("OLLAMA_API_KEY", loadConfigFile().ollama_api_key);
208
+ }
209
+
210
+ export function getCloudflareApiToken(): string | undefined {
211
+ return resolve("CLOUDFLARE_API_TOKEN", loadConfigFile().cloudflare_api_token);
212
+ }
213
+
214
+ export function getCloudflareAccountId(): string | undefined {
215
+ return resolve(
216
+ "CLOUDFLARE_ACCOUNT_ID",
217
+ loadConfigFile().cloudflare_account_id,
218
+ );
219
+ }
220
+
221
+ export function getOpencodeApiKey(): string | undefined {
222
+ return resolve("OPENCODE_API_KEY", loadConfigFile().opencode_api_key);
223
+ }
224
+
225
+ export function getMistralApiKey(): string | undefined {
226
+ return resolve("MISTRAL_API_KEY", loadConfigFile().mistral_api_key);
227
+ }
228
+
229
+ export function getGroqApiKey(): string | undefined {
230
+ return resolve("GROQ_API_KEY", loadConfigFile().groq_api_key);
231
+ }
223
232
 
233
+ export function getCerebrasApiKey(): string | undefined {
234
+ return resolve("CEREBRAS_API_KEY", loadConfigFile().cerebras_api_key);
235
+ }
236
+
237
+ export function getXaiApiKey(): string | undefined {
238
+ return resolve("XAI_API_KEY", loadConfigFile().xai_api_key);
239
+ }
240
+
241
+ export function getHfToken(): string | undefined {
242
+ return resolve("HF_TOKEN", loadConfigFile().hf_token);
243
+ }
244
+
245
+ export function getOpenrouterApiKey(): string | undefined {
246
+ return resolve("OPENROUTER_API_KEY", loadConfigFile().openrouter_api_key);
247
+ }
248
+
249
+ // =============================================================================
250
+ // Hidden models (re-reads config on every call)
224
251
  // =============================================================================
225
- // Config Persistence
252
+
253
+ export function applyHidden<T extends { id: string }>(models: T[]): T[] {
254
+ const hidden = new Set(loadConfigFile().hidden_models ?? []);
255
+ if (hidden.size === 0) return models;
256
+ return models.filter((m) => !hidden.has(m.id));
257
+ }
258
+
259
+ // =============================================================================
260
+ // Persistence
226
261
  // =============================================================================
227
262
 
228
- /** Save updated config values to ~/.pi/free.json */
229
263
  export function saveConfig(updates: Partial<PiFreeConfig>): void {
230
264
  try {
231
265
  const existing = loadConfigFile();
@@ -243,7 +277,18 @@ export function saveConfig(updates: Partial<PiFreeConfig>): void {
243
277
  }
244
278
  }
245
279
 
246
- /** Get current config values (for checking state) */
247
280
  export function getConfig(): PiFreeConfig {
248
281
  return loadConfigFile();
249
282
  }
283
+
284
+ // =============================================================================
285
+ // Re-export provider names for consistency
286
+ // =============================================================================
287
+
288
+ export {
289
+ PROVIDER_CLINE,
290
+ PROVIDER_KILO,
291
+ PROVIDER_MODAL,
292
+ PROVIDER_NVIDIA,
293
+ PROVIDER_QWEN,
294
+ };
package/constants.ts CHANGED
@@ -4,31 +4,23 @@
4
4
  */
5
5
 
6
6
  // =============================================================================
7
- // Provider names (must match registerProvider calls)
7
+ // Provider names (unique providers NOT built into pi)
8
8
  // =============================================================================
9
9
 
10
10
  export const PROVIDER_KILO = "kilo";
11
- export const PROVIDER_ZEN = "zen";
12
- export const PROVIDER_GO = "go";
13
- export const PROVIDER_OPENROUTER = "openrouter";
14
- export const PROVIDER_NVIDIA = "nvidia";
15
11
  export const PROVIDER_CLINE = "cline";
16
- export const PROVIDER_FIREWORKS = "fireworks";
17
- export const PROVIDER_OLLAMA = "ollama";
18
- export const PROVIDER_MISTRAL = "mistral";
12
+ export const PROVIDER_NVIDIA = "nvidia";
13
+ export const PROVIDER_CLOUDFLARE = "cloudflare";
14
+ export const PROVIDER_OLLAMA = "ollama-cloud";
15
+ /** @deprecated Qwen provider is deprecated. The 1,000 req/day free tier is no longer available. */
19
16
  export const PROVIDER_QWEN = "qwen";
20
17
  export const PROVIDER_MODAL = "modal";
21
18
 
22
- export const ALL_PROVIDERS = [
19
+ export const ALL_UNIQUE_PROVIDERS = [
23
20
  PROVIDER_KILO,
24
- PROVIDER_ZEN,
25
- PROVIDER_GO,
26
- PROVIDER_OPENROUTER,
27
- PROVIDER_NVIDIA,
28
21
  PROVIDER_CLINE,
29
- PROVIDER_FIREWORKS,
30
- PROVIDER_MISTRAL,
31
- PROVIDER_OLLAMA,
22
+ PROVIDER_NVIDIA,
23
+ /** @deprecated Qwen free tier no longer available */
32
24
  PROVIDER_QWEN,
33
25
  PROVIDER_MODAL,
34
26
  ] as const;
@@ -38,14 +30,16 @@ export const ALL_PROVIDERS = [
38
30
  // =============================================================================
39
31
 
40
32
  export const BASE_URL_KILO = "https://api.kilo.ai/api/gateway";
41
- export const BASE_URL_ZEN = "https://opencode.ai/zen/v1";
42
- export const BASE_URL_GO = "https://opencode.ai/zen/go/v1";
43
- export const BASE_URL_OPENROUTER = "https://openrouter.ai/api/v1";
44
33
  export const BASE_URL_NVIDIA = "https://integrate.api.nvidia.com/v1";
34
+ export const BASE_URL_CLOUDFLARE = "https://api.cloudflare.com/client/v4";
35
+ export const BASE_URL_OLLAMA = "https://ollama.com/v1"; // OpenAI-compatible API endpoint
45
36
  export const BASE_URL_CLINE = "https://api.cline.bot/api/v1";
46
- export const BASE_URL_FIREWORKS = "https://api.fireworks.ai/inference/v1";
47
- export const BASE_URL_OLLAMA = "https://ollama.com/v1";
48
37
  export const BASE_URL_MODAL = "https://api.us-west-2.modal.direct/v1";
38
+ export const BASE_URL_QWEN =
39
+ "https://dashscope.aliyuncs.com/compatible-mode/v1";
40
+
41
+ /** Cline fetches free models from OpenRouter */
42
+ export const BASE_URL_OPENROUTER = "https://openrouter.ai/api/v1";
49
43
 
50
44
  // =============================================================================
51
45
  // External URLs
@@ -53,12 +47,9 @@ export const BASE_URL_MODAL = "https://api.us-west-2.modal.direct/v1";
53
47
 
54
48
  export const URL_MODELS_DEV = "https://models.dev/api.json";
55
49
  export const URL_KILO_TOS = "https://kilo.ai/terms";
56
- export const URL_ZEN_TOS = "https://opencode.ai/terms";
57
- export const URL_GO_TOS = "https://opencode.ai/terms";
58
50
  export const URL_CLINE_TOS = "https://cline.bot/tos";
59
51
  export const URL_QWEN_TOS = "https://terms.alicloud.com/";
60
52
  export const URL_MODAL_TOS = "https://modal.com/terms";
61
- export const BASE_URL_QWEN = "https://dashscope.aliyuncs.com/compatible-mode/v1";
62
53
 
63
54
  // =============================================================================
64
55
  // Cline auth
@@ -77,47 +68,17 @@ export const DEFAULT_MIN_SIZE_B = 30; // Default minimum model size for filterin
77
68
  // Timeouts (milliseconds)
78
69
  // =============================================================================
79
70
 
80
- // Timeout for fetch operations
71
+ /** Timeout for fetch operations */
81
72
  export const DEFAULT_FETCH_TIMEOUT_MS: number = 10_000;
82
73
 
83
- export interface TestConfig {
84
- timeout: number;
85
- retries: number;
86
- label: string;
87
- }
88
-
89
- // LSP test - fixed - added missing property
90
- export const testConfig: TestConfig = {
91
- timeout: 5000,
92
- retries: 3,
93
- label: "test",
94
- };
95
-
96
- // LSP test - fixed return type
97
- export function calculateTimeout(base: number): number {
98
- return base * 2;
99
- }
100
-
101
- // LSP test - unused variable (should show hint/warning if configured)
102
- export function unusedParamTest(required: string, _unused: number): string {
103
- return required.toUpperCase();
104
- }
105
74
  export const KILO_POLL_INTERVAL_MS = 3_000;
106
75
  export const KILO_TOKEN_EXPIRATION_MS = 365 * 24 * 60 * 60 * 1000; // 1 year
107
76
 
108
77
  // =============================================================================
109
- // Additional OpenAI-compatible providers
78
+ // Removed providers (now built into pi):
79
+ // - openrouter: use pi's built-in with OPENROUTER_API_KEY
80
+ // - zen/opencode: use pi's built-in with OPENCODE_API_KEY
81
+ // - go/opencode-go: use pi's built-in with OPENCODE_API_KEY
82
+ // - mistral: use pi's built-in with MISTRAL_API_KEY
83
+ // - ollama: add to ~/.pi/agent/models.json as custom provider
110
84
  // =============================================================================
111
-
112
- export const PROVIDER_GROQ = "groq";
113
- export const PROVIDER_TOGETHER = "together";
114
- export const PROVIDER_DEEPINFRA = "deepinfra";
115
- export const PROVIDER_PERPLEXITY = "perplexity";
116
- export const PROVIDER_XAI = "xai";
117
-
118
- export const BASE_URL_GROQ = "https://api.groq.com/openai/v1";
119
- export const BASE_URL_TOGETHER = "https://api.together.xyz/v1";
120
- export const BASE_URL_DEEPINFRA = "https://api.deepinfra.com/v1/openai";
121
- export const BASE_URL_MISTRAL = "https://api.mistral.ai/v1";
122
- export const BASE_URL_PERPLEXITY = "https://api.perplexity.ai";
123
- export const BASE_URL_XAI = "https://api.x.ai/v1";