-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Expand file tree
/
Copy pathopenai-codex.spec.ts
More file actions
51 lines (42 loc) · 1.71 KB
/
openai-codex.spec.ts
File metadata and controls
51 lines (42 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// npx vitest run api/providers/__tests__/openai-codex.spec.ts
import { OpenAiCodexHandler } from "../openai-codex"
describe("OpenAiCodexHandler.getModel", () => {
it.each([
"gpt-5.1",
"gpt-5",
"gpt-5.1-codex",
"gpt-5-codex",
"gpt-5-codex-mini",
"gpt-5.3-codex-spark",
])("should return specified model when a valid model id is provided: %s", (apiModelId) => {
const handler = new OpenAiCodexHandler({ apiModelId })
const model = handler.getModel()
expect(model.id).toBe(apiModelId)
expect(model.info).toBeDefined()
// Default reasoning effort for GPT-5 family
expect(model.info.reasoningEffort).toBe("medium")
})
it("should fall back to default model when an invalid model id is provided", () => {
const handler = new OpenAiCodexHandler({ apiModelId: "not-a-real-model" })
const model = handler.getModel()
expect(model.id).toBe("gpt-5.4")
expect(model.info).toBeDefined()
})
it("should use GPT-5.4 with thinking/non-thinking reasoning effort levels", () => {
const handler = new OpenAiCodexHandler({ apiModelId: "gpt-5.4" })
const model = handler.getModel()
expect(model.id).toBe("gpt-5.4")
expect(model.info.contextWindow).toBe(1_050_000)
expect(model.info.supportsReasoningEffort).toContain("none")
expect(model.info.supportsReasoningEffort).toContain("xhigh")
expect(model.info.reasoningEffort).toBe("none")
})
it("should use Spark-specific limits and capabilities", () => {
const handler = new OpenAiCodexHandler({ apiModelId: "gpt-5.3-codex-spark" })
const model = handler.getModel()
expect(model.id).toBe("gpt-5.3-codex-spark")
expect(model.info.contextWindow).toBe(128000)
expect(model.info.maxTokens).toBe(8192)
expect(model.info.supportsImages).toBe(false)
})
})