Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions packages/types/src/providers/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,32 @@ export const openAiNativeModels = {
description:
"GPT-5.1 Codex Max: Our most intelligent coding model optimized for long-horizon, agentic coding tasks",
},
"gpt-5.5": {
maxTokens: 128000,
contextWindow: 1_050_000,
includedTools: ["apply_patch"],
excludedTools: ["apply_diff", "write_to_file"],
supportsImages: true,
supportsPromptCache: true,
supportsReasoningEffort: ["none", "low", "medium", "high", "xhigh"],
reasoningEffort: "none",
Comment thread
edelauna marked this conversation as resolved.
Outdated
inputPrice: 5.0,
outputPrice: 30.0,
cacheReadsPrice: 0.5,
longContextPricing: {
thresholdTokens: 272_000,
inputPriceMultiplier: 2,
outputPriceMultiplier: 1.5,
appliesToServiceTiers: ["default", "flex"],
},
supportsVerbosity: true,
supportsTemperature: false,
tiers: [
{ name: "flex", contextWindow: 1_050_000, inputPrice: 2.5, outputPrice: 15.0, cacheReadsPrice: 0.25 },
{ name: "priority", contextWindow: 1_050_000, inputPrice: 12.5, outputPrice: 75.0, cacheReadsPrice: 1.25 },
],
description: "GPT-5.5: A new class of intelligence for coding and professional work",
},
"gpt-5.4": {
maxTokens: 128000,
contextWindow: 1_050_000,
Expand Down
65 changes: 65 additions & 0 deletions src/api/providers/__tests__/openai-native.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,21 @@ describe("OpenAiNativeHandler", () => {
expect(modelInfo.info.supportsReasoningEffort).toEqual(["low", "medium", "high", "xhigh"])
})

it("should return GPT-5.5 model info when selected", () => {
const gpt54Handler = new OpenAiNativeHandler({
Comment thread
edelauna marked this conversation as resolved.
Outdated
...mockOptions,
apiModelId: "gpt-5.5",
})

const modelInfo = gpt54Handler.getModel()
Comment thread
edelauna marked this conversation as resolved.
Outdated
expect(modelInfo.id).toBe("gpt-5.5")
expect(modelInfo.info.maxTokens).toBe(128000)
expect(modelInfo.info.contextWindow).toBe(1_050_000)
expect(modelInfo.info.supportsVerbosity).toBe(true)
expect(modelInfo.info.supportsReasoningEffort).toEqual(["none", "low", "medium", "high", "xhigh"])
expect(modelInfo.info.reasoningEffort).toBe("none")
Comment thread
edelauna marked this conversation as resolved.
Outdated
})

it("should return GPT-5.4 model info when selected", () => {
const gpt54Handler = new OpenAiNativeHandler({
...mockOptions,
Expand Down Expand Up @@ -430,6 +445,56 @@ describe("OpenAiNativeHandler", () => {
expect(textChunks[1].text).toBe(" world")
})

it("should handle GPT-5.5 model with Responses API", async () => {
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":"GPT-5.5 reply"}}\n\n',
),
)
controller.enqueue(new TextEncoder().encode("data: [DONE]\n\n"))
controller.close()
},
}),
})
global.fetch = mockFetch as any

mockResponsesCreate.mockRejectedValue(new Error("SDK not available"))

handler = new OpenAiNativeHandler({
...mockOptions,
apiModelId: "gpt-5.5",
})

const stream = handler.createMessage(systemPrompt, messages)
const chunks: any[] = []
for await (const chunk of stream) {
chunks.push(chunk)
}

expect(mockFetch).toHaveBeenCalledWith(
"https://api.openai.com/v1/responses",
expect.objectContaining({
body: expect.any(String),
}),
)
const body = (mockFetch.mock.calls[0][1] as any).body as string
const parsedBody = JSON.parse(body)
expect(parsedBody.model).toBe("gpt-5.5")
expect(parsedBody.max_output_tokens).toBe(128000)
expect(parsedBody.temperature).toBeUndefined()
expect(parsedBody.include).toEqual(["reasoning.encrypted_content"])
expect(parsedBody.reasoning?.effort).toBe("none")
Comment thread
edelauna marked this conversation as resolved.
Outdated
expect(parsedBody.text?.verbosity).toBe("medium")

const textChunks = chunks.filter((chunk) => chunk.type === "text")
expect(textChunks).toHaveLength(1)
expect(textChunks[0].text).toBe("GPT-5.5 reply")
})

it("should handle GPT-5.4 model with Responses API", async () => {
const mockFetch = vitest.fn().mockResolvedValue({
ok: true,
Expand Down
Loading