codex-multi-auth 2.10.0 → 2.12.0
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/.codex-plugin/plugin.json +1 -1
- package/README.md +1 -1
- package/config/README.md +3 -1
- package/config/codex-legacy.json +300 -0
- package/config/codex-modern.json +96 -0
- package/dist/lib/capability-policy.d.ts.map +1 -1
- package/dist/lib/capability-policy.js +18 -2
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +5 -2
- package/dist/lib/constants.d.ts +9 -0
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/constants.js +29 -0
- package/dist/lib/context-budget/model-context-windows.d.ts +1 -1
- package/dist/lib/context-budget/model-context-windows.d.ts.map +1 -1
- package/dist/lib/context-budget/model-context-windows.js +12 -0
- package/dist/lib/entitlement-cache.d.ts.map +1 -1
- package/dist/lib/entitlement-cache.js +2 -1
- package/dist/lib/model-capability-matrix.d.ts.map +1 -1
- package/dist/lib/model-capability-matrix.js +9 -1
- package/dist/lib/policy/runtime-policy.d.ts +9 -1
- package/dist/lib/policy/runtime-policy.d.ts.map +1 -1
- package/dist/lib/policy/runtime-policy.js +1 -0
- package/dist/lib/request/error-classification.d.ts.map +1 -1
- package/dist/lib/request/error-classification.js +45 -4
- package/dist/lib/request/helpers/model-map.d.ts.map +1 -1
- package/dist/lib/request/helpers/model-map.js +181 -0
- package/dist/lib/usage/ledger.d.ts +1 -1
- package/dist/lib/usage/ledger.d.ts.map +1 -1
- package/dist/lib/usage/ledger.js +9 -0
- package/dist/lib/usage/pricing.d.ts +17 -2
- package/dist/lib/usage/pricing.d.ts.map +1 -1
- package/dist/lib/usage/pricing.js +72 -1
- package/dist/lib/usage/redaction.d.ts +1 -1
- package/dist/lib/usage/redaction.d.ts.map +1 -1
- package/dist/lib/usage/redaction.js +13 -0
- package/dist/lib/usage/types.d.ts +33 -0
- package/dist/lib/usage/types.d.ts.map +1 -1
- package/dist/lib/usage/types.js +28 -1
- package/dist/lib/usage/usage-extraction.d.ts +2 -1
- package/dist/lib/usage/usage-extraction.d.ts.map +1 -1
- package/dist/lib/usage/usage-extraction.js +44 -4
- package/package.json +1 -1
- package/scripts/codex.js +153 -2
|
@@ -1,12 +1,40 @@
|
|
|
1
1
|
export type UsageLedgerSource = "runtime-proxy" | "plugin-host" | "local-bridge" | "cli" | "unknown";
|
|
2
2
|
export type UsageLedgerOperation = "responses" | "models" | "thread-goal" | "auth-refresh" | "diagnostic" | "unknown";
|
|
3
3
|
export type UsageLedgerOutcome = "success" | "failure" | "blocked" | "cancelled";
|
|
4
|
+
/**
|
|
5
|
+
* The service tier a response was actually billed at.
|
|
6
|
+
*
|
|
7
|
+
* OpenAI's Fast/priority tier costs more than standard (2x for GPT-6 Astra), so
|
|
8
|
+
* a rate table with no tier dimension under-counts such a session. `standard`
|
|
9
|
+
* and `default` are the same thing on the wire; anything this union does not
|
|
10
|
+
* name is normalised to `unknown`, which is treated as unpriced rather than
|
|
11
|
+
* assumed cheap.
|
|
12
|
+
*/
|
|
13
|
+
export declare const USAGE_SERVICE_TIERS: readonly ["standard", "priority", "flex", "batch", "scale", "unknown"];
|
|
14
|
+
export type UsageServiceTier = (typeof USAGE_SERVICE_TIERS)[number];
|
|
15
|
+
/**
|
|
16
|
+
* Narrow an unvalidated value to a known tier.
|
|
17
|
+
*
|
|
18
|
+
* The ledger is JSONL on disk and can be hand-edited, so a value read back from
|
|
19
|
+
* it is untrusted. An unrecognised string reaching the pricer would be treated
|
|
20
|
+
* as a tier with no rate and silently make every affected row unpriced.
|
|
21
|
+
*/
|
|
22
|
+
export declare function isKnownServiceTier(value: unknown): value is UsageServiceTier;
|
|
4
23
|
export interface UsageTokenCounts {
|
|
5
24
|
inputTokens: number;
|
|
6
25
|
outputTokens: number;
|
|
7
26
|
cachedInputTokens: number;
|
|
8
27
|
reasoningTokens: number;
|
|
9
28
|
totalTokens: number;
|
|
29
|
+
/**
|
|
30
|
+
* Rides on the token counts rather than a separate parameter so it reaches
|
|
31
|
+
* the ledger through every existing path: the `onUsage` callback in
|
|
32
|
+
* `response-handler.ts` carries this shape, and both the streaming scanner
|
|
33
|
+
* and the non-streaming branch already funnel through
|
|
34
|
+
* `extractResponsesUsage`. Absent when the response did not report one,
|
|
35
|
+
* which is the common case and is priced as `standard`.
|
|
36
|
+
*/
|
|
37
|
+
serviceTier?: UsageServiceTier;
|
|
10
38
|
}
|
|
11
39
|
export interface UsageLedgerAccountRef {
|
|
12
40
|
accountHash?: string;
|
|
@@ -50,6 +78,11 @@ export interface UsageLedgerAppendInput {
|
|
|
50
78
|
cachedInputTokens?: number | null;
|
|
51
79
|
reasoningTokens?: number | null;
|
|
52
80
|
totalTokens?: number | null;
|
|
81
|
+
/**
|
|
82
|
+
* The tier the response reported. Absent means standard, which is what every
|
|
83
|
+
* rate in `MODEL_PRICING` is quoted at.
|
|
84
|
+
*/
|
|
85
|
+
serviceTier?: UsageServiceTier;
|
|
53
86
|
costUsd?: number | null;
|
|
54
87
|
}
|
|
55
88
|
export type UsageSummaryGroupBy = "model" | "account" | "project" | "outcome" | "day";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../lib/usage/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAC1B,eAAe,GACf,aAAa,GACb,cAAc,GACd,KAAK,GACL,SAAS,CAAC;AAEb,MAAM,MAAM,oBAAoB,GAC7B,WAAW,GACX,QAAQ,GACR,aAAa,GACb,cAAc,GACd,YAAY,GACZ,SAAS,CAAC;AAEb,MAAM,MAAM,kBAAkB,GAC3B,SAAS,GACT,SAAS,GACT,SAAS,GACT,WAAW,CAAC;AAEf,MAAM,WAAW,gBAAgB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,C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B"}
|
package/dist/lib/usage/types.js
CHANGED
|
@@ -1 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The service tier a response was actually billed at.
|
|
3
|
+
*
|
|
4
|
+
* OpenAI's Fast/priority tier costs more than standard (2x for GPT-6 Astra), so
|
|
5
|
+
* a rate table with no tier dimension under-counts such a session. `standard`
|
|
6
|
+
* and `default` are the same thing on the wire; anything this union does not
|
|
7
|
+
* name is normalised to `unknown`, which is treated as unpriced rather than
|
|
8
|
+
* assumed cheap.
|
|
9
|
+
*/
|
|
10
|
+
export const USAGE_SERVICE_TIERS = [
|
|
11
|
+
"standard",
|
|
12
|
+
"priority",
|
|
13
|
+
"flex",
|
|
14
|
+
"batch",
|
|
15
|
+
"scale",
|
|
16
|
+
"unknown",
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Narrow an unvalidated value to a known tier.
|
|
20
|
+
*
|
|
21
|
+
* The ledger is JSONL on disk and can be hand-edited, so a value read back from
|
|
22
|
+
* it is untrusted. An unrecognised string reaching the pricer would be treated
|
|
23
|
+
* as a tier with no rate and silently make every affected row unpriced.
|
|
24
|
+
*/
|
|
25
|
+
export function isKnownServiceTier(value) {
|
|
26
|
+
return (typeof value === "string" &&
|
|
27
|
+
USAGE_SERVICE_TIERS.includes(value));
|
|
28
|
+
}
|
|
@@ -17,7 +17,8 @@ import type { UsageTokenCounts } from "./types.js";
|
|
|
17
17
|
export declare function extractUsageTokenCounts(usage: unknown): UsageTokenCounts | null;
|
|
18
18
|
/**
|
|
19
19
|
* Pull the `usage` object out of a Responses payload, whether it arrived as a
|
|
20
|
-
* bare response object (non-streaming) or wrapped in a stream event envelope
|
|
20
|
+
* bare response object (non-streaming) or wrapped in a stream event envelope,
|
|
21
|
+
* and attach the tier it was billed at.
|
|
21
22
|
*/
|
|
22
23
|
export declare function extractResponsesUsage(payload: unknown): UsageTokenCounts | null;
|
|
23
24
|
export interface UsageStreamScanner {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage-extraction.d.ts","sourceRoot":"","sources":["../../../lib/usage/usage-extraction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"usage-extraction.d.ts","sourceRoot":"","sources":["../../../lib/usage/usage-extraction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAoB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AA+BrE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CACtC,KAAK,EAAE,OAAO,GACZ,gBAAgB,GAAG,IAAI,CA+BzB;AAoCD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,gBAAgB,GAAG,IAAI,CAa/E;AAED,MAAM,WAAW,kBAAkB;IAClC,8CAA8C;IAC9C,IAAI,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IAClC,2EAA2E;IAC3E,MAAM,EAAE,MAAM,gBAAgB,GAAG,IAAI,CAAC;CACtC;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE;IACjD,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B,GAAG,kBAAkB,CA6ErB"}
|
|
@@ -66,18 +66,58 @@ export function extractUsageTokenCounts(usage) {
|
|
|
66
66
|
totalTokens: providedTotal,
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Read the billed service tier off a Responses payload.
|
|
71
|
+
*
|
|
72
|
+
* `service_tier` sits on the response object, not inside `usage`, and a stream
|
|
73
|
+
* event wraps that object one level down. An unrecognised value becomes
|
|
74
|
+
* `unknown` rather than being dropped, because dropping it would price the row
|
|
75
|
+
* at standard rates and under-count a more expensive tier.
|
|
76
|
+
*/
|
|
77
|
+
function extractServiceTier(payload) {
|
|
78
|
+
const raw = payload.service_tier ??
|
|
79
|
+
(isRecord(payload.response) ? payload.response.service_tier : undefined);
|
|
80
|
+
if (typeof raw !== "string")
|
|
81
|
+
return undefined;
|
|
82
|
+
const normalized = raw.trim().toLowerCase();
|
|
83
|
+
if (normalized.length === 0)
|
|
84
|
+
return undefined;
|
|
85
|
+
// `default` is what the API calls the standard tier on the wire.
|
|
86
|
+
if (normalized === "default" || normalized === "standard")
|
|
87
|
+
return "standard";
|
|
88
|
+
// The upstream catalog names this tier `priority` with the display name
|
|
89
|
+
// "Fast", and lists `fast` in `additional_speed_tiers`, so a response can
|
|
90
|
+
// report either spelling. Without this it becomes `unknown`, which prices
|
|
91
|
+
// as unpriced and fails a cost budget closed on a tier we DO have a rate
|
|
92
|
+
// for.
|
|
93
|
+
if (normalized === "fast")
|
|
94
|
+
return "priority";
|
|
95
|
+
if (normalized === "priority" ||
|
|
96
|
+
normalized === "flex" ||
|
|
97
|
+
normalized === "batch" ||
|
|
98
|
+
normalized === "scale") {
|
|
99
|
+
return normalized;
|
|
100
|
+
}
|
|
101
|
+
return "unknown";
|
|
102
|
+
}
|
|
69
103
|
/**
|
|
70
104
|
* Pull the `usage` object out of a Responses payload, whether it arrived as a
|
|
71
|
-
* bare response object (non-streaming) or wrapped in a stream event envelope
|
|
105
|
+
* bare response object (non-streaming) or wrapped in a stream event envelope,
|
|
106
|
+
* and attach the tier it was billed at.
|
|
72
107
|
*/
|
|
73
108
|
export function extractResponsesUsage(payload) {
|
|
74
109
|
if (!isRecord(payload))
|
|
75
110
|
return null;
|
|
111
|
+
const serviceTier = extractServiceTier(payload);
|
|
76
112
|
const direct = extractUsageTokenCounts(payload.usage);
|
|
77
|
-
if (direct)
|
|
78
|
-
return direct;
|
|
113
|
+
if (direct) {
|
|
114
|
+
return serviceTier ? { ...direct, serviceTier } : direct;
|
|
115
|
+
}
|
|
79
116
|
if (isRecord(payload.response)) {
|
|
80
|
-
|
|
117
|
+
const nested = extractUsageTokenCounts(payload.response.usage);
|
|
118
|
+
if (!nested)
|
|
119
|
+
return null;
|
|
120
|
+
return serviceTier ? { ...nested, serviceTier } : nested;
|
|
81
121
|
}
|
|
82
122
|
return null;
|
|
83
123
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codex-multi-auth",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.0",
|
|
4
4
|
"description": "Codex CLI multi-account OAuth manager with account switching, health checks, runtime rotation, diagnostics, and recovery tools for @openai/codex",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
package/scripts/codex.js
CHANGED
|
@@ -574,7 +574,27 @@ async function applyForcedAccountSelection(rawArgs, env = process.env) {
|
|
|
574
574
|
}
|
|
575
575
|
|
|
576
576
|
function resolveModelFamilyForStatus(model) {
|
|
577
|
-
|
|
577
|
+
// `resolveStatusModel` hands over the raw `--model` / `-m` value or the
|
|
578
|
+
// config value verbatim, so a provider-qualified id arrives intact. Every
|
|
579
|
+
// branch below is a `startsWith`, so `openai/gpt-6` used to match none of
|
|
580
|
+
// them and return null, dropping status routing back to `activeIndex`
|
|
581
|
+
// instead of the family index. Strip the prefix once, for all of them.
|
|
582
|
+
const normalized =
|
|
583
|
+
typeof model === "string"
|
|
584
|
+
? stripProviderPrefix(model.trim()).toLowerCase()
|
|
585
|
+
: "";
|
|
586
|
+
// GPT-6 Astra and the Daybreak cyber models share the gpt-5.2 prompt family
|
|
587
|
+
// with the GPT-5.6 general tiers (see lib/request/helpers/model-map.ts
|
|
588
|
+
// MODEL_PROFILES). Daybreak has to be checked explicitly: its slug matches
|
|
589
|
+
// none of the branches below, so it used to fall through to `null` and get
|
|
590
|
+
// bucketed against no family at all.
|
|
591
|
+
if (
|
|
592
|
+
(normalized.startsWith("gpt-6") || normalized.startsWith("astra")) &&
|
|
593
|
+
!normalized.includes("codex")
|
|
594
|
+
) {
|
|
595
|
+
return "gpt-5.2";
|
|
596
|
+
}
|
|
597
|
+
if (normalized.includes("daybreak")) return "gpt-5.2";
|
|
578
598
|
// GPT-5.6 general tiers share the gpt-5.2 prompt family (see
|
|
579
599
|
// lib/request/helpers/model-map.ts MODEL_PROFILES). Check before the generic
|
|
580
600
|
// gpt-5 catch-all, which would otherwise mis-bucket them as codex.
|
|
@@ -1259,7 +1279,18 @@ const DIRECT_UNSUPPORTED_MODEL_PATTERN =
|
|
|
1259
1279
|
/['"]([^'"]+)['"]\s+model is not supported when using codex with a chatgpt account/i;
|
|
1260
1280
|
const CURRENT_CODEX_MODEL = "gpt-5.3-codex";
|
|
1261
1281
|
const LEGACY_CODEX_MODEL = "gpt-5-codex";
|
|
1282
|
+
// Mirrors the GPT-6 rows of lib/request/error-classification.ts
|
|
1283
|
+
// `DEFAULT_UNSUPPORTED_CODEX_FALLBACK_CHAIN`. This table is walked differently
|
|
1284
|
+
// from lib's: `resolveUnsupportedModelRetryTarget` keys on the model named in
|
|
1285
|
+
// the error output and falls back to the original requested model, with
|
|
1286
|
+
// `attemptedModels` accumulating, so a row's later entries ARE reachable here.
|
|
1287
|
+
// The two tables are not identical today (`gpt-5.3-codex` has a row in lib and
|
|
1288
|
+
// not here), which predates GPT-6 and is left alone; the GPT-6 rows are pinned
|
|
1289
|
+
// in parity by test/codex-model-resolution.test.ts.
|
|
1262
1290
|
const WRAPPER_UNSUPPORTED_MODEL_FALLBACK_CHAIN = {
|
|
1291
|
+
"gpt-6-astra": ["gpt-5.6-sol", "gpt-5.5"],
|
|
1292
|
+
"gpt-6-astra-aeon": ["gpt-6-astra", "gpt-5.6-sol"],
|
|
1293
|
+
"gpt-5.6-sol": ["gpt-5.5"],
|
|
1263
1294
|
"gpt-5": ["gpt-5.5"],
|
|
1264
1295
|
"gpt-5-pro": ["gpt-5.5-pro"],
|
|
1265
1296
|
"gpt-5-chat-latest": ["gpt-5.5"],
|
|
@@ -1901,6 +1932,10 @@ function hasCliAuthCredentialsStoreOverride(args) {
|
|
|
1901
1932
|
// This wrapper runs before the TypeScript build, so it cannot import that source.
|
|
1902
1933
|
const SUPPORTED_REASONING_EFFORTS_BY_MODEL = {
|
|
1903
1934
|
[CURRENT_CODEX_MODEL]: ["low", "medium", "high", "xhigh"],
|
|
1935
|
+
"gpt-6-astra": ["low", "medium", "high", "xhigh", "max", "ultra"],
|
|
1936
|
+
"gpt-6-astra-aeon": ["low", "medium", "high", "xhigh", "max", "ultra"],
|
|
1937
|
+
"gpt-daybreak-blue-latest": ["low", "medium", "high", "xhigh", "max", "ultra"],
|
|
1938
|
+
"gpt-daybreak-red-latest": ["low", "medium", "high", "xhigh", "max", "ultra"],
|
|
1904
1939
|
"gpt-5.6-sol": ["low", "medium", "high", "xhigh", "max", "ultra"],
|
|
1905
1940
|
"gpt-5.6-terra": ["low", "medium", "high", "xhigh", "max", "ultra"],
|
|
1906
1941
|
"gpt-5.6-luna": ["low", "medium", "high", "xhigh", "max"],
|
|
@@ -1960,6 +1995,18 @@ const GPT_5_6_LUNA_MODEL = "gpt-5.6-luna";
|
|
|
1960
1995
|
const GPT_5_6_FLAGSHIP_ALIAS = "gpt-5.6";
|
|
1961
1996
|
const GPT_5_6_SOL_TERRA_EFFORTS = ["low", "medium", "high", "xhigh", "max", "ultra"];
|
|
1962
1997
|
const GPT_5_6_LUNA_EFFORTS = ["low", "medium", "high", "xhigh", "max"];
|
|
1998
|
+
// GPT-6 Astra (2026-09-03). No Sol/Terra/Luna split this generation: the
|
|
1999
|
+
// flagship plus `aeon`, a long-horizon variant. Same frontier effort ladder as
|
|
2000
|
+
// 5.6 (no `none`/`minimal`, `ultra` at the top). Bare `gpt-6` -> flagship.
|
|
2001
|
+
const GPT_6_ASTRA_MODEL = "gpt-6-astra";
|
|
2002
|
+
const GPT_6_ASTRA_AEON_MODEL = "gpt-6-astra-aeon";
|
|
2003
|
+
const GPT_6_FLAGSHIP_ALIAS = "gpt-6";
|
|
2004
|
+
const GPT_6_ASTRA_EFFORTS = ["low", "medium", "high", "xhigh", "max", "ultra"];
|
|
2005
|
+
// Daybreak cyber models from the upstream Codex catalog. `red` is the
|
|
2006
|
+
// cyber-permissive variant, `blue` the defensive one.
|
|
2007
|
+
const DAYBREAK_BLUE_MODEL = "gpt-daybreak-blue-latest";
|
|
2008
|
+
const DAYBREAK_RED_MODEL = "gpt-daybreak-red-latest";
|
|
2009
|
+
const DAYBREAK_EFFORTS = ["low", "medium", "high", "xhigh", "max", "ultra"];
|
|
1963
2010
|
const GENERAL_GPT5_VERSION_CATALOG = {
|
|
1964
2011
|
1: {
|
|
1965
2012
|
base: "gpt-5.1",
|
|
@@ -2163,6 +2210,47 @@ function seedRequestedModelAliases() {
|
|
|
2163
2210
|
GPT_5_6_SOL_MODEL,
|
|
2164
2211
|
GPT_5_6_SOL_TERRA_EFFORTS,
|
|
2165
2212
|
);
|
|
2213
|
+
addRequestedModelEffortAliases(
|
|
2214
|
+
GPT_6_ASTRA_MODEL,
|
|
2215
|
+
GPT_6_ASTRA_MODEL,
|
|
2216
|
+
GPT_6_ASTRA_EFFORTS,
|
|
2217
|
+
);
|
|
2218
|
+
addRequestedModelEffortAliases(
|
|
2219
|
+
GPT_6_ASTRA_AEON_MODEL,
|
|
2220
|
+
GPT_6_ASTRA_AEON_MODEL,
|
|
2221
|
+
GPT_6_ASTRA_EFFORTS,
|
|
2222
|
+
);
|
|
2223
|
+
addRequestedModelEffortAliases(
|
|
2224
|
+
GPT_6_FLAGSHIP_ALIAS,
|
|
2225
|
+
GPT_6_ASTRA_MODEL,
|
|
2226
|
+
GPT_6_ASTRA_EFFORTS,
|
|
2227
|
+
);
|
|
2228
|
+
addRequestedModelEffortAliases("astra", GPT_6_ASTRA_MODEL, GPT_6_ASTRA_EFFORTS);
|
|
2229
|
+
addRequestedModelEffortAliases(
|
|
2230
|
+
"astra-aeon",
|
|
2231
|
+
GPT_6_ASTRA_AEON_MODEL,
|
|
2232
|
+
GPT_6_ASTRA_EFFORTS,
|
|
2233
|
+
);
|
|
2234
|
+
addRequestedModelEffortAliases(
|
|
2235
|
+
DAYBREAK_BLUE_MODEL,
|
|
2236
|
+
DAYBREAK_BLUE_MODEL,
|
|
2237
|
+
DAYBREAK_EFFORTS,
|
|
2238
|
+
);
|
|
2239
|
+
addRequestedModelEffortAliases(
|
|
2240
|
+
DAYBREAK_RED_MODEL,
|
|
2241
|
+
DAYBREAK_RED_MODEL,
|
|
2242
|
+
DAYBREAK_EFFORTS,
|
|
2243
|
+
);
|
|
2244
|
+
addRequestedModelEffortAliases(
|
|
2245
|
+
"daybreak-blue",
|
|
2246
|
+
DAYBREAK_BLUE_MODEL,
|
|
2247
|
+
DAYBREAK_EFFORTS,
|
|
2248
|
+
);
|
|
2249
|
+
addRequestedModelEffortAliases(
|
|
2250
|
+
"daybreak-red",
|
|
2251
|
+
DAYBREAK_RED_MODEL,
|
|
2252
|
+
DAYBREAK_EFFORTS,
|
|
2253
|
+
);
|
|
2166
2254
|
addRequestedModelReasoningAliases(CURRENT_CODEX_MODEL, CURRENT_CODEX_MODEL);
|
|
2167
2255
|
addRequestedModelReasoningAliases("gpt-5.3-codex-spark", CURRENT_CODEX_MODEL);
|
|
2168
2256
|
addRequestedModelReasoningAliases(LEGACY_CODEX_MODEL, CURRENT_CODEX_MODEL);
|
|
@@ -2218,6 +2306,13 @@ function resolveStableGeneralGpt5Variant(variant) {
|
|
|
2218
2306
|
return fallback;
|
|
2219
2307
|
}
|
|
2220
2308
|
|
|
2309
|
+
// The final clause is a catch-all on the `codex` substring, matching
|
|
2310
|
+
// `resolveCodexCatalogModel` in lib/request/helpers/model-map.ts. It used to be
|
|
2311
|
+
// an exact `normalized === "codex"` check, so any codex id the explicit list
|
|
2312
|
+
// above did not name (`gpt-6-codex`, `gpt-5.7-codex`, …) resolved to nothing in
|
|
2313
|
+
// the wrapper while lib resolved it to the current codex model — a silent drift
|
|
2314
|
+
// between the two, which is exactly what test/codex-model-resolution.test.ts
|
|
2315
|
+
// exists to prevent.
|
|
2221
2316
|
function resolveCodexRequestedModel(normalized) {
|
|
2222
2317
|
if (
|
|
2223
2318
|
normalized.includes("gpt-5.1-codex-max") ||
|
|
@@ -2246,7 +2341,7 @@ function resolveCodexRequestedModel(normalized) {
|
|
|
2246
2341
|
normalized.includes("gpt 5.1 codex") ||
|
|
2247
2342
|
normalized.includes("gpt-5-codex") ||
|
|
2248
2343
|
normalized.includes("gpt 5 codex") ||
|
|
2249
|
-
normalized
|
|
2344
|
+
normalized.includes("codex")
|
|
2250
2345
|
) {
|
|
2251
2346
|
return CURRENT_CODEX_MODEL;
|
|
2252
2347
|
}
|
|
@@ -2258,6 +2353,51 @@ function resolveCodexRequestedModel(normalized) {
|
|
|
2258
2353
|
// future `gpt-5.6-terra-fast`). Without this the general GPT-5 resolver sees
|
|
2259
2354
|
// minor `6`, finds no catalog entry, and silently falls back to 5.5. Unknown
|
|
2260
2355
|
// tiers resolve to Sol, matching OpenAI's bare `gpt-5.6` alias.
|
|
2356
|
+
// Resolve GPT-6 identifiers that are not exact aliases (a dated snapshot, the
|
|
2357
|
+
// `gpt-6-astra-pro` plan tier, or a tier OpenAI adds later). Without this the
|
|
2358
|
+
// general GPT-5 resolver never matches (it needs a `gpt 5` token pair) and the
|
|
2359
|
+
// id falls through to 5.5 — running GPT-5.5 for a caller who asked for the
|
|
2360
|
+
// frontier model. `aeon` keeps its own id because it is a behaviourally
|
|
2361
|
+
// different model, not a rename. Mirrors lib/request/helpers/model-map.ts.
|
|
2362
|
+
function resolveGpt6RequestedModel(stripped) {
|
|
2363
|
+
const tokens = tokenizeRequestedModel(stripped);
|
|
2364
|
+
const gptIndex = tokens.indexOf("gpt");
|
|
2365
|
+
// `gpt6` with no separator tokenizes as one token, so the `gpt` + `6` pair
|
|
2366
|
+
// never forms; mirror lib and claim it here.
|
|
2367
|
+
const versionToken = gptIndex === -1 ? undefined : tokens[gptIndex + 1];
|
|
2368
|
+
// `gpt6` with no separator tokenizes as one token, so the `gpt` + `6` pair
|
|
2369
|
+
// never forms; mirror lib and claim it here.
|
|
2370
|
+
const isGpt6 = versionToken === "6" || tokens.includes("gpt6");
|
|
2371
|
+
// A bare `astra` token counts too: picker labels and OpenAI's own material
|
|
2372
|
+
// say "Astra" with no `gpt-6` prefix, so `Astra Pro` arrives with no version
|
|
2373
|
+
// tokens and would otherwise miss every branch and land on 5.5. Anchored so
|
|
2374
|
+
// an id naming a different GPT major version, `gpt-4-astra-x`, is not
|
|
2375
|
+
// claimed for the frontier model.
|
|
2376
|
+
const namesOtherGptVersion =
|
|
2377
|
+
versionToken !== undefined &&
|
|
2378
|
+
/^\d+$/.test(versionToken) &&
|
|
2379
|
+
versionToken !== "6";
|
|
2380
|
+
const isAstra = tokens.includes("astra") && !namesOtherGptVersion;
|
|
2381
|
+
if ((!isGpt6 && !isAstra) || tokens.includes("codex")) {
|
|
2382
|
+
return "";
|
|
2383
|
+
}
|
|
2384
|
+
if (tokens.includes("aeon")) return GPT_6_ASTRA_AEON_MODEL;
|
|
2385
|
+
return GPT_6_ASTRA_MODEL;
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
// Daybreak slugs carry neither a `codex` nor a `gpt 5` token, so every other
|
|
2389
|
+
// resolver declines them and they would reach the 5.5 default. An unrecognised
|
|
2390
|
+
// Daybreak id resolves to `blue`, the more restricted of the two, so a typo
|
|
2391
|
+
// cannot silently upgrade a caller into the cyber-permissive model.
|
|
2392
|
+
function resolveDaybreakRequestedModel(stripped) {
|
|
2393
|
+
const tokens = tokenizeRequestedModel(stripped);
|
|
2394
|
+
if (!tokens.includes("daybreak")) {
|
|
2395
|
+
return "";
|
|
2396
|
+
}
|
|
2397
|
+
if (tokens.includes("red")) return DAYBREAK_RED_MODEL;
|
|
2398
|
+
return DAYBREAK_BLUE_MODEL;
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2261
2401
|
function resolveGpt56RequestedModel(stripped) {
|
|
2262
2402
|
const tokens = tokenizeRequestedModel(stripped);
|
|
2263
2403
|
const gptIndex = tokens.indexOf("gpt");
|
|
@@ -2316,11 +2456,21 @@ function normalizeRequestedModel(model) {
|
|
|
2316
2456
|
return exactMatch;
|
|
2317
2457
|
}
|
|
2318
2458
|
|
|
2459
|
+
const daybreakModel = resolveDaybreakRequestedModel(stripped);
|
|
2460
|
+
if (daybreakModel) {
|
|
2461
|
+
return daybreakModel;
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2319
2464
|
const codexModel = resolveCodexRequestedModel(normalized);
|
|
2320
2465
|
if (codexModel) {
|
|
2321
2466
|
return codexModel;
|
|
2322
2467
|
}
|
|
2323
2468
|
|
|
2469
|
+
const gpt6Model = resolveGpt6RequestedModel(stripped);
|
|
2470
|
+
if (gpt6Model) {
|
|
2471
|
+
return gpt6Model;
|
|
2472
|
+
}
|
|
2473
|
+
|
|
2324
2474
|
const gpt56Model = resolveGpt56RequestedModel(stripped);
|
|
2325
2475
|
if (gpt56Model) {
|
|
2326
2476
|
return gpt56Model;
|
|
@@ -6240,6 +6390,7 @@ export {
|
|
|
6240
6390
|
coerceReasoningEffortForModel,
|
|
6241
6391
|
resolveModelFamilyForStatus,
|
|
6242
6392
|
canonicalizeRequestedModelName,
|
|
6393
|
+
WRAPPER_UNSUPPORTED_MODEL_FALLBACK_CHAIN,
|
|
6243
6394
|
};
|
|
6244
6395
|
|
|
6245
6396
|
// Run the wrapper only when actually launched (as the `codex-multi-auth-codex`
|