dsh-ollama-quota
DiscoveredDeepSeek Harness plugin: show the Ollama Cloud credit balance and recent usage as a Settings section, with an in-page API key editor.
dsh-ollama-quota
DeepSeek Harness plugin that owns the provider quota dock at the sidebar foot: Ollama
Cloud credit, ChatGPT Codex subscription quota, and the DeepSeek API balance with its
peak/off-peak price phase. One package, one off-peak engine, one sidebar.footer.action cell
that shows every provider on one line and opens into their full cards, plus the Ollama Settings
section that carries the full rule, the usage report, and the API key editor.
The package name and the Ollama card predate the merge; the cards themselves are independent, so one provider can be read without the others (see Configuration).
Ollama moved the account to a credit model: GET https://ollama.com/api/usage no longer
carries the old limits.session / limits.weekly windows (it answers a
range/totals/buckets report instead), so readers built on that shape fail with
"Could not parse the response · no limits object". The remaining credit now comes from
GET https://ollama.com/api/balance, which is what this plugin reads.
Data sources
| Provider | Endpoint | Role |
|---|---|---|
| Ollama Cloud | GET https://ollama.com/api/balance | primary: included.balance_usd, included.allowance_usd, included.period, purchased.balance_usd |
| Ollama Cloud | GET https://ollama.com/api/usage?range=24h|7d|30d | advisory: totals (cost, requests, tokens) and daily buckets |
| DeepSeek | GET https://api.deepseek.com/user/balance | is_available plus one balance_infos entry per currency, split into granted_balance and topped_up_balance |
| Codex | POST /api/codex-subscription/usage | the subscription plugin's own quota channel, called from the page over the Connection |
Ollama endpoints take Authorization: Bearer <Ollama Cloud key>; DeepSeek takes the same with
DEEPSEEK_API_KEY. A failure on the Ollama usage report never hides a healthy balance; it
renders as an inline note inside the usage card. The usage report is re-read on its own slower
interval (usageRefreshMs) because its wide window barely moves.
The Codex card never touches the ChatGPT OAuth grant: it reuses the channel
dsh-codex-subscription publishes for its own UI, so the quota it shows is the same number that
plugin would show, and the grant and its refresh stay owned by that plugin. Its only coupling is
that channel's name and payload shape (verified against dsh-codex-subscription 2.5.9).
What it shows
| Row | Source |
|---|---|
| Remaining included credit | included.balance_usd of included.allowance_usd |
| Used share bar | allowance - balance over allowance |
| Purchased credit | purchased.balance_usd |
| Allowance period | included.period.from → included.period.until |
| Spend, requests, input/cached/output tokens | usage.totals over usageRange |
| Daily spend strip | usage.buckets[].usage_usd (max 31 buckets) |
| Off-peak state and countdown | computed from the browser clock: peak pricing runs weekdays 12:00–18:00 UTC, everything else is off-peak |
| Key source | which credential reference resolved |
| API key editor | remote.credentials.describe(refs) / set(ref, value) / unset(ref) over the DSH Remote (remote.credentials is a declared inject edge) |
Per-model request counts are not shown: the endpoint stopped reporting them.
Sidebar widget
The plugin registers one sidebar.footer.action cell: a single line that stays visible at all
times, not only while Settings is open. Collapsed, it lines up every provider on one row — a
brand-coloured mark, an optional rate-phase dot, and one number each — so the state is readable
without opening anything. There is no phase text: green dot = off-peak, red dot = peak.
| Tile | Shows while collapsed | Title (hover) |
|---|---|---|
| Ollama | remaining included credit, plus the phase dot | remaining, phase, countdown to the next boundary |
| Codex | the highest used share of the subscription windows | the provider name |
| DeepSeek | total balance, plus its own phase dot | the provider name and its phase |
Pressing the row expands it in place into the full per-provider cards: the Ollama card (remaining credit, the 30-day spend, phase countdown, the 24h strip on the browser's local clock), the Codex card (each window's meter, reset credits, reset countdown) and the DeepSeek card (top-up vs granted credit, its own peak/off-peak phase and strip). Pressing it again collapses the row.
The marks are drawn inline (a letter in the provider's colour) so the bundle stays a single classic script with no image assets.
The collapsed 56px rail keeps the credit and a compact H:MM countdown.
Ollama applies off-peak pricing outside 12:00–18:00 UTC on weekdays and all day at weekends, so the peak window is the only interval whose end is a peak start.
The Settings section carries the same state as an additional card with the full rule text, the local peak window, the current local time, and both countdowns.
Install
dsh plugin --profile web add git+https://github.com/okku000/dsh-ollama-quota.git
While developing against a checkout, link the directory instead so edits are live:
dsh plugin --profile web add link:/path/to/dsh-ollama-quota
A Host change needs an application restart; the Client half needs a page refresh.
Configuration
The row reads these fields, all optional (cordis.patch.yml):
| Field | Default | Meaning |
|---|---|---|
keyEnvs | [OLLAMA_CLOUD_API_KEY, OLLAMA_API_KEY] | credential references tried in order; the first is what the editor writes |
apiBase | https://ollama.com | API origin |
usageRange | 30d | usage window, one of 24h, 7d, 30d |
refreshMs | 60000 | balance refresh interval, minimum 5000 |
usageRefreshMs | 300000 | usage-report interval, minimum 60000; ?force=1 or a new key re-reads it |
timeoutMs | 15000 | per-request timeout |
deepseek.keyEnvs | [DEEPSEEK_API_KEY] | DeepSeek credential references tried in order |
deepseek.apiBase | https://api.deepseek.com | DeepSeek API origin |
deepseek.refreshMs | 60000 | how long one DeepSeek balance read is reused (15000–3600000) |
deepseek.timeoutMs | 15000 | DeepSeek per-request timeout |
deepseek.offPeak | published schedule | enabled, discountPercent, holidayTimeZone, peakWindows ({ days: [1-7], from: 'HH:MM', to: 'HH:MM' }, UTC), holidays ({ from: 'YYYY-MM-DD', to: 'YYYY-MM-DD' }) |
The Host half serves GET /ollama-quota/snapshot for the Ollama card and
GET /ollama-quota/deepseek for the DeepSeek card (add ?force=1 to either to refresh first).
The snapshots carry amounts, counts, timestamps, error labels, the credential reference order,
and the schedule — never a key.
A DeepSeek schedule change is Host code, so it reaches the browser after the Host reloads;
without a reload the bundle's built-in copy stays in force. deepseek.offPeak.enabled: false
removes the phase line while the balance stays.
Verify
node scripts/verify.mjs # offline: fake Host context and fake browser runtime
node scripts/verify.mjs --live # also drives the real endpoints with the stored key
--live reads OLLAMA_CLOUD_API_KEY and DEEPSEEK_API_KEY from $DSH_HOME/.credentials.yaml
and drives both real endpoints.
License
MIT — see LICENSE.
Comments
Loading…
Similar plugins
by Asheblog
Ollama Cloud provider for DeepSeek Harness: one-click provider setup with per-model reasoning-effort control and account usage in the Models page and sidebar.
★ 4
MIT
TypeScript
Oct 24, 2026
dsh plugin --profile web add dsh-ollama-cloudby shxiaooo
DeepSeek Harness web plugin: an ambient balance/usage reading under the composer, with a clickable per-provider detail panel. Every figure is upstream-reported.
★ 0
MIT
JavaScript
Oct 14, 2026
dsh plugin --profile web add dsh-account-quotaby AlienGene
DeepSeek Harness plugin for querying LLM service provider usage: reads each configured provider's remaining balance or subscription quota and shows it in an always-visible card in the web GUI
★ 0
MIT
JavaScript
Sep 12, 2026
dsh plugin --profile web add dsh-llm-balanceby orzgithub
A plugin to use ollama in Deepseek Harness.
★ 0
GPL-3.0
JavaScript
Sep 30, 2026
dsh plugin --profile web add dsh-ollamaby Lucas2011wastaken
dsh-tui plugin: DeepSeek official-pricing ledger for ollama-pro with multi-instance shared log and Ollama Cloud quota
★ 0
MIT
JavaScript
Oct 24, 2026
dsh plugin --profile web add dsh-deepseek-costby Andrew111888
A floating credit/quota widget for the DeepSeek Harness Web: shows DeepSeek / OpenCode Go balances and usage, and tracks DSH session token usage and estimated cost by day, month, and model.
★ 6
↓ 248/wk
BSD-3-Clause
JavaScript
Aug 26, 2026
dsh plugin --profile web add dsh-plugin-balance