mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-11-21 15:05:56 +00:00
fix(catalog): preserve Codex 872k context window for codex/gpt-6.1-sol (#20437)
This commit is contained in:
@@ -0,0 +1 @@
|
||||
- **fix(catalog):** keep Codex 872K context window for `codex/gpt-6.1-sol` when `models.dev` syncs the 1,050,000 public-API limit, and include `gpt-6.1-terra` in Codex `ultra` effort extension ([#20437](https://github.com/cheaper-inference/OmniRoute/issues/20437))
|
||||
@@ -49,7 +49,7 @@ const RESPONSES_REASONING_ENCRYPTED_CONTENT_INCLUDE = "reasoning.encrypted_conte
|
||||
// include on this path. This compatibility policy makes no claim about the cause
|
||||
// or resolution of upstream safety rejections.
|
||||
const CODEX_MODEL_PATTERN =
|
||||
/^(?:(?:codex|cx)\/)?(?:gpt-6(?:\.1)?-(?:astra|sol|luna)|gpt-5\.6-(?:sol|terra|luna))(?:-(?:none|low|medium|high|xhigh|max|ultra))?$/;
|
||||
/^(?:(?:codex|cx)\/)?(?:gpt-6(?:\.1)?-(?:astra|sol|terra|luna)|gpt-5\.6-(?:sol|terra|luna))(?:-(?:none|low|medium|high|xhigh|max|ultra))?$/;
|
||||
function isCodexModel(model: unknown): boolean {
|
||||
if (typeof model !== "string") return false;
|
||||
return CODEX_MODEL_PATTERN.test(model.trim().toLowerCase());
|
||||
|
||||
@@ -987,7 +987,24 @@ export function getResolvedModelCapabilities(
|
||||
const persistedContextWindow = usePersistedOverrides
|
||||
? getContextOverride(resolved, snapshot)
|
||||
: null;
|
||||
const limitRows = { synced, registryModel, spec, authoritativeContextWindow };
|
||||
// #20437: models.dev maps `openai` to both `openai` and `cx` (Codex), so a synced
|
||||
// public-API context window (e.g. 1,050,000 for gpt-6.1-sol) can exceed Codex's
|
||||
// actual OAuth window (872,000) in the provider registry. Do not let a larger
|
||||
// synced limit override Codex's narrower registry window.
|
||||
const effectiveSynced =
|
||||
resolved.provider === "codex" &&
|
||||
synced &&
|
||||
typeof registryModel?.contextLength === "number" &&
|
||||
typeof synced.limit_context === "number" &&
|
||||
synced.limit_context > registryModel.contextLength
|
||||
? { ...synced, limit_context: null }
|
||||
: synced;
|
||||
const limitRows = {
|
||||
synced: effectiveSynced,
|
||||
registryModel,
|
||||
spec,
|
||||
authoritativeContextWindow,
|
||||
};
|
||||
const contextLimit = pickContextWindow(limitRows, persistedContextWindow);
|
||||
const contextWindow = contextLimit.value;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ export type VscodeCatalogModel = {
|
||||
|
||||
const STANDARD_EFFORT_SUFFIX_PATTERN = /-(xhigh|high|medium|low|none)$/i;
|
||||
const CODEX_EXTENDED_EFFORT_SUFFIX_PATTERN =
|
||||
/^(.*gpt-(?:5\.6-(?:sol|terra|luna)|6(?:\.1)?-(?:astra|sol|luna)))-(max|ultra)$/i;
|
||||
/^(.*gpt-(?:5\.6-(?:sol|terra|luna)|6(?:\.1)?-(?:astra|sol|terra|luna)))-(max|ultra)$/i;
|
||||
const DEFAULT_REASONING_EFFORT = "none";
|
||||
const KNOWN_REASONING_EFFORTS = new Set(["none", "low", "medium", "high", "xhigh", "max", "ultra"]);
|
||||
|
||||
@@ -191,7 +191,7 @@ function getCodexGpt56DefaultReasoningEffort(model: VscodeCatalogModel) {
|
||||
.trim()
|
||||
.toLowerCase();
|
||||
const match = providerModelId.match(
|
||||
/^gpt-(?:5\.6-(sol|terra|luna)|6(?:\.1)?-(?:astra|sol|luna))(?:-(?:none|low|medium|high|xhigh|max|ultra))?$/
|
||||
/^gpt-(?:5\.6-(sol|terra|luna)|6(?:\.1)?-(astra|sol|terra|luna))(?:-(?:none|low|medium|high|xhigh|max|ultra))?$/
|
||||
);
|
||||
if (!match) return undefined;
|
||||
// The live catalog defaults GPT-5.6 Sol to low and every other model here to medium.
|
||||
|
||||
@@ -41,7 +41,7 @@ export function extendCodexGpt56EffortValues(
|
||||
}
|
||||
|
||||
const match = normalizedModel.match(
|
||||
/^gpt-(?:5\.6-(sol|terra|luna)|6(?:\.1)?-(astra|sol|luna))(?:-(?:none|low|medium|high|xhigh|max|ultra))?$/
|
||||
/^gpt-(?:5\.6-(sol|terra|luna)|6(?:\.1)?-(astra|sol|terra|luna))(?:-(?:none|low|medium|high|xhigh|max|ultra))?$/
|
||||
);
|
||||
if (!match) return values;
|
||||
|
||||
|
||||
@@ -14,6 +14,11 @@ import { extendCodexGpt56EffortValues } from "../../src/shared/reasoning/effortS
|
||||
import { isCodexExtendedEffortBaseModel } from "../../src/shared/reasoning/codexExtendedEffort.ts";
|
||||
import * as reasoningMetadata from "../../src/lib/vscode/reasoningMetadata.ts";
|
||||
import { supportsVscodeServiceTierVariants } from "../../src/lib/vscode/serviceTierVariants.ts";
|
||||
import {
|
||||
getResolvedModelCapabilitiesWithLimitSources,
|
||||
type ModelCapabilityResolutionSnapshot,
|
||||
} from "../../src/lib/modelCapabilities.ts";
|
||||
import { enrichCatalogModelEntry } from "../../src/lib/modelMetadataRegistry.ts";
|
||||
|
||||
const MODEL = "gpt-6.1-sol";
|
||||
const EFFORTS = ["low", "medium", "high", "xhigh", "max", "ultra"];
|
||||
@@ -175,3 +180,69 @@ test("Responses Lite keeps delegation for GPT-6.1 Sol ultra only", async () => {
|
||||
assert.equal(captured[0].parallel_tool_calls, effort === "ultra");
|
||||
}
|
||||
});
|
||||
|
||||
test("#20437 codex/gpt-6.1-sol retains 872k Codex window even when synced models.dev carries 1,050,000 API limit", () => {
|
||||
const syncedRow = {
|
||||
tool_call: true,
|
||||
reasoning: true,
|
||||
attachment: true,
|
||||
structured_output: true,
|
||||
temperature: null,
|
||||
modalities_input: JSON.stringify(["text", "image"]),
|
||||
modalities_output: JSON.stringify(["text"]),
|
||||
knowledge_cutoff: null,
|
||||
release_date: null,
|
||||
last_updated: null,
|
||||
status: "stable",
|
||||
family: "gpt-6",
|
||||
open_weights: false,
|
||||
limit_context: 1_050_000,
|
||||
limit_input: 922_000,
|
||||
limit_output: 128_000,
|
||||
interleaved_field: null,
|
||||
};
|
||||
const snapshot: ModelCapabilityResolutionSnapshot = {
|
||||
inputModalities: new Map(),
|
||||
synced: {
|
||||
openai: { [MODEL]: syncedRow },
|
||||
cx: { [MODEL]: syncedRow },
|
||||
},
|
||||
maxTokenOverrides: new Map(),
|
||||
maxInputTokenOverrides: new Map(),
|
||||
reasoningEffortsOverrides: new Map(),
|
||||
contextOverrides: new Map(),
|
||||
customVisionOverrides: new Map(),
|
||||
compatVisionOverrides: new Map(),
|
||||
syncedAvailableModelVision: new Map(),
|
||||
};
|
||||
|
||||
const codexCaps = getResolvedModelCapabilitiesWithLimitSources(`codex/${MODEL}`, snapshot);
|
||||
assert.equal(codexCaps.capabilities.contextWindow, 872_000);
|
||||
assert.equal(codexCaps.capabilities.maxInputTokens, 872_000);
|
||||
assert.equal(codexCaps.limitSources.contextWindow, `registry:codex/${MODEL}`);
|
||||
|
||||
const openaiCaps = getResolvedModelCapabilitiesWithLimitSources(`openai/${MODEL}`, snapshot);
|
||||
assert.equal(openaiCaps.capabilities.contextWindow, 1_050_000);
|
||||
|
||||
const enrichedCodex = enrichCatalogModelEntry(
|
||||
{ id: `codex/${MODEL}`, owned_by: "codex", root: MODEL },
|
||||
undefined,
|
||||
{
|
||||
modelsDevPricing: {},
|
||||
userPricing: {},
|
||||
capabilityResolutionSnapshot: snapshot,
|
||||
}
|
||||
);
|
||||
assert.equal(enrichedCodex.context_length, 872_000);
|
||||
|
||||
assert.deepEqual(
|
||||
extendCodexGpt56EffortValues("codex", "gpt-6.1-terra", [
|
||||
"low",
|
||||
"medium",
|
||||
"high",
|
||||
"xhigh",
|
||||
"max",
|
||||
]),
|
||||
EFFORTS
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user