opencode-pi 1.0.0 → 1.0.1

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 (2) hide show
  1. package/opencode-pi.ts +40 -5
  2. package/package.json +12 -3
package/opencode-pi.ts CHANGED
@@ -225,18 +225,53 @@ function streamOpenCodeFree(model: Model<Api>, context: Context, options?: Simpl
225
225
  return stream;
226
226
  }
227
227
 
228
+ const BASE_MODEL = {
229
+ reasoning: true,
230
+ input: ["text"] as ("text" | "image")[],
231
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
232
+ contextWindow: 128000,
233
+ maxTokens: 4096,
234
+ };
235
+ const FREE_IDS = ["big-pickle"];
236
+ const isFree = (id: string) => id.endsWith("-free") || FREE_IDS.includes(id);
237
+
228
238
  export default function (pi: ExtensionAPI) {
229
239
  pi.registerProvider("opencode-pi", {
230
240
  baseUrl: "https://opencode.ai/zen/v1",
231
241
  apiKey: "sk-noop",
232
242
  api: "opencode-pi-free",
233
243
  models: [
234
- { id: "big-pickle", name: "Big Pickle (free)", reasoning: true, input: ["text"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 128000, maxTokens: 4096 },
235
- { id: "deepseek-v4-flash-free", name: "DeepSeek V4 Flash (free)", reasoning: true, input: ["text"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 128000, maxTokens: 4096 },
236
- { id: "minimax-m2.5-free", name: "MiniMax M2.5 (free)", reasoning: false, input: ["text"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 128000, maxTokens: 4096 },
237
- { id: "nemotron-3-super-free", name: "Nemotron 3 Super (free)", reasoning: true, input: ["text"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 128000, maxTokens: 4096 },
238
- { id: "ring-2.6-1t-free", name: "Ring 2.6 1T (free)", reasoning: true, input: ["text"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 128000, maxTokens: 4096 },
244
+ { ...BASE_MODEL, id: "big-pickle", name: "Big Pickle (free)" },
245
+ { ...BASE_MODEL, id: "deepseek-v4-flash-free", name: "DeepSeek V4 Flash (free)" },
246
+ { ...BASE_MODEL, id: "minimax-m2.5-free", name: "MiniMax M2.5 (free)", reasoning: false },
247
+ { ...BASE_MODEL, id: "nemotron-3-super-free", name: "Nemotron 3 Super (free)" },
248
+ { ...BASE_MODEL, id: "ring-2.6-1t-free", name: "Ring 2.6 1T (free)" },
239
249
  ],
240
250
  streamSimple: streamOpenCodeFree,
241
251
  });
252
+
253
+ pi.on("session_start", async (_event, ctx) => {
254
+ try {
255
+ const res = await fetch("https://opencode.ai/zen/v1/models");
256
+ if (!res.ok) return;
257
+ const data = (await res.json()) as { data: { id: string }[] };
258
+ const freeModels = data.data
259
+ .filter(m => isFree(m.id))
260
+ .map(m => ({
261
+ ...BASE_MODEL,
262
+ id: m.id,
263
+ name: `${m.id.replace(/-/g, " ").replace(/\b\w/g, c => c.toUpperCase())} (free)`,
264
+ }));
265
+ if (freeModels.length) {
266
+ pi.registerProvider("opencode-pi", {
267
+ baseUrl: "https://opencode.ai/zen/v1",
268
+ apiKey: "sk-noop",
269
+ api: "opencode-pi-free",
270
+ models: freeModels,
271
+ streamSimple: streamOpenCodeFree,
272
+ });
273
+ ctx.ui.notify(`opencode-pi: loaded ${freeModels.length} free models from API`, "info");
274
+ }
275
+ } catch {}
276
+ });
242
277
  }
package/package.json CHANGED
@@ -1,12 +1,21 @@
1
1
  {
2
2
  "name": "opencode-pi",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "OpenCode Zen free models provider for Pi agent",
5
5
  "main": "opencode-pi.ts",
6
6
  "type": "module",
7
- "keywords": ["pi-package", "opencode", "zen", "free", "deepseek", "provider"],
7
+ "keywords": [
8
+ "pi-package",
9
+ "opencode",
10
+ "zen",
11
+ "free",
12
+ "deepseek",
13
+ "provider"
14
+ ],
8
15
  "pi": {
9
- "extensions": ["./opencode-pi.ts"]
16
+ "extensions": [
17
+ "./opencode-pi.ts"
18
+ ]
10
19
  },
11
20
  "peerDependencies": {
12
21
  "@mariozechner/pi-ai": "*",