feat(providers): register the chatgpt-session provider and executor

This commit is contained in:
Markus Hartung
2026-09-02 02:40:42 -03:00
parent 71651d8c0a
commit a853ce146e
6 changed files with 102 additions and 1 deletions

View File

@@ -122,6 +122,7 @@ import { blackbox_webProvider } from "./registry/blackbox/web/index.ts";
import { uncloseaiProvider } from "./registry/uncloseai/index.ts";
import { nscaleProvider } from "./registry/nscale/index.ts";
import { chatgpt_web_codexProvider } from "./registry/chatgpt-web-codex/index.ts";
import { chatgpt_sessionProvider } from "./registry/chatgpt-session/index.ts";
import { openrouterProvider } from "./registry/openrouter/index.ts";
import { cheaperinferenceProvider } from "./registry/cheaperinference/index.ts";
import { openvectaProvider } from "./registry/openvecta/index.ts";
@@ -388,6 +389,7 @@ export const REGISTRY: Record<string, RegistryEntry> = {
uncloseai: uncloseaiProvider,
nscale: nscaleProvider,
"chatgpt-web-codex": chatgpt_web_codexProvider,
"chatgpt-session": chatgpt_sessionProvider,
openrouter: openrouterProvider,
cheaperinference: cheaperinferenceProvider,
openvecta: openvectaProvider,

View File

@@ -0,0 +1,27 @@
import type { RegistryEntry } from "../../shared.ts";
const SESSION_CAPABILITIES = {
toolCalling: true,
supportsReasoning: true,
supportsVision: false,
} as const;
export const chatgpt_sessionProvider: RegistryEntry = {
id: "chatgpt-session",
alias: "cgpt-session",
format: "openai",
executor: "chatgpt-session",
baseUrl: "https://chatgpt.com",
reasoningTransport: "opaque",
authType: "apikey",
authHeader: "cookie",
models: [
{ id: "luna", name: "ChatGPT Session — Luna", ...SESSION_CAPABILITIES },
{ id: "think", name: "ChatGPT Session — Think", ...SESSION_CAPABILITIES },
{ id: "instant", name: "ChatGPT Session — Instant", ...SESSION_CAPABILITIES },
{ id: "medium", name: "ChatGPT Session — Medium", ...SESSION_CAPABILITIES },
{ id: "high", name: "ChatGPT Session — High", ...SESSION_CAPABILITIES },
{ id: "extra-high", name: "ChatGPT Session — Extra High", ...SESSION_CAPABILITIES },
{ id: "pro", name: "ChatGPT Session — Pro", ...SESSION_CAPABILITIES },
],
};

View File

@@ -48,6 +48,10 @@ const lazyExecutors: Record<string, () => Promise<BaseExecutor>> = {
import("./chatgpt-web-codex.ts").then((m) => new m.ChatGptWebCodexExecutor()),
"cgpt-codex": () =>
import("./chatgpt-web-codex.ts").then((m) => new m.ChatGptWebCodexExecutor()),
"chatgpt-session": () =>
import("./chatgpt-session.ts").then((m) => new m.ChatGptSessionExecutor()),
"cgpt-session": () =>
import("./chatgpt-session.ts").then((m) => new m.ChatGptSessionExecutor()),
cursor: () => import("./cursor.ts").then((m) => new m.CursorExecutor()),
trae: () => import("./trae.ts").then((m) => new m.TraeExecutor()),
glm: () => import("./glm.ts").then((m) => new m.GlmExecutor("glm")),

View File

@@ -90,6 +90,16 @@
"configSource": "<custom-config>",
"provider": "chatgpt-web-codex"
},
"cgpt-session": {
"className": "ChatGptSessionExecutor",
"configSource": "<custom-config>",
"provider": "chatgpt-session"
},
"chatgpt-session": {
"className": "ChatGptSessionExecutor",
"configSource": "<custom-config>",
"provider": "chatgpt-session"
},
"chatgpt-web-codex": {
"className": "ChatGptWebCodexExecutor",
"configSource": "<custom-config>",
@@ -666,6 +676,6 @@
"provider": "zai-web"
}
},
"keyCount": 133,
"keyCount": 135,
"sharedInstances": []
}

View File

@@ -842,6 +842,29 @@
"stream": "https://api.chatanywhere.org/v1/chat/completions"
}
},
"chatgpt-session": {
"format": "openai",
"headers": {
"apiKey": {
"Accept": "text/event-stream",
"Authorization": "Bearer <TOK>",
"Content-Type": "application/json"
},
"nonStream": {
"Authorization": "Bearer <TOK>",
"Content-Type": "application/json"
},
"oauth": {
"Accept": "text/event-stream",
"Authorization": "Bearer <TOK>",
"Content-Type": "application/json"
}
},
"url": {
"nonStream": "https://chatgpt.com",
"stream": "https://chatgpt.com"
}
},
"chatgpt-web-codex": {
"format": "openai-responses",
"headers": {

View File

@@ -0,0 +1,35 @@
import { test } from "node:test";
import assert from "node:assert/strict";
import { REGISTRY } from "../../open-sse/config/providerRegistry.ts";
import { CHATGPT_SESSION_ROUTE_IDS } from "../../open-sse/executors/chatgpt-session/models.ts";
import {
RETIRED_COMMON_CHATGPT_WEB_PROVIDER_IDS,
isCommonChatGptWebRetiredProviderId,
} from "../../src/shared/constants/chatgptWebRetirement.ts";
test("the registry exposes chatgpt-session with its seven routes", () => {
const entry = REGISTRY["chatgpt-session"];
assert.ok(entry, "chatgpt-session must be registered");
assert.equal(entry.alias, "cgpt-session");
assert.equal(entry.format, "openai");
assert.equal(entry.executor, "chatgpt-session");
assert.deepEqual(
entry.models.map((model) => model.id),
[...CHATGPT_SESSION_ROUTE_IDS]
);
});
test("the new ids are not the retired ones", () => {
assert.equal(isCommonChatGptWebRetiredProviderId("chatgpt-session"), false);
assert.equal(isCommonChatGptWebRetiredProviderId("cgpt-session"), false);
assert.deepEqual([...RETIRED_COMMON_CHATGPT_WEB_PROVIDER_IDS], ["chatgpt-web", "cgpt-web"]);
});
test("both executor aliases resolve to the session executor", async () => {
const { getExecutor } = await import("../../open-sse/executors/index.ts");
for (const id of ["chatgpt-session", "cgpt-session"]) {
const executor = await getExecutor(id);
assert.equal(executor.getProvider(), "chatgpt-session");
}
});