@ljoukov/llm 7.0.19 → 7.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.cjs +14 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -108,7 +108,7 @@ refresh-token rotation and serves short-lived access tokens.
|
|
|
108
108
|
- `CHATGPT_AUTH_TOKEN_PROVIDER_URL` (example: `https://chatgpt-auth.<your-domain>`)
|
|
109
109
|
- `CHATGPT_AUTH_API_KEY` (shared secret; sent as `Authorization: Bearer ...` and `x-chatgpt-auth: ...`)
|
|
110
110
|
- `CHATGPT_AUTH_TOKEN_PROVIDER_STORE` (`kv` or `d1`, defaults to `kv`)
|
|
111
|
-
- `CHATGPT_CODEX_PROXY_URL` (optional Vercel proxy endpoint
|
|
111
|
+
- `CHATGPT_CODEX_PROXY_URL` (optional Vercel proxy endpoint; accepts either `https://<project>.vercel.app` or `https://<project>.vercel.app/api/codex/responses`)
|
|
112
112
|
- `CHATGPT_CODEX_PROXY_API_KEY` (bearer token for `CHATGPT_CODEX_PROXY_URL`)
|
|
113
113
|
- `CHATGPT_CODEX_ENDPOINT` (optional direct endpoint override; defaults to `https://chatgpt.com/backend-api/codex/responses`)
|
|
114
114
|
- `CHATGPT_RESPONSES_WEBSOCKET_MODE` (`auto` | `off` | `only`, default: `auto`)
|
|
@@ -122,7 +122,7 @@ token provider and will not read the local Codex auth store.
|
|
|
122
122
|
If `CHATGPT_CODEX_PROXY_URL` + `CHATGPT_CODEX_PROXY_API_KEY` are set, `chatgpt-*` text requests are sent through that
|
|
123
123
|
proxy and the local process does not need access to the Codex auth store or token provider. The Vercel proxy fetches
|
|
124
124
|
short-lived ChatGPT access tokens from `workers/chatgpt-auth` and streams the upstream Codex response body back to the
|
|
125
|
-
caller.
|
|
125
|
+
caller. These proxy bearer tokens should be server-side environment variables; do not expose them in browser bundles.
|
|
126
126
|
|
|
127
127
|
### Responses transport
|
|
128
128
|
|
package/dist/index.cjs
CHANGED
|
@@ -1827,8 +1827,8 @@ function resolveChatGptCodexEndpoint() {
|
|
|
1827
1827
|
}
|
|
1828
1828
|
function resolveChatGptCodexProxyConfig() {
|
|
1829
1829
|
loadLocalEnv();
|
|
1830
|
-
const
|
|
1831
|
-
if (!
|
|
1830
|
+
const rawUrl = process.env[CHATGPT_CODEX_PROXY_URL_ENV]?.trim();
|
|
1831
|
+
if (!rawUrl) {
|
|
1832
1832
|
return null;
|
|
1833
1833
|
}
|
|
1834
1834
|
const apiKey = process.env[CHATGPT_CODEX_PROXY_API_KEY_ENV]?.trim();
|
|
@@ -1839,10 +1839,21 @@ function resolveChatGptCodexProxyConfig() {
|
|
|
1839
1839
|
}
|
|
1840
1840
|
return {
|
|
1841
1841
|
kind: "proxy",
|
|
1842
|
-
url,
|
|
1842
|
+
url: normalizeChatGptCodexProxyUrl(rawUrl),
|
|
1843
1843
|
apiKey
|
|
1844
1844
|
};
|
|
1845
1845
|
}
|
|
1846
|
+
function normalizeChatGptCodexProxyUrl(rawUrl) {
|
|
1847
|
+
try {
|
|
1848
|
+
const url = new URL(rawUrl);
|
|
1849
|
+
if (url.pathname === "" || url.pathname === "/") {
|
|
1850
|
+
url.pathname = "/api/codex/responses";
|
|
1851
|
+
}
|
|
1852
|
+
return url.toString();
|
|
1853
|
+
} catch {
|
|
1854
|
+
return rawUrl;
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1846
1857
|
function buildChatGptCodexHeaders(options) {
|
|
1847
1858
|
const openAiBeta = options.useWebSocket ? mergeOpenAiBetaHeader(
|
|
1848
1859
|
CHATGPT_RESPONSES_EXPERIMENTAL_HEADER,
|