fix(ai): use 500K context window for Codex GPT-6.1 Sol

The Codex models endpoint now returns context_window=500000 for
gpt-6.1-sol; other Codex models still return 272000.

fixes #10840
This commit is contained in:
David Brailovsky 2026-10-14 15:19:01 +02:00
parent 381a2d8eb6
commit 5712b134ed
3 changed files with 10 additions and 6 deletions

View file

@ -20,6 +20,7 @@
- Fixed OpenAI-compatible responses showing thinking after the answer when a proxy such as LiteLLM sends reasoning and content in the same stream chunk ([#10926](https://github.com/earendil-works/pi/issues/10926))
- Fixed Gemini 4 Argon requests on Google Vertex failing with "Thinking budget is not supported", and its thinking level being ignored on the Gemini API, by sending `thinkingLevel` for Gemini 4 and later models ([#10890](https://github.com/earendil-works/pi/issues/10890))
- Fixed Xiaomi MiMo models failing with a 400 at the `minimal` thinking level by sending only the documented thinking on/off toggle and exposing only the `off` and `high` levels ([#10818](https://github.com/earendil-works/pi/issues/10818))
- Fixed `openai-codex/gpt-6.1-sol` using a 272K context window instead of the 500K window Codex now provides ([#10840](https://github.com/earendil-works/pi/issues/10840))
## [1.2.0] - 2026-10-12

View file

@ -3129,8 +3129,10 @@ async function generateModels() {
// OpenAI Codex (ChatGPT OAuth) models
// NOTE: These are not fetched from models.dev; we keep a small, explicit list to avoid aliases.
// Older model limits are based on observed server behavior; GPT-5.6 and GPT-6 use Codex's 272k default catalog limit.
// GPT-6.1 Sol uses the 500k default returned by /backend-api/codex/models.
const CODEX_BASE_URL = "https://chatgpt.com/backend-api";
const CODEX_CONTEXT = 272000;
const CODEX_GPT_61_SOL_CONTEXT = 500000;
const CODEX_GPT_56_CONTEXT = 272000;
const CODEX_SPARK_CONTEXT = 128000;
const CODEX_MAX_TOKENS = 128000;
@ -3144,7 +3146,7 @@ async function generateModels() {
reasoning: true,
input: ["text", "image"],
cost: withOpenAiLongContextPricing(OPENAI_STANDARD_COSTS["gpt-6.1-sol"]),
contextWindow: CODEX_CONTEXT,
contextWindow: CODEX_GPT_61_SOL_CONTEXT,
maxTokens: CODEX_MAX_TOKENS,
},
{

View file

@ -125,10 +125,11 @@ describe("getSupportedThinkingLevels", () => {
});
it.each([
["gpt-6-sol", { input: 2, output: 10, cacheRead: 0.2, cacheWrite: 2.5 }],
["gpt-6-luna", { input: 0.1, output: 0.5, cacheRead: 0.01, cacheWrite: 0.125 }],
["gpt-6.1-sol", { input: 2, output: 10, cacheRead: 0.1, cacheWrite: 2.5 }],
] as const)("includes official metadata for OpenAI and Codex %s", (modelId, cost) => {
["gpt-6-sol", { input: 2, output: 10, cacheRead: 0.2, cacheWrite: 2.5 }, 272000],
["gpt-6-luna", { input: 0.1, output: 0.5, cacheRead: 0.01, cacheWrite: 0.125 }, 272000],
// Codex serves GPT-6.1 Sol with a 500K default context window (#10840)
["gpt-6.1-sol", { input: 2, output: 10, cacheRead: 0.1, cacheWrite: 2.5 }, 500000],
] as const)("includes official metadata for OpenAI and Codex %s", (modelId, cost, codexContextWindow) => {
for (const provider of ["openai", "openai-codex"] as const) {
const model = getModel(provider, modelId);
expect(model).toMatchObject({
@ -145,7 +146,7 @@ describe("getSupportedThinkingLevels", () => {
},
],
},
contextWindow: 272000,
contextWindow: provider === "openai-codex" ? codexContextWindow : 272000,
maxTokens: 128000,
compat: {
supportsAdditionalTools: true,