pi-openrouter-realtime 0.3.0 → 0.3.2

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
@@ -1,6 +1,6 @@
1
1
  ![Preview](https://raw.githubusercontent.com/olixis/pi-openrouter-plus/main/assets/preview.png)
2
2
 
3
- # pi-openrouter-realtime v0.3.0
3
+ # pi-openrouter-realtime v0.3.2
4
4
 
5
5
  Pi extension for OpenRouter that loads the latest models from OpenRouter in real time, with provider/quantization enrichment, endpoint health indicators, credit balance display, interactive model picker, and tab-completion.
6
6
 
@@ -10,6 +10,24 @@ Npm package:
10
10
 
11
11
  - `pi-openrouter-realtime`
12
12
 
13
+ ## What's New in v0.3.2
14
+
15
+ - **Context-safe info messages** — OpenRouter info panels still display in the UI, but are filtered out before LLM requests
16
+ - **Lower token waste** — `/openrouter-preview`, `/openrouter-balance`, and `/openrouter-status` no longer consume context window space unnecessarily
17
+ - **Less prompt contamination** — read-only extension output no longer gets echoed back into future model turns unless you explicitly include it
18
+
19
+ How it works:
20
+
21
+ - The extension still emits `openrouter-info` messages so you can see rich output in-session
22
+ - Before each LLM call, a `context` hook removes those `openrouter-info` custom messages from the message list
23
+ - Result: visible UX for humans, but no extra prompt baggage for the model
24
+
25
+ ## What's New in v0.3.1
26
+
27
+ - **Fixed variant counting** — enriched variants are no longer presented as both base models and `+N variants`
28
+ - **Clearer totals** — status/output now distinguishes total registered models from variant count
29
+ - **Less intrusive account output** — removed the key label / redacted API-key style line from account/status output
30
+
13
31
  ## What's New in v0.3.0
14
32
 
15
33
  - **Targeted enrichment** — enrich one model on demand without scanning the whole catalog
@@ -171,7 +189,7 @@ DeepSeek: DeepSeek R1 (deepseek/deepseek-r1)
171
189
  - If you want to refresh manually or go back to the default list, run `/openrouter-sync`
172
190
  - Preview output also includes search-related model info (id, name, terms, description) plus pricing and endpoint health
173
191
 
174
- ## Architecture (v0.3.0 improvements)
192
+ ## Architecture (v0.3.x improvements)
175
193
 
176
194
  - **Snapshot-based routing** — the stream factory captures a frozen route map at registration time, eliminating race conditions when syncing
177
195
  - **Generation counter** — overlapping sync calls are safely discarded if a newer sync has started
@@ -21,10 +21,11 @@ import {
21
21
 
22
22
  const REFERER_HEADER = "https://github.com/olixis/pi-openrouter-plus";
23
23
  const APP_TITLE = "pi-openrouter-realtime";
24
+ const OPENROUTER_INFO_MESSAGE_TYPE = "openrouter-info";
24
25
 
25
26
  function emitMessage(pi: ExtensionAPI, text: string) {
26
27
  pi.sendMessage({
27
- customType: "openrouter-info",
28
+ customType: OPENROUTER_INFO_MESSAGE_TYPE,
28
29
  content: text,
29
30
  display: true,
30
31
  });
@@ -100,6 +101,17 @@ function buildVariantPricingInfo(target: { pricing?: { prompt?: string; completi
100
101
  }
101
102
 
102
103
  export default function openrouterModelsExtension(pi: ExtensionAPI) {
104
+ // ---------- Keep extension info messages out of LLM context ----------
105
+
106
+ pi.on("context", async (event) => {
107
+ return {
108
+ messages: event.messages.filter(
109
+ (message: any) =>
110
+ !(message.role === "custom" && message.customType === OPENROUTER_INFO_MESSAGE_TYPE),
111
+ ),
112
+ };
113
+ });
114
+
103
115
  // ---------- Provider registration ----------
104
116
 
105
117
  function registerWithSnapshot(
@@ -158,8 +170,9 @@ export default function openrouterModelsExtension(pi: ExtensionAPI) {
158
170
  const failuresText =
159
171
  result.endpointFailures > 0 ? `, ${result.endpointFailures} endpoint failures` : "";
160
172
  const enrichedList = Array.from(result.enrichedModelIds).join(", ");
173
+ const totalRegistered = result.models.length;
161
174
  ctx.ui.notify(
162
- `OpenRouter: ${result.modelCount} models + ${result.variantCount} variants [${enrichedList}]${failuresText}`,
175
+ `OpenRouter: ${totalRegistered} models registered (${result.variantCount} variants) [${enrichedList}]${failuresText}`,
163
176
  "info",
164
177
  );
165
178
  } catch (err: any) {
@@ -341,7 +354,6 @@ export default function openrouterModelsExtension(pi: ExtensionAPI) {
341
354
 
342
355
  lines.push("");
343
356
 
344
- if (info.label) lines.push(`Key: ${info.label}`);
345
357
  if (info.is_free_tier) lines.push("Tier: Free");
346
358
 
347
359
  if (info.limit !== null && info.limit !== undefined) {
@@ -377,8 +389,13 @@ export default function openrouterModelsExtension(pi: ExtensionAPI) {
377
389
  const snapshot = getSnapshot();
378
390
  const lines: string[] = ["**OpenRouter Extension Status**", ""];
379
391
 
380
- lines.push(`Models registered: ${snapshot.models.length}`);
381
- lines.push(`Active routes: ${snapshot.routes.size}`);
392
+ const totalModels = snapshot.models.length;
393
+ const variantCount = snapshot.routes.size;
394
+ const baseModelCount = Math.max(0, totalModels - variantCount);
395
+
396
+ lines.push(`Models registered: ${totalModels}`);
397
+ lines.push(`Base models: ${baseModelCount}`);
398
+ lines.push(`Variants registered: ${variantCount}`);
382
399
 
383
400
  if (snapshot.enrichedModelIds.size > 0) {
384
401
  lines.push(`Enriched models: ${Array.from(snapshot.enrichedModelIds).join(", ")}`);
@@ -402,10 +419,8 @@ export default function openrouterModelsExtension(pi: ExtensionAPI) {
402
419
  function updateStatusBar(ctx: any) {
403
420
  const snapshot = getSnapshot();
404
421
  if (snapshot.models.length > 0) {
405
- const enrichLabel =
406
- snapshot.enrichedModelIds.size > 0
407
- ? ` +${snapshot.routes.size} variants`
408
- : "";
422
+ const variantCount = snapshot.routes.size;
423
+ const enrichLabel = variantCount > 0 ? ` (${variantCount} variants)` : "";
409
424
  try {
410
425
  ctx.ui.setStatus("openrouter", `OR: ${snapshot.models.length} models${enrichLabel}`);
411
426
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-openrouter-realtime",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "OpenRouter extension for pi — real-time model sync, provider/quantization enrichment, endpoint health, credit balance, and interactive model picker",
5
5
  "license": "MIT",
6
6
  "type": "module",