pi-bifrost-gateway 0.3.0 → 0.3.1

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
@@ -4,6 +4,17 @@ All notable changes to this project are documented here. The format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions respect
5
5
  [SemVer](https://semver.org/).
6
6
 
7
+ ## [0.3.1] — 2026-10-20
8
+
9
+ ### Fixed
10
+
11
+ - Chain and member models now publish real max-output limits via a curated
12
+ per-name map (16 workhorse chains). Bifrost's `/v1/models` wire never
13
+ carries `max_output_limit` (verified 0/86 rows), so every model fell back
14
+ to the generic 8192 and long generations hard-stopped there — a plausible
15
+ contributor to truncated responses on pi traffic. Values sourced from
16
+ inferhub.dev/pricing (2026-10-20); unmapped names keep the 8192 fallback.
17
+
7
18
  ## [0.3.0] — 2026-10-18
8
19
 
9
20
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-bifrost-gateway",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Pi extension for a Bifrost LLM gateway: chain models from VK routing rules and/or the full upstream model catalogue, with optional per-family native protocol surfaces",
5
5
  "license": "MIT",
6
6
  "keywords": [
package/src/catalog.ts CHANGED
@@ -127,6 +127,34 @@ export function surfaceFor(
127
127
  const CONTEXT_WINDOW_FALLBACK = 128_000;
128
128
  const MAX_TOKENS_FALLBACK = 8_192;
129
129
 
130
+ /**
131
+ * Max output tokens per bare model name. Bifrost's [OI]-compat /v1/models
132
+ * wire serializes only id/created/owned_by/context_window (+ enrichment
133
+ * pricing/architecture) — max_output_limit never reaches it (0/86 rows,
134
+ * verified 2026-10-20), so without this map every model falls back to 8192
135
+ * and long generations hard-stop there. Values from inferhub.dev/pricing
136
+ * "N max output" rows (2026-10-20); kimi-k2.7-code is unlisted there and
137
+ * takes kimi-k2.5/k2.6's 32K conservatively.
138
+ */
139
+ const MAX_OUTPUT: Readonly<Record<string, number>> = {
140
+ "glm-5.3-flash": 128_000,
141
+ "glm-5.3": 128_000,
142
+ "kimi-k3": 128_000,
143
+ "kimi-k2.7-code": 32_000,
144
+ "deepseek-v4-pro": 384_000,
145
+ "deepseek-v4.1-flash": 384_000,
146
+ "minimax-m3": 512_000,
147
+ "minimax-m3.1-flash-preview": 512_000,
148
+ "qwen3.8-flash": 128_000,
149
+ "qwen3.8-max": 128_000,
150
+ "gpt-6-luna": 128_000,
151
+ "gpt-6-astra": 128_000,
152
+ "gpt-6.1-sol": 128_000,
153
+ "claude-sonnet-5-5": 128_000,
154
+ "claude-fable-5-1": 128_000,
155
+ "claude-opus-5-5": 128_000,
156
+ };
157
+
130
158
  /* ---------- wire schemas (typebox-validated) ---------- */
131
159
 
132
160
  const PricingSchema = Type.Object({
@@ -424,7 +452,7 @@ export function buildChainModels(
424
452
  native,
425
453
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
426
454
  contextWindow,
427
- maxTokens: MAX_TOKENS_FALLBACK,
455
+ maxTokens: MAX_OUTPUT[chain.name] ?? MAX_TOKENS_FALLBACK,
428
456
  });
429
457
  });
430
458
  }
@@ -541,7 +569,7 @@ export function buildMemberModels(
541
569
  cacheWrite: cacheWriteRate ?? 0,
542
570
  },
543
571
  contextWindow: entry.context_length ?? CONTEXT_WINDOW_FALLBACK,
544
- maxTokens: entry.max_output_limit ?? MAX_TOKENS_FALLBACK,
572
+ maxTokens: entry.max_output_limit ?? MAX_OUTPUT[bareModelName(memberId)] ?? MAX_TOKENS_FALLBACK,
545
573
  thinkingLevels: thinkingOverrides?.[memberId],
546
574
  }),
547
575
  );