opencode-magpie-plugin 0.1.8 → 0.1.9

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
@@ -142,11 +142,16 @@ MAGPIE_ADDR=127.0.0.1:3426 opencode --standalone
142
142
 
143
143
  1. 内置价格表,优先应用已识别 provider 的专属覆盖。
144
144
  2. 内置表未覆盖时,使用 Magpie 返回的 `magpie_price`。
145
- 3. 普通模型仍缺价时,查询 models.dev 本地缓存:优先同 provider 的精确 ID,再查已识别厂商(OpenAI、Anthropic、DeepSeek、Google、xAI)的精确 ID 或 `canonical_model_id`。不跨版本猜价、不采用其他转售商报价、不使用订阅 plan 目录的零价。
146
- 4. 所有来源均没有价格时,不启用该模型,避免把未知价格显示为免费。**路由组例外**:Magpie 只在组内全部成员同价时才给组报价,而路由组每一轮的成员由路由决定,成本本来就是一个区间而不是单一数字。这类组保持可选用、保留自己的名字,只是费用读数不精确。路由分组仍只用 Magpie 报价,不根据 `auto-*` 名称推断成员价格。
145
+ 3. 普通模型仍缺价时,查询 models.dev 本地缓存:优先同 provider 的精确 ID,再查已识别厂商(OpenAI、Anthropic、DeepSeek、Google、xAI、Meta)的精确 ID 或 `canonical_model_id`。不跨版本猜价、不采用其他转售商报价、不使用订阅 plan 目录的零价。
146
+ 4. 所有来源均没有价格时,模型仍然列出、仍然可选,只是不填 `cost`。空费用不是 0 元,OpenCode 不会把它当成免费;实际费用以 Magpie 或服务账单为准。**路由组**同样如此:Magpie 只在组内全部成员同价时才给组报价,而路由组每一轮的成员由路由决定,成本本来就是一个区间而不是单一数字。路由分组仍只用 Magpie 报价,不根据 `auto-*` 名称推断成员价格。
147
147
 
148
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
149
 
150
+ ### 0.1.9
151
+
152
+ - 缺价模型不再从选择器里拿掉:仍然列出、仍然可选,只是不填 `cost`。空费用不是 0 元,也不代表实际免费。
153
+ - `muse-*` 在 Magpie 未报价时,回退到 models.dev 的 Meta 官方价,不采用转售商报价。Muse Wonder 1.0 为输入/输出/缓存读 `$4/$20/$0.20`,Muse Spark 1.3 为 `$1.25/$4.25/$0.15`。单位为美元/百万 token。这是 Meta 标价,不是 Cursor 账单价。
154
+
150
155
  ### 0.1.8
151
156
 
152
157
  - 修复上下文阶梯价丢失:保留内置表、models.dev 的 `tier.type=context` 与 Magpie 的 `above` 分档,交给 OpenCode 根据单次输入(含缓存)选择整单费率。
package/dist/index.mjs CHANGED
@@ -243,7 +243,7 @@ const lookupCatalogPrice = (catalog, maker, modelID) => {
243
243
  const id = modelID.replace(/@\d+(?:k|m)$/i, "").toLowerCase();
244
244
  const own = priceInProvider(catalog, maker, id);
245
245
  if (own) return own;
246
- const vendor = /^(?:gpt-|o[134](?:-|$))/.test(id) ? "openai" : id.startsWith("claude-") ? "anthropic" : id.startsWith("deepseek-") ? "deepseek" : id.startsWith("gemini-") ? "google" : id.startsWith("grok-") ? "xai" : void 0;
246
+ const vendor = /^(?:gpt-|o[134](?:-|$))/.test(id) ? "openai" : id.startsWith("claude-") ? "anthropic" : id.startsWith("deepseek-") ? "deepseek" : id.startsWith("gemini-") ? "google" : id.startsWith("grok-") ? "xai" : id.startsWith("muse-") ? "meta" : void 0;
247
247
  return vendor && vendor !== maker ? priceInProvider(catalog, vendor, id) : void 0;
248
248
  };
249
249
  const priceInProvider = (catalog, maker, id) => {
@@ -340,8 +340,6 @@ const buildInventory = (rows, baseURL, options = {}) => {
340
340
  modalities: row.modalities,
341
341
  tool_call: true
342
342
  });
343
- if (!cost && !group) model.name += " (价格未知)";
344
- model.enabled = !!cost || group;
345
343
  const anthropic = row.native_endpoints?.includes("/v1/messages");
346
344
  const responses = !anthropic && row.native_endpoints?.includes("/v1/responses");
347
345
  model.package = anthropic ? "@opencode/ai/providers/anthropic-compatible" : responses ? "@opencode/ai/providers/openai-compatible/responses" : "@opencode/ai/providers/openai-compatible";
@@ -385,7 +383,7 @@ const buildInventory = (rows, baseURL, options = {}) => {
385
383
  ...model,
386
384
  id: `${model.id}-fast`,
387
385
  cost: fastPrice ? normalizeModelCosts(fastPrice) : model.cost,
388
- name: `${model.name.replace(/ \(价格未知\)$/, "")} Fast${model.enabled ? "" : " (价格未知)"}`,
386
+ name: `${model.name} Fast`,
389
387
  body: {
390
388
  ...model.body,
391
389
  service_tier: "priority"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-magpie-plugin",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
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",