@gtrabanco/pi-nan-provider 1.5.5 → 1.5.7

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.
@@ -201,12 +201,12 @@ export interface SanitizerOptions {
201
201
  /**
202
202
  * Keep `max_completion_tokens` in the payload instead of renaming it to
203
203
  * `max_tokens`. Set only when the model's effective `compat.maxTokensField`
204
- * is `"max_completion_tokens"` (issue #34: NaN confirmed the gateway honors
205
- * `max_completion_tokens` on `qwen3.8-flash` as the interim bound for the
206
- * reasoning phase, which `max_tokens` does not bound). When false/absent the
207
- * documented rename runs — NaN's published OpenAPI schema only documents
208
- * `max_tokens`, so hand-built payloads and non-overridden models stay on
209
- * the strict shape.
204
+ * is `"max_completion_tokens"` — the per-model mechanism introduced for
205
+ * issue #34. `qwen3.8-flash` used it until the gateway fix landed (#36);
206
+ * `qwen3.8-max` still declares it because its `max_tokens` bounds only the
207
+ * visible answer. When false/absent the documented rename runs — NaN's
208
+ * published OpenAPI schema only documents `max_tokens`, so hand-built
209
+ * payloads and non-overridden models stay on the strict shape.
210
210
  */
211
211
  preserveMaxCompletionTokens?: boolean;
212
212
  }
@@ -255,9 +255,10 @@ export function sanitizeOpenAICompatPayload(payload: unknown, options: Sanitizer
255
255
  // must stay schema-strict.
256
256
  if (options.preserveStreamOptions !== true) delete out.stream_options;
257
257
  // NaN documents `max_tokens`, not `max_completion_tokens` — unless the
258
- // model's compat declares `max_completion_tokens` (issue #34): the gateway
259
- // honors it there as the interim reasoning bound, so the rename would undo
260
- // the catalog's maxTokensField override before the payload leaves pi.
258
+ // model's compat declares `max_completion_tokens` (the #34 mechanism,
259
+ // still used by `qwen3.8-max`): the gateway honors it there to bound the
260
+ // total, so the rename would undo the catalog's maxTokensField override
261
+ // before the payload leaves pi.
261
262
  if (
262
263
  "max_completion_tokens" in out &&
263
264
  !("max_tokens" in out) &&
@@ -121,10 +121,12 @@ function modelSupportsUsageInStreaming(model: unknown): boolean {
121
121
 
122
122
  /**
123
123
  * Whether the model's effective compat sends the `max_completion_tokens`
124
- * request field instead of the classic `max_tokens` (issue #34). The model
125
- * object here is pi-ai's post-registry view — baseline catalog, live-merge
126
- * refresh, `models.json` override and the #19 stale-store overlay all flow
127
- * through `compat`, so this reads the value the user actually runs with.
124
+ * request field instead of the classic `max_tokens` (the per-model mechanism
125
+ * from issue #34; `qwen3.8-max` is the catalog model that still uses it).
126
+ * The model object here is pi-ai's post-registry view — baseline catalog,
127
+ * live-merge refresh, `models.json` override and the #19 stale-store overlay
128
+ * all flow through `compat`, so this reads the value the user actually runs
129
+ * with.
128
130
  */
129
131
  function modelSendsMaxCompletionTokens(model: unknown): boolean {
130
132
  if (!isObject(model)) return false;