Files
OmniRoute/open-sse/executors/chatgpt-web-codex/models.ts
backryun 8d388912a7 feat(providers): refresh vendored ChatGPT Web connector to v4.0.7 (#12181)
Refresh the existing MIT-licensed miuuyy/codex-chatgpt-web vendor snapshot and its OmniRoute integration as one reviewable change.

Co-authored-by: backryun <backryun@daonlab.local>
2026-09-01 00:50:15 -03:00

46 lines
1.7 KiB
TypeScript

export type ChatGptWebCodexEffort = "low" | "medium" | "high" | "xhigh" | "max";
export interface ChatGptWebCodexModelRoute {
id: string;
backendModel: "gpt-5.6-sol" | "gpt-5.6-luna";
effort: ChatGptWebCodexEffort;
pro: boolean;
sol: boolean;
}
const ROUTES = new Map<string, ChatGptWebCodexModelRoute>([
["luna", { id: "luna", backendModel: "gpt-5.6-luna", effort: "low", pro: false, sol: false }],
[
"think",
{ id: "think", backendModel: "gpt-5.6-luna", effort: "medium", pro: false, sol: false },
],
["instant", { id: "instant", backendModel: "gpt-5.6-sol", effort: "low", pro: false, sol: true }],
[
"medium",
{ id: "medium", backendModel: "gpt-5.6-sol", effort: "medium", pro: false, sol: true },
],
["high", { id: "high", backendModel: "gpt-5.6-sol", effort: "high", pro: false, sol: true }],
[
"extra-high",
{ id: "extra-high", backendModel: "gpt-5.6-sol", effort: "xhigh", pro: true, sol: true },
],
["pro", { id: "pro", backendModel: "gpt-5.6-sol", effort: "max", pro: true, sol: true }],
]);
export function requireChatGptWebCodexRoute(model: string): ChatGptWebCodexModelRoute {
const normalized = model.replace(/^chatgpt-web-codex\//, "");
const route = ROUTES.get(normalized);
if (!route) throw new Error(`Unsupported ChatGPT Web (Codex) model: ${model}`);
return route;
}
export function reasoningEffortOf(body: Record<string, unknown>): string | undefined {
const reasoning = body.reasoning;
if (reasoning && typeof reasoning === "object" && !Array.isArray(reasoning)) {
const effort = (reasoning as Record<string, unknown>).effort;
return typeof effort === "string" ? effort : undefined;
}
const effort = body.reasoning_effort;
return typeof effort === "string" ? effort : undefined;
}