pi-bob 0.2.3 → 0.2.5

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
@@ -63,6 +63,16 @@ Model discovery is enabled by default:
63
63
 
64
64
  Discovered context limits, output limits, vision support, reasoning support, backend identifiers, and token prices are mapped into Pi model definitions. Bob reports prices per token; Pi displays prices per million tokens, so the extension performs that conversion.
65
65
 
66
+ ### How context/output limits are determined
67
+
68
+ Every advertised number comes from Bob's own `/model/info` catalog — the extension never hardcodes per-model values:
69
+
70
+ - **Context window** ← `model_info.max_input_tokens`.
71
+ - **Max output tokens** ← `model_info.max_output_tokens` when present (2.x), else `model_info.max_tokens` (the 1.x output cap).
72
+ - Models that report no limits (e.g. `granite-8b-code-instruct`, `rnj-1-*`) use the defaults: 200,000 context / 8,192 output, overridable via `IBM_BOB_CONTEXT_WINDOW` / `IBM_BOB_MAX_TOKENS`.
73
+
74
+ The 2.x precedence was determined empirically, not from documentation. The 2.x catalog reports *two* output fields for the same route (e.g. `premium`: `max_tokens: 12000`, `max_output_tokens: 64000`), so on 2026-08-31 the extension author probed the live endpoint: a `chat/completions` request for `premium` with `max_tokens=50000` — four times the catalog's `max_tokens` — returned HTTP `200` and completed normally. That proves `max_tokens` is no longer the enforced cap and `max_output_tokens` is the real limit, so the larger, newer field is advertised when present. 1.x payloads have no `max_output_tokens`, where `max_tokens` was verified to be the output cap, keeping that behavior unchanged.
75
+
66
76
  ## Quick start for the discovered Bob endpoint
67
77
 
68
78
  Use Bob SSO through Pi:
package/extensions/bob.ts CHANGED
@@ -164,8 +164,13 @@ function configuredApiKey(): { envName: "IBM_BOB_API_KEY" | "IBM_BOB_KEY"; value
164
164
  return alias ? { envName: "IBM_BOB_KEY", value: alias } : undefined;
165
165
  }
166
166
 
167
- function providerApiKeyReference(): string {
168
- return `$${configuredApiKey()?.envName ?? "IBM_BOB_API_KEY"}`;
167
+ function providerApiKeyReference(): string | undefined {
168
+ const apiKey = configuredApiKey();
169
+ // Only advertise when resolvable at launch: an unresolvable $VAR reference makes
170
+ // pi's /model catalog refresh throw for a logged-out provider ("Could not refresh
171
+ // ibm-bob; showing cached models"). Process env is fixed after launch, so this
172
+ // loses nothing.
173
+ return apiKey ? `$${apiKey.envName}` : undefined;
169
174
  }
170
175
 
171
176
  function apiKeyAuthScheme(): string {
@@ -921,6 +926,7 @@ export default async function (pi: ExtensionAPI) {
921
926
  const headers = buildHeaders(settings);
922
927
  let catalog: BobDiscoveredModel[] | undefined;
923
928
  const apiKey = configuredApiKey();
929
+ const apiKeyRef = providerApiKeyReference();
924
930
  if (apiKey && envBool("IBM_BOB_DISCOVER_MODELS", true)) {
925
931
  try {
926
932
  catalog = await fetchBobModelCatalog(apiKey.value, apiKeyAuthScheme(), settings);
@@ -934,7 +940,7 @@ export default async function (pi: ExtensionAPI) {
934
940
  pi.registerProvider(PROVIDER_ID, {
935
941
  name: "IBM Bob",
936
942
  baseUrl: providerRequestBaseUrl(api),
937
- apiKey: providerApiKeyReference(),
943
+ ...(apiKeyRef ? { apiKey: apiKeyRef } : {}),
938
944
  api: BOB_API,
939
945
  ...(headers ? { headers } : {}),
940
946
  models: buildModels(api, catalog),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-bob",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "description": "Pi provider extension for IBM Bob / IBM-approved compatible model endpoints.",
6
6
  "keywords": [