Skip to content

Commit de4076e

Browse files
scream4ikedelauna
authored andcommitted
feat: add gpt-5.5 support (Zoo-Code-Org#537)
* feat: add gpt-5.5 support * Update openai.ts * Update openai-native.spec.ts * Update openai-native.spec.ts * Update openai-native.spec.ts * Update openai-native.spec.ts --------- Co-authored-by: edelauna <54631123+edelauna@users.noreply.github.com>
1 parent 1e811b2 commit de4076e

2 files changed

Lines changed: 91 additions & 0 deletions

File tree

packages/types/src/providers/openai.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,32 @@ export const openAiNativeModels = {
2424
description:
2525
"GPT-5.1 Codex Max: Our most intelligent coding model optimized for long-horizon, agentic coding tasks",
2626
},
27+
"gpt-5.5": {
28+
maxTokens: 128000,
29+
contextWindow: 1_050_000,
30+
includedTools: ["apply_patch"],
31+
excludedTools: ["apply_diff", "write_to_file"],
32+
supportsImages: true,
33+
supportsPromptCache: true,
34+
supportsReasoningEffort: ["none", "low", "medium", "high", "xhigh"],
35+
reasoningEffort: "medium",
36+
inputPrice: 5.0,
37+
outputPrice: 30.0,
38+
cacheReadsPrice: 0.5,
39+
longContextPricing: {
40+
thresholdTokens: 272_000,
41+
inputPriceMultiplier: 2,
42+
outputPriceMultiplier: 1.5,
43+
appliesToServiceTiers: ["default", "flex"],
44+
},
45+
supportsVerbosity: true,
46+
supportsTemperature: false,
47+
tiers: [
48+
{ name: "flex", contextWindow: 1_050_000, inputPrice: 2.5, outputPrice: 15.0, cacheReadsPrice: 0.25 },
49+
{ name: "priority", contextWindow: 1_050_000, inputPrice: 12.5, outputPrice: 75.0, cacheReadsPrice: 1.25 },
50+
],
51+
description: "GPT-5.5: A new class of intelligence for coding and professional work",
52+
},
2753
"gpt-5.4": {
2854
maxTokens: 128000,
2955
contextWindow: 1_050_000,

src/api/providers/__tests__/openai-native.spec.ts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,21 @@ describe("OpenAiNativeHandler", () => {
267267
expect(modelInfo.info.supportsReasoningEffort).toEqual(["low", "medium", "high", "xhigh"])
268268
})
269269

270+
it("should return GPT-5.5 model info when selected", () => {
271+
const gpt55Handler = new OpenAiNativeHandler({
272+
...mockOptions,
273+
apiModelId: "gpt-5.5",
274+
})
275+
276+
const modelInfo = gpt55Handler.getModel()
277+
expect(modelInfo.id).toBe("gpt-5.5")
278+
expect(modelInfo.info.maxTokens).toBe(128000)
279+
expect(modelInfo.info.contextWindow).toBe(1_050_000)
280+
expect(modelInfo.info.supportsVerbosity).toBe(true)
281+
expect(modelInfo.info.supportsReasoningEffort).toEqual(["none", "low", "medium", "high", "xhigh"])
282+
expect(modelInfo.info.reasoningEffort).toBe("medium")
283+
})
284+
270285
it("should return GPT-5.4 model info when selected", () => {
271286
const gpt54Handler = new OpenAiNativeHandler({
272287
...mockOptions,
@@ -430,6 +445,56 @@ describe("OpenAiNativeHandler", () => {
430445
expect(textChunks[1].text).toBe(" world")
431446
})
432447

448+
it("should handle GPT-5.5 model with Responses API", async () => {
449+
const mockFetch = vitest.fn().mockResolvedValue({
450+
ok: true,
451+
body: new ReadableStream({
452+
start(controller) {
453+
controller.enqueue(
454+
new TextEncoder().encode(
455+
'data: {"type":"response.output_item.added","item":{"type":"text","text":"GPT-5.5 reply"}}\n\n',
456+
),
457+
)
458+
controller.enqueue(new TextEncoder().encode("data: [DONE]\n\n"))
459+
controller.close()
460+
},
461+
}),
462+
})
463+
global.fetch = mockFetch as any
464+
465+
mockResponsesCreate.mockRejectedValue(new Error("SDK not available"))
466+
467+
handler = new OpenAiNativeHandler({
468+
...mockOptions,
469+
apiModelId: "gpt-5.5",
470+
})
471+
472+
const stream = handler.createMessage(systemPrompt, messages)
473+
const chunks: any[] = []
474+
for await (const chunk of stream) {
475+
chunks.push(chunk)
476+
}
477+
478+
expect(mockFetch).toHaveBeenCalledWith(
479+
"https://api.openai.com/v1/responses",
480+
expect.objectContaining({
481+
body: expect.any(String),
482+
}),
483+
)
484+
const body = (mockFetch.mock.calls[0][1] as any).body as string
485+
const parsedBody = JSON.parse(body)
486+
expect(parsedBody.model).toBe("gpt-5.5")
487+
expect(parsedBody.max_output_tokens).toBe(128000)
488+
expect(parsedBody.temperature).toBeUndefined()
489+
expect(parsedBody.include).toEqual(["reasoning.encrypted_content"])
490+
expect(parsedBody.reasoning?.effort).toBe("medium")
491+
expect(parsedBody.text?.verbosity).toBe("medium")
492+
493+
const textChunks = chunks.filter((chunk) => chunk.type === "text")
494+
expect(textChunks).toHaveLength(1)
495+
expect(textChunks[0].text).toBe("GPT-5.5 reply")
496+
})
497+
433498
it("should handle GPT-5.4 model with Responses API", async () => {
434499
const mockFetch = vitest.fn().mockResolvedValue({
435500
ok: true,

0 commit comments

Comments
 (0)