@ljoukov/llm 7.0.20 → 7.0.22

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/dist/index.cjs CHANGED
@@ -65,6 +65,7 @@ __export(index_exports, {
65
65
  OPENAI_MODEL_IDS: () => OPENAI_MODEL_IDS,
66
66
  appendMarkdownSourcesSection: () => appendMarkdownSourcesSection,
67
67
  applyPatch: () => applyPatch,
68
+ configureChatGptCodexProxy: () => configureChatGptCodexProxy,
68
69
  configureGemini: () => configureGemini,
69
70
  configureModelConcurrency: () => configureModelConcurrency,
70
71
  configureTelemetry: () => configureTelemetry,
@@ -1724,7 +1725,8 @@ var CHATGPT_CODEX_PROXY_API_KEY_ENV = "CHATGPT_CODEX_PROXY_API_KEY";
1724
1725
  var CHATGPT_RESPONSES_EXPERIMENTAL_HEADER = "responses=experimental";
1725
1726
  var chatGptCodexState = getRuntimeSingleton(/* @__PURE__ */ Symbol.for("@ljoukov/llm.chatGptCodexState"), () => ({
1726
1727
  cachedResponsesWebSocketMode: null,
1727
- chatGptResponsesWebSocketDisabled: false
1728
+ chatGptResponsesWebSocketDisabled: false,
1729
+ configuredProxy: null
1728
1730
  }));
1729
1731
  async function streamChatGptCodexResponse(options) {
1730
1732
  const endpointConfig = await resolveChatGptCodexEndpointConfig();
@@ -1772,6 +1774,13 @@ async function streamChatGptCodexResponse(options) {
1772
1774
  }
1773
1775
  });
1774
1776
  }
1777
+ function configureChatGptCodexProxy(configuration) {
1778
+ chatGptCodexState.configuredProxy = configuration ? {
1779
+ url: normalizeChatGptCodexProxyUrl(configuration.url),
1780
+ apiKey: configuration.apiKey
1781
+ } : null;
1782
+ chatGptCodexState.cachedResponsesWebSocketMode = null;
1783
+ }
1775
1784
  async function streamChatGptCodexResponseSse(options) {
1776
1785
  const headers = buildChatGptCodexHeaders({
1777
1786
  endpointConfig: options.endpointConfig,
@@ -1826,6 +1835,13 @@ function resolveChatGptCodexEndpoint() {
1826
1835
  return process.env[CHATGPT_CODEX_ENDPOINT_ENV]?.trim() || CHATGPT_CODEX_ENDPOINT;
1827
1836
  }
1828
1837
  function resolveChatGptCodexProxyConfig() {
1838
+ if (chatGptCodexState.configuredProxy) {
1839
+ return {
1840
+ kind: "proxy",
1841
+ url: chatGptCodexState.configuredProxy.url,
1842
+ apiKey: chatGptCodexState.configuredProxy.apiKey
1843
+ };
1844
+ }
1829
1845
  loadLocalEnv();
1830
1846
  const rawUrl = process.env[CHATGPT_CODEX_PROXY_URL_ENV]?.trim();
1831
1847
  if (!rawUrl) {
@@ -15118,6 +15134,7 @@ async function runCandidateEvolution(options) {
15118
15134
  OPENAI_MODEL_IDS,
15119
15135
  appendMarkdownSourcesSection,
15120
15136
  applyPatch,
15137
+ configureChatGptCodexProxy,
15121
15138
  configureGemini,
15122
15139
  configureModelConcurrency,
15123
15140
  configureTelemetry,