@opengeni/codex 0.2.19 → 0.2.20-canary.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/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/usage-normalize.d.ts +8 -0
- package/package.json +2 -2
- package/src/usage-normalize.ts +14 -0
package/dist/index.js
CHANGED
|
@@ -599,6 +599,12 @@ function normalizeCodexUsage(httpStatus, rawPayload) {
|
|
|
599
599
|
...credits ? { credits } : {}
|
|
600
600
|
};
|
|
601
601
|
}
|
|
602
|
+
function codexUsageConfirmsQuotaAvailable(payload) {
|
|
603
|
+
if (payload.status !== "ok" || payload.limitReached) return false;
|
|
604
|
+
return !payload.additionalLimits?.some(
|
|
605
|
+
(limit) => (limit.fiveHour?.percent ?? 0) >= 100 || (limit.weekly?.percent ?? 0) >= 100
|
|
606
|
+
);
|
|
607
|
+
}
|
|
602
608
|
|
|
603
609
|
// src/api-client.ts
|
|
604
610
|
var CODEX_READ_TIMEOUT_MS = 5e3;
|
|
@@ -3076,6 +3082,7 @@ export {
|
|
|
3076
3082
|
codexRequestStorage,
|
|
3077
3083
|
codexSubscriptionFetch,
|
|
3078
3084
|
codexSubscriptionHeaders,
|
|
3085
|
+
codexUsageConfirmsQuotaAvailable,
|
|
3079
3086
|
consumeCodexRateLimitResetCredit,
|
|
3080
3087
|
contextAppendChunks,
|
|
3081
3088
|
createCodexRealtimeCall,
|