pi-freeflow 1.0.8 → 1.0.9

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.
@@ -948,15 +948,20 @@ function normalizeRequestBody(
948
948
  }
949
949
 
950
950
  // 3. Max & Min tokens clamping (OpenCode Zen requires min 16; Vercel relay caps at 64k)
951
- const mt = (body.max_tokens ?? body.maxTokens ?? body.max_output_tokens) as number | undefined;
952
- if (typeof mt === "number") {
953
- let clamped = mt;
954
- if (clamped < 16) clamped = 16;
955
- else if (isRelay && clamped > RELAY_MAX_TOKENS) clamped = RELAY_MAX_TOKENS;
956
-
957
- if (body.max_tokens !== undefined) body.max_tokens = clamped;
958
- if (body.maxTokens !== undefined) body.maxTokens = clamped;
959
- if (body.max_output_tokens !== undefined) body.max_output_tokens = clamped;
951
+ const clampTokens = (val: number): number => {
952
+ if (val < 16) return 16;
953
+ if (isRelay && val > RELAY_MAX_TOKENS) return RELAY_MAX_TOKENS;
954
+ return val;
955
+ };
956
+
957
+ if (typeof body.max_tokens === "number") {
958
+ body.max_tokens = clampTokens(body.max_tokens);
959
+ }
960
+ if (typeof body.maxTokens === "number") {
961
+ body.maxTokens = clampTokens(body.maxTokens);
962
+ }
963
+ if (typeof body.max_output_tokens === "number") {
964
+ body.max_output_tokens = clampTokens(body.max_output_tokens);
960
965
  }
961
966
 
962
967
  return body;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-freeflow",
3
3
  "type": "module",
4
- "version": "1.0.8",
4
+ "version": "1.0.9",
5
5
  "description": "Personal multi-cloud rolling fallback relay for OpenCode Zen and KiloCode models in OMP/Pi",
6
6
  "keywords": [
7
7
  "pi-package",