Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions open-sse/config/providerModels.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const PROVIDER_MODELS = {
{ id: "gpt-5-codex", name: "GPT 5 Codex" },
{ id: "gpt-5-codex-mini", name: "GPT 5 Codex Mini" },
// Image models (uses image_generation tool, requires Plus/Pro plan)
{ id: "gpt-5.5-image", name: "GPT 5.5 Image", type: "image", capabilities: ["text2img", "edit"], params: ["size", "quality", "background", "image_detail", "output_format"] },
{ id: "gpt-5.4-image", name: "GPT 5.4 Image", type: "image", capabilities: ["text2img", "edit"], params: ["size", "quality", "background", "image_detail", "output_format"] },
{ id: "gpt-5.3-image", name: "GPT 5.3 Image", type: "image", capabilities: ["text2img", "edit"], params: ["size", "quality", "background", "image_detail", "output_format"] },
{ id: "gpt-5.2-image", name: "GPT 5.2 Image", type: "image", capabilities: ["text2img", "edit"], params: ["size", "quality", "background", "image_detail", "output_format"] },
Expand Down
2 changes: 1 addition & 1 deletion open-sse/handlers/imageProviders/codex.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { nowSec } from "./_base.js";

const CODEX_RESPONSES_URL = "https://chatgpt.com/backend-api/codex/responses";
const CODEX_USER_AGENT = "codex-imagen/0.2.6";
const CODEX_VERSION = "0.122.0";
const CODEX_VERSION = "0.129.0";
const CODEX_ORIGINATOR = "codex_cli_rs";
const CODEX_MODEL_SUFFIX = "-image";
const CODEX_REF_DETAIL = "high";
Expand Down
51 changes: 51 additions & 0 deletions tests/unit/image-generation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,57 @@ describe("handleImageGenerationCore", () => {
expect(responseBody.data[0].b64_json).toBeTruthy();
});

it("generates image with Codex gpt-5.5-image using current Codex version header", async () => {
global.fetch.mockResolvedValueOnce(
new Response(
[
"event: response.output_item.done",
'data: {"item":{"type":"image_generation_call","result":"base64codeximage"}}',
"",
"",
].join("\n"),
{ status: 200, headers: { "Content-Type": "text/event-stream" } }
)
);

const result = await handleImageGenerationCore({
body: {
prompt: "A green square",
size: "1024x1024",
output_format: "png",
},
modelInfo: { provider: "codex", model: "gpt-5.5-image" },
credentials: {
accessToken: "codex-token",
providerSpecificData: { chatgptAccountId: "account-123" },
},
log: null,
});

expect(result.success).toBe(true);
expect(global.fetch).toHaveBeenCalledWith(
"https://chatgpt.com/backend-api/codex/responses",
expect.objectContaining({
method: "POST",
headers: expect.objectContaining({
authorization: "Bearer codex-token",
"chatgpt-account-id": "account-123",
version: "0.129.0",
}),
})
);

const fetchCall = global.fetch.mock.calls[0];
const requestBody = JSON.parse(fetchCall[1].body);
expect(requestBody.model).toBe("gpt-5.5");
expect(requestBody.tools).toEqual([
{ type: "image_generation", output_format: "png", size: "1024x1024" },
]);

const responseBody = await result.response.json();
expect(responseBody.data[0].b64_json).toBe("base64codeximage");
});

it("generates image with Cloudflare Workers AI JSON response", async () => {
global.fetch.mockResolvedValueOnce(
new Response(
Expand Down