feat(providers): add chatgpt-session model route table

This commit is contained in:
Markus Hartung
2026-09-02 01:25:34 -03:00
parent 6b4519c317
commit baa45e9a67
2 changed files with 95 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
/**
* Public model routes for the ChatGPT Session provider.
*
* Each public slug pins one backend model plus one reasoning effort. The vendored browser
* adapter accepts only the two backend ids and reads the effort from
* `CodexParsedRequest.options.reasoning`, so the slug is the only knob a client turns.
*/
export type ChatGptSessionEffort = "low" | "medium" | "high" | "xhigh" | "max";
export interface ChatGptSessionRoute {
id: string;
backendModel: "gpt-5.6-sol" | "gpt-5.6-luna";
effort: ChatGptSessionEffort;
/** Requires an account whose browser probe reported Pro. */
pro: boolean;
/** Requires the Sol model selector; Luna-only accounts get the luna/think routes. */
sol: boolean;
}
const ROUTES: ReadonlyMap<string, ChatGptSessionRoute> = new Map([
["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 }],
] as const);
export const CHATGPT_SESSION_ROUTE_IDS: readonly string[] = [...ROUTES.keys()];
export function requireChatGptSessionRoute(model: string): ChatGptSessionRoute {
const normalized = model.trim().replace(/^(?:chatgpt-session|cgpt-session)\//, "");
const route = ROUTES.get(normalized);
if (!route) throw new Error(`Unsupported ChatGPT Session model: ${model}`);
return route;
}

View File

@@ -0,0 +1,48 @@
import { test } from "node:test";
import assert from "node:assert/strict";
import {
CHATGPT_SESSION_ROUTE_IDS,
requireChatGptSessionRoute,
} from "../../open-sse/executors/chatgpt-session/models.ts";
test("exposes the seven public routes", () => {
assert.deepEqual(
[...CHATGPT_SESSION_ROUTE_IDS],
["luna", "think", "instant", "medium", "high", "extra-high", "pro"]
);
});
test("maps a slug to its backend model and effort", () => {
assert.deepEqual(requireChatGptSessionRoute("high"), {
id: "high",
backendModel: "gpt-5.6-sol",
effort: "high",
pro: false,
sol: true,
});
});
test("strips the provider prefix from a qualified model id", () => {
assert.equal(requireChatGptSessionRoute("chatgpt-session/pro").id, "pro");
assert.equal(requireChatGptSessionRoute("cgpt-session/pro").id, "pro");
});
test("luna routes target the luna backend and never require sol", () => {
const luna = requireChatGptSessionRoute("luna");
assert.equal(luna.backendModel, "gpt-5.6-luna");
assert.equal(luna.sol, false);
assert.equal(requireChatGptSessionRoute("think").effort, "medium");
});
test("pro routes are flagged pro", () => {
assert.equal(requireChatGptSessionRoute("pro").pro, true);
assert.equal(requireChatGptSessionRoute("extra-high").pro, true);
});
test("rejects an unknown slug", () => {
assert.throws(
() => requireChatGptSessionRoute("gpt-4"),
/Unsupported ChatGPT Session model: gpt-4/
);
});