Skip to content

Releases: CJ-SH/dsh-plugin-ollama-usage

dsh-plugin-ollama-usage v0.2.1

Choose a tag to compare

@CJ-SH CJ-SH released this 21 Oct 01:36

Fixed — the usage panel silently disappeared after Ollama changed its usage contract. Upstream replaced the quota fields under GET /api/usage (limits.session / limits.weekly) with per-day buckets (range, scope, totals, buckets). The decoder no longer matched, and by design it degraded to "nothing to show" — no placeholder, no error.

What changed

  • Quota now comes from GET {baseURL}/api/balance. Its included is a union: legacy plans report remaining_percent and resets_at, credit plans report balance_usd / allowance_usd / period. Both branches are decoded — legacy as the two quota windows, credit as a monthly window.
  • The panel reports the used percentage (100 - remaining_percent), and reset times are now absolute instants — the reset fields the old endpoint never carried are finally here.
  • A 200 whose shape cannot be read is no longer silent: the Settings page names it, and the host logs one line per distinct shape (top-level key names only, never a value). The failure mode that hid this for a month now announces itself.
  • The per-model request breakdown was removed: the official API has no successor field for it (the 15 documented paths expose only /api/usage and /api/balance for account data, and their parameter whitelist is range / scope).

Compatibility · dsh ^0.2.0-rc.1, Node ^22.19.0 || >=24.0.0. Configuration is unchanged — no migration needed.

Install / upgrade

dsh plugin --profile web add github:CJ-SH/dsh-plugin-ollama-usage

Then restart dsh (plugins load at startup).

Links · Repository · 中文说明 · Technical notes


修复 —— Ollama 改版用量契约后,面板静默消失了。上游把 GET /api/usage 下的配额字段(limits.session / limits.weekly)换成了逐日桶(range、scope、totals、buckets)。解码器不再匹配,按既有设计退化为「什么都不显示」—— 不留占位符、也不报错。

本次变化

  • 配额改从 GET {baseURL}/api/balance 取。其 included 是 union:旧套餐给 remaining_percent 与 resets_at,额度制给 balance_usd / allowance_usd / period。两支都会解 —— 旧套餐映射为两个配额窗口,额度制映射为每月窗口。
  • 面板显示已用百分比(100 - remaining_percent),重置时间改为绝对时刻 —— 旧端点从未提供过的重置字段,现在有了。
  • 返回 200 却解不出不再静默:设置页会点明,Host 端按形状去重记一行日志(只记顶层键名,不记值)。藏了一个月的那类失效,从此会自己开口。
  • 移除按模型请求数明细:官方 API 没有继任字段(文档的 15 条路径中账号数据面只有 /api/usage 与 /api/balance,参数白名单只有 range / scope)。

兼容 · dsh ^0.2.0-rc.1、Node ^22.19.0 || >=24.0.0。配置未变,无需迁移。

安装 / 升级

dsh plugin --profile web add github:CJ-SH/dsh-plugin-ollama-usage

装完请重启 dsh(插件在启动时加载)。

链接 · 仓库 · English README · 技术笔记

dsh-plugin-ollama-usage v0.2.0

Choose a tag to compare

@CJ-SH CJ-SH released this 30 Sep 01:49

First public release of dsh-plugin-ollama-usage — Ollama Cloud account usage (5-hour rolling window and weekly) on the dsh web chat page, with a small configuration surface for baseURL and credential mode.

Highlights

  • A usage panel in two places: under the composer of an active session, and on the hero (new-session) view.
  • session (5-hour rolling) and weekly percentages, refreshed every 5 minutes.
  • Read-only: it never touches provider configuration and never starts a turn.
  • Two credential modes — reuse an existing Ollama key, or keep a plugin-specific one.
  • It reads a single endpoint (GET {baseURL}/api/usage) through its own /ollama-usage route, so no other bundle's row is patched.
  • No placeholder and no error banner: when the credential is missing or the endpoint misbehaves, the panel simply disappears.

Compatibility · dsh ^0.2.0-rc.1, Node ^22.19.0 || >=24.0.0

Install

dsh plugin --profile web add github:CJ-SH/dsh-plugin-ollama-usage

  • This release also brings a bilingual README (README.md / README.zh.md) and a docs/design-notes.md technical note carrying the contracts that used to sit in the README.
  • 本次发版同时带来中英双语 README(README.md / README.zh.md)与 docs/design-notes.md 技术笔记,原先堆在 README 里的契约搬进了那里。

Links · Repository · 中文说明


dsh-plugin-ollama-usage 首个公开版本 —— 在 dsh 的 Web 对话页显示 Ollama Cloud 账户用量(5 小时滚动窗口与每周),并提供 baseURL 与凭据模式的少量配置。

主要能力

  • 两处显示用量面板:活动会话的输入框下方,以及新会话(hero)页。
  • 同时给出 session(5 小时滚动)与 weekly 占比,默认每 5 分钟刷新一次。
  • 只读:不改动任何 provider 配置,也不发起对话。
  • 两种凭据模式:复用现有 Ollama 密钥,或使用插件专属密钥。
  • 只读一个端点(GET {baseURL}/api/usage),走自有的 /ollama-usage 路由,不覆盖任何别的 bundle 的行。
  • 不留占位符、不报错:凭据缺失或端点异常时面板静默消失。

兼容 · dsh ^0.2.0-rc.1、Node ^22.19.0 || >=24.0.0

安装

dsh plugin --profile web add github:CJ-SH/dsh-plugin-ollama-usage