opencode-magpie-plugin 0.1.6 → 0.1.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/README.md CHANGED
@@ -55,7 +55,7 @@ OpenCode V2
55
55
 
56
56
  ```jsonc
57
57
  {
58
- "plugins": ["opencode-magpie-plugin@0.1.6"]
58
+ "plugins": ["opencode-magpie-plugin@0.1.7"]
59
59
  }
60
60
  ```
61
61
 
@@ -91,6 +91,10 @@ Routing group(例如 `group/auto`)会跨多个服务路由,因此不按 `o
91
91
 
92
92
  思考强度读取新版 `reasoning_levels`,并兼容已安装版本常见的 `supported_reasoning_levels`(`{ effort }` 对象或字符串列表)。只有网关实际声明的档位才会出现,可在 OpenCode 的模型变体控件中选择,或使用 `provider/model#high` 这样的引用。`default` 保留服务默认行为,不额外生成档位;网关未提供档位时不会凭模型名称猜测。
93
93
 
94
+ 支持 Fast 的模型会额外显示一个 `-fast` 模型,例如 `composer-2.5` / `composer-2.5-fast`,显示名为 `Composer 2.5` / `Composer 2.5 Fast`。选择 Fast 后仍向 Magpie 发送原模型 ID,同时附带 `service_tier: "priority"`,并保留原有思考档位。检测依据是 `/v1/models` 的 `service_tiers` 包含 `priority`;旧网关漏报时,补读本机 Magpie 配置目录的 `plugin-providers.json` 中 Cursor 的 `fast: true` 或插件的 `serviceTiers`。仅扩展网关当前列出的模型,已有同名 `-fast` 模型优先,刷新时同步增删。
95
+
96
+ Fast 模型优先采用内置表中明确登记的 Fast 费率及上下文档位;没有独立 Fast 费率时仍沿用原模型参考价,不代表 Fast 实际费率。缺少原模型报价时仍按未知价格处理。
97
+
94
98
  根据 `native_endpoints` 选择 OpenCode 内置 runtime:
95
99
 
96
100
  | Magpie 元数据 | OpenCode runtime |
@@ -141,7 +145,20 @@ MAGPIE_ADDR=127.0.0.1:3426 opencode --standalone
141
145
  3. 普通模型仍缺价时,查询 models.dev 本地缓存:优先同 provider 的精确 ID,再查已识别厂商(OpenAI、Anthropic、DeepSeek、Google、xAI)的精确 ID 或 `canonical_model_id`。不跨版本猜价、不采用其他转售商报价、不使用订阅 plan 目录的零价。
142
146
  4. 所有来源均没有价格时,不启用该模型,避免把未知价格显示为免费。**路由组例外**:Magpie 只在组内全部成员同价时才给组报价,而路由组每一轮的成员由路由决定,成本本来就是一个区间而不是单一数字。这类组保持可选用、保留自己的名字,只是费用读数不精确。路由分组仍只用 Magpie 报价,不根据 `auto-*` 名称推断成员价格。
143
147
 
144
- models.dev 缓存写入 `$XDG_CACHE_HOME/opencode-magpie-plugin/models.json`(默认 `~/.cache/opencode-magpie-plugin/models.json`)。首次可只读复用 Magpie、OpenCode 的 `models.json`;下载只写插件自己的目录。每次模型刷新检查缓存,超过 24 小时后台更新,缺价时可提前到 6 小时;同进程下载去重且失败后至少间隔 6 小时重试。首次下载和更新不阻塞模型发现,成功后下一次 30 秒刷新采用新目录;离线保留旧缓存。下载源为 `https://models.dev/api.json`,仍然零运行时依赖,目前只采用基础价,未接入阶梯价。
148
+ models.dev 缓存写入 `$XDG_CACHE_HOME/opencode-magpie-plugin/models.json`(默认 `~/.cache/opencode-magpie-plugin/models.json`)。首次可只读复用 Magpie、OpenCode 的 `models.json`;下载只写插件自己的目录。每次模型刷新检查缓存,超过 24 小时后台更新,缺价时可提前到 6 小时;同进程下载去重且失败后至少间隔 6 小时重试。首次下载和更新不阻塞模型发现,成功后下一次 30 秒刷新采用新目录;离线保留旧缓存。下载源为 `https://models.dev/api.json`,仍然零运行时依赖,基础价和 context 阶梯价一并传给 OpenCode。
149
+
150
+ ### 0.1.8
151
+
152
+ - 修复上下文阶梯价丢失:保留内置表、models.dev 的 `tier.type=context` 与 Magpie 的 `above` 分档,交给 OpenCode 根据单次输入(含缓存)选择整单费率。
153
+ - GPT-6 Astra 标准价为输入/输出/缓存读/缓存写 `$10/$50/$1/$12.5`,超过 272K 输入后为 `$20/$75/$2/$25`;Fast 两档均为标准价的两倍。单位为美元/百万 token。
154
+ - 同步补齐 GPT-6 Sol、GPT-6 Luna、GPT-6.1 Sol 的 Standard/Fast 长上下文分档;GPT-6.1 Sol 独立使用 `$0.10` 缓存读取价,不再回退到旧 Sol 的 `$0.20`。依据 [OpenAI 官方价格表](https://developers.openai.com/api/docs/pricing)(2026-10-18)。
155
+ - 自动派生 Fast 模型优先使用已登记的独立 Fast 价格;保留 provider 覆盖、未知价格及路由组原有策略。
156
+
157
+ ### 0.1.7
158
+
159
+ - 根据模型声明的 Fast 能力自动派生 `-fast` 模型,使用原模型 ID 加 `service_tier: "priority"` 路由,并保留思考档位。
160
+ - 兼容旧网关未透出的本地插件 Fast 元数据;已有同名模型优先,目录刷新同步增删。
161
+ - 内置费率不变;派生 Fast 模型沿用原模型参考价,尚未接入独立 Fast 费率。
145
162
 
146
163
  ### 0.1.6
147
164
 
@@ -158,7 +175,7 @@ Cursor 使用 `cursor` 覆盖,WorkBuddy 使用 `codebuddy` 覆盖;其他已
158
175
  所有价格单位都是 **美元 / 百万 token**。OpenCode 用这些单价计算请求费用。普通计费的概念公式为:
159
176
 
160
177
  ```text
161
- 费用 = (非缓存输入 × input + 输出 × output
178
+ 费用 = (非缓存输入 × input + (可见输出 + 推理) × output
162
179
  + 缓存读取 × cache.read + 缓存写入 × cache.write) / 1,000,000
163
180
  ```
164
181
 
@@ -170,7 +187,7 @@ Cursor 使用 `cursor` 覆盖,WorkBuddy 使用 `codebuddy` 覆盖;其他已
170
187
  - Magpie 用户自定义价格不会覆盖已命中的内置价格表。
171
188
  - Routing group 可能动态切换成员,目录价格不保证等于实际被选成员的价格。
172
189
  - Cursor 等服务的 `usage.magpie_deferred` 是迟到用量,Magpie 会补记到账本;OpenCode 原生 runtime 不会因此修改历史费用。
173
- - 当前价格映射不支持 Magpie 的上下文阶梯价和独立的一小时缓存写入价。
190
+ - 当前价格映射仍不支持 Magpie 独立的一小时缓存写入价。
174
191
 
175
192
  因此,OpenCode 费用适合观察 token 成本,**不能承诺与 Magpie 或订阅服务最终账单完全一致**。
176
193
 
package/dist/index.d.mts CHANGED
@@ -41,9 +41,14 @@ type ModelInfo2 = {
41
41
  read: number;
42
42
  write: number;
43
43
  };
44
+ tier?: {
45
+ type: 'context';
46
+ size: number;
47
+ };
44
48
  }[];
45
49
  package?: string;
46
50
  settings?: Record<string, unknown>;
51
+ body?: Record<string, unknown>;
47
52
  };
48
53
  type ProviderEditor = {
49
54
  add: (entry: {
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as getModelPricing } from "./model-pricing--x7wwPba.mjs";
1
+ import { i as resolveModelPricingKey, n as getModelPricing } from "./model-pricing-BbteicIQ.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { access, mkdir, readFile, realpath, rename, rm, stat, writeFile } from "node:fs/promises";
4
4
  import { homedir } from "node:os";
@@ -7,6 +7,93 @@ import { spawn } from "node:child_process";
7
7
  import { constants } from "node:fs";
8
8
  import { setTimeout } from "node:timers/promises";
9
9
 
10
+ //#region src/opencode.ts
11
+ const createTrackedSetup = () => {
12
+ const registrations = [];
13
+ return {
14
+ track: async (registration) => {
15
+ registrations.push(await registration);
16
+ },
17
+ cleanup: async () => {
18
+ await registrations.splice(0).reverse().reduce(async (previous, registration) => {
19
+ await previous;
20
+ await registration.dispose().catch(() => {});
21
+ }, Promise.resolve());
22
+ }
23
+ };
24
+ };
25
+ const reloadProviderCatalog = async (ctx) => {
26
+ await ctx.provider?.reload();
27
+ };
28
+ /** USD per million tokens. Missing cache rates retain the original registry's zero fallback. */
29
+ const normalizeModelCosts = (cost) => {
30
+ if (!cost || typeof cost !== "object") return [];
31
+ const value = cost;
32
+ if (typeof value.input !== "number" || !Number.isFinite(value.input) || typeof value.output !== "number" || !Number.isFinite(value.output)) return [];
33
+ const base = {
34
+ input: value.input,
35
+ output: value.output,
36
+ cache: {
37
+ read: value.cache?.read ?? value.cache_read ?? 0,
38
+ write: value.cache?.write ?? value.cache_write ?? 0
39
+ }
40
+ };
41
+ const valid = (rate) => typeof rate === "number" && Number.isFinite(rate) && rate >= 0;
42
+ if (![
43
+ base.input,
44
+ base.output,
45
+ base.cache.read,
46
+ base.cache.write
47
+ ].every(valid)) return [];
48
+ const result = [base];
49
+ for (const raw of Array.isArray(value.tiers) ? value.tiers : []) {
50
+ if (!raw || typeof raw !== "object") continue;
51
+ const entry = raw;
52
+ const size = entry.tier ? entry.tier.type === "context" ? entry.tier.size : void 0 : entry.above;
53
+ if (!valid(size) || !Number.isInteger(size)) continue;
54
+ const rates = {
55
+ input: entry.input ?? base.input,
56
+ output: entry.output ?? base.output,
57
+ cache: {
58
+ read: entry.cache?.read ?? entry.cache_read ?? base.cache.read,
59
+ write: entry.cache?.write ?? entry.cache_write ?? base.cache.write
60
+ }
61
+ };
62
+ if (![
63
+ rates.input,
64
+ rates.output,
65
+ rates.cache.read,
66
+ rates.cache.write
67
+ ].every(valid)) continue;
68
+ result.push({
69
+ ...rates,
70
+ tier: {
71
+ type: "context",
72
+ size
73
+ }
74
+ });
75
+ }
76
+ return result;
77
+ };
78
+ const toClassicModelInfo = (providerID, catalogID, entry) => ({
79
+ id: catalogID,
80
+ modelID: entry.id,
81
+ providerID,
82
+ name: entry.name,
83
+ capabilities: {
84
+ tools: entry.tool_call !== false,
85
+ input: entry.modalities?.input?.length ? entry.modalities.input : ["text"],
86
+ output: entry.modalities?.output?.length ? entry.modalities.output : ["text"]
87
+ },
88
+ limit: { ...entry.limit },
89
+ variants: [],
90
+ status: "active",
91
+ enabled: true,
92
+ time: { released: 0 },
93
+ cost: normalizeModelCosts(entry.cost)
94
+ });
95
+
96
+ //#endregion
10
97
  //#region src/catalog-cache.ts
11
98
  /**
12
99
  * models.dev catalog, read the way Magpie reads it.
@@ -133,13 +220,10 @@ const catalogPrice = (cost) => {
133
220
  cost.cache_read ?? 0,
134
221
  cost.cache_write ?? 0
135
222
  ].some((n) => typeof n !== "number" || !Number.isFinite(n) || n < 0)) return void 0;
223
+ const [base, ...tiers] = normalizeModelCosts(cost);
136
224
  return {
137
- input: cost.input,
138
- output: cost.output,
139
- cache: {
140
- read: cost.cache_read ?? 0,
141
- write: cost.cache_write ?? 0
142
- }
225
+ ...base,
226
+ ...tiers.length ? { tiers } : {}
143
227
  };
144
228
  };
145
229
  /**
@@ -177,57 +261,6 @@ const priceInProvider = (catalog, maker, id) => {
177
261
  return prices.length && prices.every((price$1) => JSON.stringify(price$1) === JSON.stringify(prices[0])) ? prices[0] : void 0;
178
262
  };
179
263
 
180
- //#endregion
181
- //#region src/opencode.ts
182
- const createTrackedSetup = () => {
183
- const registrations = [];
184
- return {
185
- track: async (registration) => {
186
- registrations.push(await registration);
187
- },
188
- cleanup: async () => {
189
- await registrations.splice(0).reverse().reduce(async (previous, registration) => {
190
- await previous;
191
- await registration.dispose().catch(() => {});
192
- }, Promise.resolve());
193
- }
194
- };
195
- };
196
- const reloadProviderCatalog = async (ctx) => {
197
- await ctx.provider?.reload();
198
- };
199
- /** USD per million tokens. Missing cache rates retain the original registry's zero fallback. */
200
- const normalizeModelCosts = (cost) => {
201
- if (!cost || typeof cost !== "object") return [];
202
- const value = cost;
203
- if (typeof value.input !== "number" || !Number.isFinite(value.input) || typeof value.output !== "number" || !Number.isFinite(value.output)) return [];
204
- return [{
205
- input: value.input,
206
- output: value.output,
207
- cache: {
208
- read: value.cache?.read ?? value.cache_read ?? 0,
209
- write: value.cache?.write ?? value.cache_write ?? 0
210
- }
211
- }];
212
- };
213
- const toClassicModelInfo = (providerID, catalogID, entry) => ({
214
- id: catalogID,
215
- modelID: entry.id,
216
- providerID,
217
- name: entry.name,
218
- capabilities: {
219
- tools: entry.tool_call !== false,
220
- input: entry.modalities?.input?.length ? entry.modalities.input : ["text"],
221
- output: entry.modalities?.output?.length ? entry.modalities.output : ["text"]
222
- },
223
- limit: { ...entry.limit },
224
- variants: [],
225
- status: "active",
226
- enabled: true,
227
- time: { released: 0 },
228
- cost: normalizeModelCosts(entry.cost)
229
- });
230
-
231
264
  //#endregion
232
265
  //#region src/catalog.ts
233
266
  /** Whether any model Magpie lists has no price in any source, which asks for a fresher catalog. */
@@ -288,6 +321,8 @@ const modelCost = (row, group, catalog) => {
288
321
  };
289
322
  const buildInventory = (rows, baseURL, options = {}) => {
290
323
  const providers = /* @__PURE__ */ new Map();
324
+ const fastModelIDs = new Set(options.fastModelIDs);
325
+ for (const row of rows) if (row.service_tiers?.some((tier) => (typeof tier === "string" ? tier : tier.id) === "priority")) fastModelIDs.add(row.id);
291
326
  rows.filter((row) => !row.kind && row.id.includes("/")).forEach((row) => {
292
327
  const group = row.id.startsWith("group/");
293
328
  const owner = group ? ROUTING_GROUP : row.owned_by;
@@ -337,7 +372,48 @@ const buildInventory = (rows, baseURL, options = {}) => {
337
372
  if (!entry.models.some((existing) => existing.id === model.id)) entry.models.push(model);
338
373
  providers.set(providerID, entry);
339
374
  });
340
- return [...providers.values()];
375
+ return [...providers.values()].map((entry) => {
376
+ const ids = new Set(entry.models.map((model) => model.id));
377
+ return {
378
+ ...entry,
379
+ models: entry.models.flatMap((model) => {
380
+ if (!fastModelIDs.has(model.modelID) || /-fast(?:@\d+[km])?$/i.test(model.id) || ids.has(`${model.id}-fast`)) return [model];
381
+ const row = rows.find((row$1) => row$1.id === model.modelID);
382
+ const fastKey = `${model.id.replace(/@\d+(?:k|m)$/i, "")}-fast`;
383
+ const fastPrice = row && !row.id.startsWith("group/") && resolveModelPricingKey(fastKey)?.endsWith("-fast") ? getModelPricing(fastKey, pricingProvider(row.owned_by)) : void 0;
384
+ return [model, {
385
+ ...model,
386
+ id: `${model.id}-fast`,
387
+ cost: fastPrice ? normalizeModelCosts(fastPrice) : model.cost,
388
+ name: `${model.name.replace(/ \(价格未知\)$/, "")} Fast${model.enabled ? "" : " (价格未知)"}`,
389
+ body: {
390
+ ...model.body,
391
+ service_tier: "priority"
392
+ }
393
+ }];
394
+ })
395
+ };
396
+ });
397
+ };
398
+
399
+ //#endregion
400
+ //#region src/fast-models.ts
401
+ /** Older gateways omit Cursor's fast flag from /v1/models; read only capability metadata. */
402
+ const loadFastModelIDs = async () => {
403
+ const path = join(process.env.XDG_CONFIG_HOME || join(homedir(), ".config"), "magpie", "plugin-providers.json");
404
+ const ids = /* @__PURE__ */ new Set();
405
+ try {
406
+ const providers = JSON.parse(await readFile(path, "utf8"));
407
+ if (!Array.isArray(providers)) return ids;
408
+ for (const provider of providers) {
409
+ if (typeof provider?.id !== "string" || !Array.isArray(provider.models)) continue;
410
+ for (const model of provider.models) {
411
+ if (typeof model?.id !== "string") continue;
412
+ if (Array.isArray(model.serviceTiers) && model.serviceTiers.includes("priority") || provider.id === "cursor" && model.fast === true) ids.add(`${provider.id}/${model.id}`);
413
+ }
414
+ }
415
+ } catch {}
416
+ return ids;
341
417
  };
342
418
 
343
419
  //#endregion
@@ -492,7 +568,10 @@ const setupPlugin = async (ctx) => {
492
568
  const baseURL = await resolveBaseURL();
493
569
  await ensureGateway(baseURL);
494
570
  let catalog = await loadCatalogCache();
495
- let inventory = buildInventory(await fetchModels(baseURL), baseURL, { catalog: catalog.data });
571
+ let inventory = buildInventory(await fetchModels(baseURL), baseURL, {
572
+ catalog: catalog.data,
573
+ fastModelIDs: await loadFastModelIDs()
574
+ });
496
575
  const { track, cleanup } = createTrackedSetup();
497
576
  let disposed = false;
498
577
  let refreshing = false;
@@ -532,7 +611,10 @@ const setupPlugin = async (ctx) => {
532
611
  await ensureGateway(baseURL);
533
612
  const rows = await fetchModels(baseURL);
534
613
  catalog = await loadCatalogCache(hasUnpricedModel(inventory));
535
- await apply(buildInventory(rows, baseURL, { catalog: catalog.data }));
614
+ await apply(buildInventory(rows, baseURL, {
615
+ catalog: catalog.data,
616
+ fastModelIDs: await loadFastModelIDs()
617
+ }));
536
618
  } catch (error) {
537
619
  console.warn("[magpie] 模型刷新失败,保留上次目录:", error instanceof Error ? error.message : String(error));
538
620
  } finally {
@@ -47,6 +47,7 @@ const MODEL_PRICING_ALIASES = {
47
47
  "gpt-5-6-sol": "gpt-5.6-sol",
48
48
  "gpt-5-6-terra": "gpt-5.6-terra",
49
49
  "gpt-5-6-luna": "gpt-5.6-luna",
50
+ "gpt-6-1-sol": "gpt-6.1-sol",
50
51
  "hy3-ioa": "hy-3",
51
52
  hy3: "hy-3",
52
53
  "hy-4-preview": "hy4-preview",
@@ -591,7 +592,19 @@ const MODEL_PRICINGS = {
591
592
  cache: {
592
593
  read: 1,
593
594
  write: 12.5
594
- }
595
+ },
596
+ tiers: [{
597
+ input: 20,
598
+ output: 75,
599
+ cache: {
600
+ read: 2,
601
+ write: 25
602
+ },
603
+ tier: {
604
+ type: "context",
605
+ size: 272e3
606
+ }
607
+ }]
595
608
  } },
596
609
  "gpt-6-astra-fast": { default: {
597
610
  input: 20,
@@ -599,7 +612,19 @@ const MODEL_PRICINGS = {
599
612
  cache: {
600
613
  read: 2,
601
614
  write: 25
602
- }
615
+ },
616
+ tiers: [{
617
+ input: 40,
618
+ output: 150,
619
+ cache: {
620
+ read: 4,
621
+ write: 50
622
+ },
623
+ tier: {
624
+ type: "context",
625
+ size: 272e3
626
+ }
627
+ }]
603
628
  } },
604
629
  "gpt-6-sol": { default: {
605
630
  input: 2,
@@ -607,7 +632,39 @@ const MODEL_PRICINGS = {
607
632
  cache: {
608
633
  read: .2,
609
634
  write: 2.5
610
- }
635
+ },
636
+ tiers: [{
637
+ input: 4,
638
+ output: 15,
639
+ cache: {
640
+ read: .4,
641
+ write: 5
642
+ },
643
+ tier: {
644
+ type: "context",
645
+ size: 272e3
646
+ }
647
+ }]
648
+ } },
649
+ "gpt-6-sol-fast": { default: {
650
+ input: 4,
651
+ output: 20,
652
+ cache: {
653
+ read: .4,
654
+ write: 5
655
+ },
656
+ tiers: [{
657
+ input: 8,
658
+ output: 30,
659
+ cache: {
660
+ read: .8,
661
+ write: 10
662
+ },
663
+ tier: {
664
+ type: "context",
665
+ size: 272e3
666
+ }
667
+ }]
611
668
  } },
612
669
  "gpt-6-luna": { default: {
613
670
  input: .1,
@@ -615,7 +672,79 @@ const MODEL_PRICINGS = {
615
672
  cache: {
616
673
  read: .01,
617
674
  write: .125
618
- }
675
+ },
676
+ tiers: [{
677
+ input: .2,
678
+ output: .75,
679
+ cache: {
680
+ read: .02,
681
+ write: .25
682
+ },
683
+ tier: {
684
+ type: "context",
685
+ size: 272e3
686
+ }
687
+ }]
688
+ } },
689
+ "gpt-6-luna-fast": { default: {
690
+ input: .2,
691
+ output: 1,
692
+ cache: {
693
+ read: .02,
694
+ write: .25
695
+ },
696
+ tiers: [{
697
+ input: .4,
698
+ output: 1.5,
699
+ cache: {
700
+ read: .04,
701
+ write: .5
702
+ },
703
+ tier: {
704
+ type: "context",
705
+ size: 272e3
706
+ }
707
+ }]
708
+ } },
709
+ "gpt-6.1-sol": { default: {
710
+ input: 2,
711
+ output: 10,
712
+ cache: {
713
+ read: .1,
714
+ write: 2.5
715
+ },
716
+ tiers: [{
717
+ input: 4,
718
+ output: 15,
719
+ cache: {
720
+ read: .2,
721
+ write: 5
722
+ },
723
+ tier: {
724
+ type: "context",
725
+ size: 272e3
726
+ }
727
+ }]
728
+ } },
729
+ "gpt-6.1-sol-fast": { default: {
730
+ input: 4,
731
+ output: 20,
732
+ cache: {
733
+ read: .2,
734
+ write: 5
735
+ },
736
+ tiers: [{
737
+ input: 8,
738
+ output: 30,
739
+ cache: {
740
+ read: .4,
741
+ write: 10
742
+ },
743
+ tier: {
744
+ type: "context",
745
+ size: 272e3
746
+ }
747
+ }]
619
748
  } },
620
749
  "gpt-5.5": {
621
750
  default: {
@@ -767,7 +896,11 @@ const MODEL_PRICINGS = {
767
896
  const clonePricing = (pricing) => ({
768
897
  input: pricing.input,
769
898
  output: pricing.output,
770
- ...pricing.cache ? { cache: { ...pricing.cache } } : {}
899
+ ...pricing.cache ? { cache: { ...pricing.cache } } : {},
900
+ ...pricing.tiers ? { tiers: pricing.tiers.map((entry) => ({
901
+ ...clonePricing(entry),
902
+ tier: { ...entry.tier }
903
+ })) } : {}
771
904
  });
772
905
  const stripProviderSuffixes = (key) => {
773
906
  const suffix = PROVIDER_MODEL_SUFFIXES.find((candidate) => key.endsWith(candidate));
@@ -12,6 +12,12 @@ interface ModelPricing {
12
12
  read?: number;
13
13
  write?: number;
14
14
  };
15
+ tiers?: (Omit<ModelPricing, 'tiers'> & {
16
+ tier: {
17
+ type: 'context';
18
+ size: number;
19
+ };
20
+ })[];
15
21
  }
16
22
  type ModelPricingProvider = 'astra' | 'boxai' | 'codebuddy' | 'cursor' | 'imate' | 'kalm';
17
23
  /**
@@ -1,3 +1,3 @@
1
- import { i as resolveModelPricingKey, n as getModelPricing, r as getRequiredModelPricing, t as getAllModelPricings } from "./model-pricing--x7wwPba.mjs";
1
+ import { i as resolveModelPricingKey, n as getModelPricing, r as getRequiredModelPricing, t as getAllModelPricings } from "./model-pricing-BbteicIQ.mjs";
2
2
 
3
3
  export { getAllModelPricings, getModelPricing, getRequiredModelPricing, resolveModelPricingKey };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-magpie-plugin",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Discover Magpie providers and models in OpenCode V2 with built-in pricing and automatic local gateway startup",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",