feat: add xhigh reasoning effort for gpt-5.1-codex-max (#9900)

* feat: add xhigh reasoning effort for gpt-5.1-codex-max

* fix: Address openai-native.spec.ts test failure

* chore: Localisation of 'Extra high'

* chore: revert unrelated CustomModesManager refactoring

---------

Co-authored-by: Hannes Rudolph <hrudolph@gmail.com>
This commit is contained in:
Andrew Ginns 2025-12-08 18:17:25 +00:00 committed by GitHub
parent 1370cb04f7
commit efbf427631
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 63 additions and 5 deletions

View file

@ -22,7 +22,7 @@ export type ReasoningEffortWithMinimal = z.infer<typeof reasoningEffortWithMinim
* Extended Reasoning Effort (includes "none" and "minimal")
* Note: "disable" is a UI/control value, not a value sent as effort
*/
export const reasoningEffortsExtended = ["none", "minimal", "low", "medium", "high"] as const
export const reasoningEffortsExtended = ["none", "minimal", "low", "medium", "high", "xhigh"] as const
export const reasoningEffortExtendedSchema = z.enum(reasoningEffortsExtended)
@ -31,7 +31,7 @@ export type ReasoningEffortExtended = z.infer<typeof reasoningEffortExtendedSche
/**
* Reasoning Effort user setting (includes "disable")
*/
export const reasoningEffortSettingValues = ["disable", "none", "minimal", "low", "medium", "high"] as const
export const reasoningEffortSettingValues = ["disable", "none", "minimal", "low", "medium", "high", "xhigh"] as const
export const reasoningEffortSettingSchema = z.enum(reasoningEffortSettingValues)
/**
@ -88,7 +88,7 @@ export const modelInfoSchema = z.object({
defaultTemperature: z.number().optional(),
requiredReasoningBudget: z.boolean().optional(),
supportsReasoningEffort: z
.union([z.boolean(), z.array(z.enum(["disable", "none", "minimal", "low", "medium", "high"]))])
.union([z.boolean(), z.array(z.enum(["disable", "none", "minimal", "low", "medium", "high", "xhigh"]))])
.optional(),
requiredReasoningEffort: z.boolean().optional(),
preserveReasoning: z.boolean().optional(),

View file

@ -15,7 +15,7 @@ export const openAiNativeModels = {
supportsImages: true,
supportsPromptCache: true,
promptCacheRetention: "24h",
supportsReasoningEffort: ["low", "medium", "high"],
supportsReasoningEffort: ["low", "medium", "high", "xhigh"],
reasoningEffort: "medium",
inputPrice: 1.25,
outputPrice: 10.0,

View file

@ -464,6 +464,46 @@ describe("OpenAiNativeHandler", () => {
)
})
it("should support xhigh reasoning effort for GPT-5.1 Codex Max", async () => {
// Mock fetch for Responses API
const mockFetch = vitest.fn().mockResolvedValue({
ok: true,
body: new ReadableStream({
start(controller) {
controller.enqueue(
new TextEncoder().encode(
'data: {"type":"response.output_item.added","item":{"type":"text","text":"XHigh effort"}}\n\n',
),
)
controller.enqueue(new TextEncoder().encode("data: [DONE]\n\n"))
controller.close()
},
}),
})
global.fetch = mockFetch as any
// Mock SDK to fail
mockResponsesCreate.mockRejectedValue(new Error("SDK not available"))
handler = new OpenAiNativeHandler({
...mockOptions,
apiModelId: "gpt-5.1-codex-max",
reasoningEffort: "xhigh",
})
const stream = handler.createMessage(systemPrompt, messages)
for await (const _chunk of stream) {
// drain
}
expect(mockFetch).toHaveBeenCalledWith(
"https://api.openai.com/v1/responses",
expect.objectContaining({
body: expect.stringContaining('"effort":"xhigh"'),
}),
)
})
it("should omit reasoning when selection is 'disable'", async () => {
// Mock fetch for Responses API
const mockFetch = vitest.fn().mockResolvedValue({

View file

@ -506,6 +506,7 @@
"none": "Cap",
"minimal": "Mínim (el més ràpid)",
"high": "Alt",
"xhigh": "Molt alt",
"medium": "Mitjà",
"low": "Baix"
},

View file

@ -506,6 +506,7 @@
"none": "Keine",
"minimal": "Minimal (schnellste)",
"high": "Hoch",
"xhigh": "Sehr hoch",
"medium": "Mittel",
"low": "Niedrig"
},

View file

@ -512,7 +512,8 @@
"minimal": "Minimal (Fastest)",
"low": "Low",
"medium": "Medium",
"high": "High"
"high": "High",
"xhigh": "Extra High"
},
"verbosity": {
"label": "Output Verbosity",

View file

@ -506,6 +506,7 @@
"none": "Ninguno",
"minimal": "Mínimo (el más rápido)",
"high": "Alto",
"xhigh": "Muy alto",
"medium": "Medio",
"low": "Bajo"
},

View file

@ -506,6 +506,7 @@
"none": "Aucun",
"minimal": "Minimal (le plus rapide)",
"high": "Élevé",
"xhigh": "Très élevé",
"medium": "Moyen",
"low": "Faible"
},

View file

@ -506,6 +506,7 @@
"none": "कोई नहीं",
"minimal": "न्यूनतम (सबसे तेज़)",
"high": "उच्च",
"xhigh": "बहुत उच्च",
"medium": "मध्यम",
"low": "निम्न"
},

View file

@ -510,6 +510,7 @@
"none": "Tidak Ada",
"minimal": "Minimal (Tercepat)",
"high": "Tinggi",
"xhigh": "Sangat tinggi",
"medium": "Sedang",
"low": "Rendah"
},

View file

@ -506,6 +506,7 @@
"none": "Nessuno",
"minimal": "Minimo (più veloce)",
"high": "Alto",
"xhigh": "Molto alto",
"medium": "Medio",
"low": "Basso"
},

View file

@ -506,6 +506,7 @@
"none": "なし",
"minimal": "最小 (最速)",
"high": "高",
"xhigh": "非常に高い",
"medium": "中",
"low": "低"
},

View file

@ -506,6 +506,7 @@
"none": "없음",
"minimal": "최소 (가장 빠름)",
"high": "높음",
"xhigh": "매우 높음",
"medium": "중간",
"low": "낮음"
},

View file

@ -506,6 +506,7 @@
"none": "Geen",
"minimal": "Minimaal (Snelst)",
"high": "Hoog",
"xhigh": "Zeer hoog",
"medium": "Middel",
"low": "Laag"
},

View file

@ -506,6 +506,7 @@
"none": "Brak",
"minimal": "Minimalny (najszybszy)",
"high": "Wysoki",
"xhigh": "Bardzo wysoki",
"medium": "Średni",
"low": "Niski"
},

View file

@ -506,6 +506,7 @@
"none": "Nenhum",
"minimal": "Mínimo (mais rápido)",
"high": "Alto",
"xhigh": "Muito alto",
"medium": "Médio",
"low": "Baixo"
},

View file

@ -506,6 +506,7 @@
"none": "Нет",
"minimal": "Минимальный (самый быстрый)",
"high": "Высокие",
"xhigh": "Очень высокие",
"medium": "Средние",
"low": "Низкие"
},

View file

@ -506,6 +506,7 @@
"none": "Yok",
"minimal": "Minimal (en hızlı)",
"high": "Yüksek",
"xhigh": "Çok yüksek",
"medium": "Orta",
"low": "Düşük"
},

View file

@ -506,6 +506,7 @@
"none": "Không",
"minimal": "Tối thiểu (nhanh nhất)",
"high": "Cao",
"xhigh": "Rất cao",
"medium": "Trung bình",
"low": "Thấp"
},

View file

@ -506,6 +506,7 @@
"none": "无",
"minimal": "最小 (最快)",
"high": "高",
"xhigh": "超高",
"medium": "中",
"low": "低"
},

View file

@ -506,6 +506,7 @@
"none": "無",
"minimal": "最小 (最快)",
"high": "高",
"xhigh": "超高",
"medium": "中",
"low": "低"
},