@goodandready/dsh-ollama-cloud-provider 0.1.13 → 0.1.14

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/CHANGELOG.md CHANGED
@@ -1,10 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.14 — 2026-10-29
4
+
5
+ - Model-scoped rejections (unsupported model or per-model quota) mark only that
6
+ account+model for five minutes; the key remains usable for other and free
7
+ models. Account-wide quota, credential and rate-limit rejections still cool
8
+ the key.
9
+
3
10
  ## 0.1.13 — 2026-10-29
4
11
 
5
12
  - Account cards now show per-account balance/remaining credits, purchased
6
13
  amount, reset date and the time of the last usage read (or the 5-hour/weekly
7
14
  bars for legacy accounts).
15
+ - Model-scoped rejections (unsupported model or per-model quota) now mark only
16
+ that account+model for five minutes; the key stays usable for other and free
17
+ models. Account-wide quota still cools the key.
8
18
  - Added `npm run test:engine`: an isolated boot matrix that installs every
9
19
  declared `dshReleases` core, composes the plugin, checks `--dump-config` and
10
20
  waits for `/dsh-ollama/health` in a real web host. Supports
package/README.md CHANGED
@@ -80,6 +80,7 @@ graph LR
80
80
  - **Accurate limits** for the dsh picker: context window, input modalities, reasoning levels and their default, tool support, and API visibility.
81
81
  - **Balance and usage** from the official `/api/balance` and `/api/usage` endpoints: included credits, purchased credits, 24-hour / 7-day / 30-day spend, and spend by model.
82
82
  - **Multi-account rotation** before any content is streamed: 401/403/429 and quota rejections mark a key and retry with the next one. Cooldowns persist across restarts.
83
+ - **Model-scoped marks**: an unsupported model or a per-model quota rejection marks only that key+model for five minutes; other and free models keep using the account.
83
84
  - **Sticky accounts** per conversation, plus model → account glob rules.
84
85
  - **Price estimates** from the published Ollama pricing table, including off-peak rates, with per-model overrides.
85
86
  - **Browser UI**:
@@ -103,17 +104,17 @@ npm pack
103
104
  Install the published package:
104
105
 
105
106
  ```bash
106
- dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.13
107
+ dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.14
107
108
  # DSH Desktop:
108
- dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.13
109
+ dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.14
109
110
  ```
110
111
 
111
112
  Or install the packed tarball into a profile:
112
113
 
113
114
  ```bash
114
- dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.13.tgz
115
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.14.tgz
115
116
  # DSH Desktop:
116
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.13.tgz
117
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.14.tgz
117
118
  ```
118
119
 
119
120
  Restart dsh (or DSH Desktop), then pick **Ollama Cloud** in the model picker.
package/README.ru.md CHANGED
@@ -103,17 +103,17 @@ npm pack
103
103
  Установка опубликованного пакета из npm:
104
104
 
105
105
  ```bash
106
- dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.13
106
+ dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.14
107
107
  # DSH Desktop:
108
- dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.13
108
+ dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.14
109
109
  ```
110
110
 
111
111
  Либо установка из упакованного tarball:
112
112
 
113
113
  ```bash
114
- dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.13.tgz
114
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.14.tgz
115
115
  # DSH Desktop:
116
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.13.tgz
116
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.14.tgz
117
117
  ```
118
118
 
119
119
  После установки перезапустите dsh (или DSH Desktop) и выберите **Ollama Cloud** в списке моделей.
package/README.zh.md CHANGED
@@ -102,17 +102,17 @@ npm pack
102
102
  从 npm 安装已发布版本:
103
103
 
104
104
  ```bash
105
- dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.13
105
+ dsh plugin --profile web add @goodandready/dsh-ollama-cloud-provider@0.1.14
106
106
  # DSH 桌面端:
107
- dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.13
107
+ dsh plugin --profile desktop add @goodandready/dsh-ollama-cloud-provider@0.1.14
108
108
  ```
109
109
 
110
110
  或通过打包文件安装:
111
111
 
112
112
  ```bash
113
- dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.13.tgz
113
+ dsh plugin --profile web add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.14.tgz
114
114
  # DSH 桌面端:
115
- dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.13.tgz
115
+ dsh plugin --profile desktop add /absolute/path/to/goodandready-dsh-ollama-cloud-provider-0.1.14.tgz
116
116
  ```
117
117
 
118
118
  安装完成后重启 dsh 或 DSH 桌面端,在模型列表中选择 **Ollama Cloud** 即可。
package/lib/index.d.ts CHANGED
@@ -191,6 +191,8 @@ declare class OllamaCloudAdapter extends LlmAdapter {
191
191
  private stickyWrites;
192
192
  /** key fingerprint → cooldown deadline and the rejection that caused it. */
193
193
  private readonly cooldowns;
194
+ /** key fingerprint + model → short preference mark for model-scoped rejections. */
195
+ private readonly modelCooldowns;
194
196
  private readonly sticky;
195
197
  private readonly routing;
196
198
  private warnedTools;
@@ -215,6 +217,15 @@ declare class OllamaCloudAdapter extends LlmAdapter {
215
217
  private send;
216
218
  private keyId;
217
219
  private coolingDown;
220
+ private modelKey;
221
+ private modelCoolingDown;
222
+ private markModelCooldown;
223
+ /**
224
+ * A model-scoped rejection says nothing about the key's other models:
225
+ * `:free` models and other paid models may still work on the same account.
226
+ * Only account-wide quota, credential and rate-limit responses cool the key.
227
+ */
228
+ private modelScoped;
218
229
  /** Current cooldown for one resolved key, if any. */
219
230
  accountHealth(key: string): {
220
231
  coolingUntil: number;
package/lib/index.js CHANGED
@@ -49,7 +49,7 @@ const DEFAULT_API_BASE = "https://ollama.com";
49
49
  const DEFAULT_OPENAI_BASE = "https://ollama.com/v1";
50
50
  const DEFAULT_USAGE_URL = "https://ollama.com/api/usage";
51
51
  const DEFAULT_BALANCE_URL = "https://ollama.com/api/balance";
52
- const DEFAULT_USER_AGENT = "dsh-ollama-cloud-provider/0.1.13";
52
+ const DEFAULT_USER_AGENT = "dsh-ollama-cloud-provider/0.1.14";
53
53
  const DEFAULT_CONTEXT_WINDOW = 131072;
54
54
  const DEFAULT_MAX_TOKENS = 32768;
55
55
  const DEFAULT_GENERATE_MAX_TOKENS = 131072;
@@ -2256,6 +2256,8 @@ var OllamaCloudAdapter = class extends LlmAdapter {
2256
2256
  stickyWrites = Promise.resolve();
2257
2257
  /** key fingerprint → cooldown deadline and the rejection that caused it. */
2258
2258
  cooldowns = /* @__PURE__ */ new Map();
2259
+ /** key fingerprint + model → short preference mark for model-scoped rejections. */
2260
+ modelCooldowns = /* @__PURE__ */ new Map();
2259
2261
  sticky = /* @__PURE__ */ new Map();
2260
2262
  routing = [];
2261
2263
  warnedTools = false;
@@ -2356,6 +2358,9 @@ var OllamaCloudAdapter = class extends LlmAdapter {
2356
2358
  }
2357
2359
  }
2358
2360
  }
2361
+ const availableKeys = keys.filter((entry) => !this.coolingDown(entry.key));
2362
+ const preferredKeys = availableKeys.filter((entry) => !this.modelCoolingDown(entry.key, options.model));
2363
+ keys = preferredKeys.length > 0 ? preferredKeys : availableKeys;
2359
2364
  const url = endpointFor(model.transport, config);
2360
2365
  let images;
2361
2366
  if (hasImages(options)) {
@@ -2408,6 +2413,12 @@ var OllamaCloudAdapter = class extends LlmAdapter {
2408
2413
  lastError = error;
2409
2414
  logAttempt(false, error.code);
2410
2415
  const canRotate = index < keys.length - 1;
2416
+ if (this.modelScoped(error)) {
2417
+ this.markModelCooldown(entry.key, options.model, error.code === "UNSUPPORTED_MODEL" ? "model-unsupported" : "model-quota");
2418
+ responseFailure = true;
2419
+ if (canRotate) continue;
2420
+ throw error;
2421
+ }
2411
2422
  const retryable = error.code === "INVALID_CREDENTIAL" || error.code === "RATE_LIMIT" || error.code === "QUOTA" || error.code === "SERVER";
2412
2423
  const credentialOrQuota = error.code === "INVALID_CREDENTIAL" || error.code === "RATE_LIMIT" || error.code === "QUOTA";
2413
2424
  if (retryable) {
@@ -2441,8 +2452,13 @@ var OllamaCloudAdapter = class extends LlmAdapter {
2441
2452
  if (started || options.signal?.aborted === true) throw error;
2442
2453
  lastError = classified;
2443
2454
  const transient = this.isTransient(classified);
2444
- const canRotate = index < keys.length - 1 && transient;
2455
+ const canRotate = index < keys.length - 1 && (transient || this.modelScoped(classified));
2445
2456
  const credentialOrQuota = classified.code === "INVALID_CREDENTIAL" || classified.code === "RATE_LIMIT" || classified.code === "QUOTA";
2457
+ if (this.modelScoped(classified)) {
2458
+ this.markModelCooldown(entry.key, options.model, classified.code === "UNSUPPORTED_MODEL" ? "model-unsupported" : "model-quota");
2459
+ if (!canRotate) throw classified;
2460
+ continue;
2461
+ }
2446
2462
  if (!responseFailure && (canRotate || credentialOrQuota)) this.markCooldown(entry.key, 0);
2447
2463
  if (!canRotate) throw classified;
2448
2464
  }
@@ -2583,6 +2599,42 @@ var OllamaCloudAdapter = class extends LlmAdapter {
2583
2599
  }
2584
2600
  return true;
2585
2601
  }
2602
+ modelKey(key, model) {
2603
+ return `${this.keyId(key)}:${model}`;
2604
+ }
2605
+ modelCoolingDown(key, model) {
2606
+ const id = this.modelKey(key, model);
2607
+ const entry = this.modelCooldowns.get(id);
2608
+ if (entry === void 0) return false;
2609
+ if (entry.until <= Date.now()) {
2610
+ this.modelCooldowns.delete(id);
2611
+ return false;
2612
+ }
2613
+ return true;
2614
+ }
2615
+ markModelCooldown(key, model, reason) {
2616
+ const now = Date.now();
2617
+ for (const [id, entry] of this.modelCooldowns) if (entry.until <= now) this.modelCooldowns.delete(id);
2618
+ this.modelCooldowns.set(this.modelKey(key, model), {
2619
+ until: now + 3e5,
2620
+ reason
2621
+ });
2622
+ const overflow = this.modelCooldowns.size - 200;
2623
+ if (overflow <= 0) return;
2624
+ const oldest = [...this.modelCooldowns.entries()].sort((a, b) => a[1].until - b[1].until).slice(0, overflow);
2625
+ for (const [id] of oldest) this.modelCooldowns.delete(id);
2626
+ }
2627
+ /**
2628
+ * A model-scoped rejection says nothing about the key's other models:
2629
+ * `:free` models and other paid models may still work on the same account.
2630
+ * Only account-wide quota, credential and rate-limit responses cool the key.
2631
+ */
2632
+ modelScoped(error) {
2633
+ if (error.code === "UNSUPPORTED_MODEL") return true;
2634
+ if (error.code !== "QUOTA") return false;
2635
+ const detail = error.message.toLowerCase();
2636
+ return detail.includes("model") && (detail.includes("credit") || detail.includes("quota") || detail.includes("allowance") || detail.includes("limit"));
2637
+ }
2586
2638
  /** Current cooldown for one resolved key, if any. */
2587
2639
  accountHealth(key) {
2588
2640
  const id = this.keyId(key);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-ollama-cloud-provider",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Ollama Cloud LLM provider plugin for DeepSeek Harness (dsh).",
5
5
  "license": "MIT",
6
6
  "type": "module",