@oh-my-pi/pi-ai 13.14.0 → 13.15.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/CHANGELOG.md CHANGED
@@ -2,6 +2,33 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [13.15.0] - 2026-03-23
6
+
7
+ ### Added
8
+
9
+ - Added `isUsageLimitError()` to `rate-limit-utils` as a single source of truth for detecting usage/quota limit errors across all providers
10
+
11
+ ### Fixed
12
+
13
+ - Fixed lazy stream forwarding to properly handle final results from source streams with `result()` methods
14
+ - Fixed lazy stream error handling to convert iterator failures into terminal error results instead of silently failing
15
+ - Fixed `parseRateLimitReason` to recognize "usage limit" in error messages and correctly classify them as `QUOTA_EXHAUSTED`
16
+ - Fixed Codex `fetchWithRetry` retrying 429 responses for `usage_limit_reached` errors for up to 5 minutes instead of returning immediately for credential switching
17
+ - Removed `usage.?limit` from `TRANSIENT_MESSAGE_PATTERN` in retry utils since usage limits are not transient and require credential rotation
18
+ - Fixed `parseRateLimitReason` not recognizing "usage limit" in Codex error messages, causing incorrect fallback to `UNKNOWN` classification instead of `QUOTA_EXHAUSTED`
19
+
20
+ ## [13.14.2] - 2026-03-21
21
+ ### Changed
22
+
23
+ - Updated thinking configuration format from `levels` array to `minLevel` and `maxLevel` properties for improved clarity
24
+ - Corrected context window from 400000 to 272000 tokens for GPT-5.4 mini and nano variants on Codex transport
25
+ - Normalized GPT-5.4 variant priority handling to use parsed variant instead of special-casing raw model IDs
26
+ - Added support for `mini` variant in OpenAI model parsing regex
27
+
28
+ ### Fixed
29
+
30
+ - Fixed inconsistent thinking level configuration across multiple model definitions
31
+
5
32
  ## [13.14.0] - 2026-03-20
6
33
 
7
34
  ### Fixed
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-ai",
4
- "version": "13.14.0",
4
+ "version": "13.15.2",
5
5
  "description": "Unified LLM API with automatic model discovery and provider configuration",
6
6
  "homepage": "https://github.com/can1357/oh-my-pi",
7
7
  "author": "Can Boluk",
@@ -41,7 +41,7 @@
41
41
  "@aws-sdk/client-bedrock-runtime": "^3",
42
42
  "@bufbuild/protobuf": "^2.11",
43
43
  "@google/genai": "^1.43",
44
- "@oh-my-pi/pi-utils": "13.14.0",
44
+ "@oh-my-pi/pi-utils": "13.15.2",
45
45
  "@sinclair/typebox": "^0.34",
46
46
  "@smithy/node-http-handler": "^4.4",
47
47
  "ajv": "^8.18",
package/src/index.ts CHANGED
@@ -16,6 +16,7 @@ export * from "./providers/google";
16
16
  export * from "./providers/google-gemini-cli";
17
17
  export * from "./providers/google-vertex";
18
18
  export * from "./providers/kimi";
19
+ export type { OpenAICodexResponsesOptions } from "./providers/openai-codex-responses";
19
20
  export * from "./providers/openai-completions";
20
21
  export * from "./providers/openai-responses";
21
22
  export * from "./providers/synthetic";
@@ -40,7 +40,13 @@ type SemVer = {
40
40
 
41
41
  type GeminiKind = "pro" | "flash";
42
42
  type AnthropicKind = "opus" | "sonnet";
43
- type OpenAIVariant = "base" | "codex" | "codex-max" | "codex-mini" | "codex-spark" | "max" | "nano";
43
+ type OpenAIVariant = "base" | "codex" | "codex-max" | "codex-mini" | "codex-spark" | "mini" | "max" | "nano";
44
+
45
+ const CODEX_GPT_5_4_PRIORITY_BY_VARIANT: Partial<Record<OpenAIVariant, number>> = {
46
+ base: 0,
47
+ mini: 1,
48
+ nano: 2,
49
+ };
44
50
 
45
51
  interface GeminiModel {
46
52
  family: "gemini";
@@ -299,9 +305,17 @@ function applyOpenAICatalogPolicy(model: ApiModel<Api>, parsedModel: OpenAIModel
299
305
  return;
300
306
  }
301
307
  // GPT-5.4 mini/nano use plain OpenAI IDs on the Codex transport, but Codex still
302
- // enforces the lower prompt budget for these variants.
303
- if (model.api === "openai-codex-responses" && (model.id === "gpt-5.4-mini" || model.id === "gpt-5.4-nano")) {
304
- model.contextWindow = 272000;
308
+ // enforces the lower prompt budget for these variants. Codex discovery can also
309
+ // report inconsistent priorities for the GPT-5.4 family, so normalize by parsed
310
+ // variant instead of special-casing raw model ids.
311
+ if (model.api === "openai-codex-responses" && semverEqual(parsedModel.version, "5.4")) {
312
+ const normalizedPriority = CODEX_GPT_5_4_PRIORITY_BY_VARIANT[parsedModel.variant];
313
+ if (normalizedPriority !== undefined) {
314
+ model.priority = normalizedPriority;
315
+ }
316
+ if (parsedModel.variant === "mini" || parsedModel.variant === "nano") {
317
+ model.contextWindow = 272000;
318
+ }
305
319
  }
306
320
  }
307
321
 
@@ -489,7 +503,7 @@ function parseAnthropicModel(modelId: string): AnthropicModel | null {
489
503
  }
490
504
 
491
505
  function parseOpenAIModel(modelId: string): OpenAIModel | null {
492
- const match = /gpt-(\d+(?:\.\d+){0,2})(?:-(codex-spark|codex-mini|codex-max|codex|max|nano))?\b/.exec(modelId);
506
+ const match = /gpt-(\d+(?:\.\d+){0,2})(?:-(codex-spark|codex-mini|codex-max|codex|mini|max|nano))?\b/.exec(modelId);
493
507
  if (!match) {
494
508
  return null;
495
509
  }