Skip to content
Open
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
3 changes: 3 additions & 0 deletions open-sse/config/codexConstants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Keep model discovery and image requests on the same client version. GPT-5.6
// models require >= 0.144.0 in openai/codex's models-manager/models.json.
export const CODEX_CLIENT_VERSION = "0.144.6";
7 changes: 3 additions & 4 deletions open-sse/handlers/imageProviders/codex.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
import { randomUUID } from "node:crypto";
import { nowSec } from "./_base.js";
import { PROVIDERS } from "../../config/providers.js";
import { CODEX_CLIENT_VERSION } from "../../config/codexConstants.js";

const CODEX_RESPONSES_URL = PROVIDERS["codex"].baseUrl;
const CODEX_USER_AGENT = "codex_cli_rs/0.136.0";
const CODEX_VERSION = "0.136.0";
const CODEX_ORIGINATOR = "codex_cli_rs";
const CODEX_MODEL_SUFFIX = "-image";
const CODEX_REF_DETAIL = "high";
Expand Down Expand Up @@ -156,8 +155,8 @@ export default {
"content-type": "application/json",
"originator": CODEX_ORIGINATOR,
"session_id": randomUUID(),
"user-agent": CODEX_USER_AGENT,
"version": CODEX_VERSION,
"user-agent": `${CODEX_ORIGINATOR}/${CODEX_CLIENT_VERSION}`,
"version": CODEX_CLIENT_VERSION,
"x-client-request-id": randomUUID(),
};
},
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/providers/[id]/models/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import { resolveQoderModels } from "open-sse/services/qoderModels.js";
import { resolveGrokCliModels } from "open-sse/services/grokCliModels.js";
import { resolveConnectionProxyConfig } from "@/lib/network/connectionProxy";
import { resolveCursorModels } from "open-sse/services/cursorModels.js";
import { CODEX_CLIENT_VERSION } from "open-sse/config/codexConstants.js";

const GEMINI_CLI_MODELS_URL = "https://cloudcode-pa.googleapis.com/v1internal:fetchAvailableModels";

// The /codex/models endpoint gates each entry by minimal_client_version against this
// value, and codex CLI's own manifest (openai/codex codex-rs/models-manager/models.json)
// already requires 0.144.0 for its newest models, so a stale client_version here comes
// back 200 with those entries quietly missing instead of erroring.
const CODEX_CLIENT_VERSION = "0.144.6";
const CODEX_MODELS_URL = `https://chatgpt.com/backend-api/codex/models?client_version=${CODEX_CLIENT_VERSION}`;

const parseOpenAIStyleModels = (data) => {
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/image-generation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,8 @@ describe("handleImageGenerationCore", () => {
headers: expect.objectContaining({
authorization: "Bearer codex-token",
"chatgpt-account-id": "account-123",
version: "0.136.0",
version: "0.144.6",
"user-agent": "codex_cli_rs/0.144.6",
}),
})
);
Expand Down