Add [1m] extended-context variants for gpt-6-astra/sol/luna and gpt-5.6-sol/terra/luna mapping to their base upstream model IDs with an 872k-token context window, share the codex capability table with the cx alias, align model discovery with the inference client version, respect per-connection enabledModels during account selection, and fall back to another account when Codex reports a model unsupported for a ChatGPT account.
20 lines
1.3 KiB
JavaScript
20 lines
1.3 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import codex from "../../open-sse/providers/registry/codex.js";
|
|
import { getModelUpstreamId } from "../../open-sse/config/providerModels.js";
|
|
import { getCapabilitiesForModel } from "../../open-sse/providers/capabilities.js";
|
|
import { stripModelContextMarker } from "../../open-sse/utils/modelMarkers.js";
|
|
import { checkFallbackError } from "../../open-sse/services/accountFallback.js";
|
|
|
|
for (const id of ["gpt-6-astra", "gpt-6-sol", "gpt-6-luna", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna"]) {
|
|
const extended = `${id}[1m]`;
|
|
assert.equal(codex.models.find((model) => model.id === extended)?.upstreamModelId, id);
|
|
assert.equal(getModelUpstreamId("cx", extended), id);
|
|
assert.equal(getCapabilitiesForModel("codex", extended).contextWindow, 872000);
|
|
assert.equal(getCapabilitiesForModel("cx", extended).contextWindow, 872000);
|
|
assert.deepEqual(stripModelContextMarker(`cx/${extended}`), { model: `cx/${id}`, contextMarker: "1m" });
|
|
}
|
|
const unsupported = "The 'gpt-6-sol' model is not supported when using Codex with a ChatGPT account.";
|
|
assert.equal(checkFallbackError(400, unsupported, 0, "codex").shouldFallback, true);
|
|
assert.equal(checkFallbackError(400, "Invalid JSON body", 0, "codex").shouldFallback, false);
|
|
console.log("Codex extended models and account fallback OK");
|