claude-code-openai 0.1.4 → 0.1.6

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.
Files changed (2) hide show
  1. package/dist/cli.js +43 -7
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -57036,6 +57036,9 @@ function getPrivacyLevel() {
57036
57036
  if (process.env.DISABLE_TELEMETRY) {
57037
57037
  return "no-telemetry";
57038
57038
  }
57039
+ if (process.env.CLAUDE_CODE_USE_OPENAI) {
57040
+ return "essential-traffic";
57041
+ }
57039
57042
  return "default";
57040
57043
  }
57041
57044
  function isEssentialTrafficOnly() {
@@ -188483,7 +188486,7 @@ function isAnthropicAuthEnabled() {
188483
188486
  if (process.env.ANTHROPIC_UNIX_SOCKET) {
188484
188487
  return !!process.env.CLAUDE_CODE_OAUTH_TOKEN;
188485
188488
  }
188486
- const is3P = isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK) || isEnvTruthy(process.env.CLAUDE_CODE_USE_VERTEX) || isEnvTruthy(process.env.CLAUDE_CODE_USE_FOUNDRY);
188489
+ const is3P = isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK) || isEnvTruthy(process.env.CLAUDE_CODE_USE_VERTEX) || isEnvTruthy(process.env.CLAUDE_CODE_USE_FOUNDRY) || isEnvTruthy(process.env.CLAUDE_CODE_USE_OPENAI);
188487
188490
  const settings = getSettings_DEPRECATED() || {};
188488
188491
  const apiKeyHelper = settings.apiKeyHelper;
188489
188492
  const hasExternalAuthToken = process.env.ANTHROPIC_AUTH_TOKEN || apiKeyHelper || process.env.CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR;
@@ -204208,7 +204211,7 @@ var init_metadata = __esm(() => {
204208
204211
  isClaudeAiAuth: isClaudeAISubscriber(),
204209
204212
  version: "2.1.88-rebuild",
204210
204213
  versionBase: getVersionBase(),
204211
- buildTime: "2026-04-01T08:38:53.515Z",
204214
+ buildTime: "2026-04-01T08:53:57.618Z",
204212
204215
  deploymentEnvironment: env4.detectDeploymentEnvironment(),
204213
204216
  ...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
204214
204217
  githubEventName: process.env.GITHUB_EVENT_NAME,
@@ -592576,7 +592579,7 @@ function getAnthropicEnvMetadata() {
592576
592579
  function getBuildAgeMinutes() {
592577
592580
  if (false)
592578
592581
  ;
592579
- const buildTime = new Date("2026-04-01T08:38:53.515Z").getTime();
592582
+ const buildTime = new Date("2026-04-01T08:53:57.618Z").getTime();
592580
592583
  if (isNaN(buildTime))
592581
592584
  return;
592582
592585
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -594888,7 +594891,18 @@ async function* queryModelOpenAI(messages, systemPrompt, thinkingConfig, tools,
594888
594891
  delayMs = BASE_DELAY_MS4 * Math.pow(2, attempt);
594889
594892
  }
594890
594893
  logForDebugging(`[OpenAI] Retrying in ${delayMs}ms...`);
594891
- await new Promise((resolve35) => setTimeout(resolve35, delayMs));
594894
+ await new Promise((resolve35, reject2) => {
594895
+ if (signal.aborted) {
594896
+ resolve35();
594897
+ return;
594898
+ }
594899
+ const timer = setTimeout(resolve35, delayMs);
594900
+ const onAbort = () => {
594901
+ clearTimeout(timer);
594902
+ resolve35();
594903
+ };
594904
+ signal.addEventListener("abort", onAbort, { once: true });
594905
+ });
594892
594906
  }
594893
594907
  if (!response || !response.ok) {
594894
594908
  const status = lastStatus;
@@ -595274,6 +595288,7 @@ Sources:
595274
595288
  logForDebugging(`[OpenAI] Complete: ${contentBlocks.length} blocks, ${usage.input_tokens}in/${usage.output_tokens}out tokens, ${Date.now() - start}ms`);
595275
595289
  } catch (err2) {
595276
595290
  if (err2 instanceof Error && err2.name === "AbortError") {
595291
+ _lastResponseId = null;
595277
595292
  return;
595278
595293
  }
595279
595294
  const errorMsg = err2 instanceof Error ? err2.message : String(err2);
@@ -679035,7 +679050,7 @@ var init_bridge_kick = __esm(() => {
679035
679050
  var call56 = async () => {
679036
679051
  return {
679037
679052
  type: "text",
679038
- value: `${"2.1.88-rebuild"} (built ${"2026-04-01T08:38:53.515Z"})`
679053
+ value: `${"2.1.88-rebuild"} (built ${"2026-04-01T08:53:57.618Z"})`
679039
679054
  };
679040
679055
  }, version6, version_default;
679041
679056
  var init_version = __esm(() => {
@@ -698811,6 +698826,7 @@ async function verifyApiKey(apiKey, isNonInteractiveSession) {
698811
698826
  }
698812
698827
  if (getAPIProvider() === "openai") {
698813
698828
  try {
698829
+ const { resolveOpenAIModel: resolveOpenAIModel2 } = await Promise.resolve().then(() => (init_openai_query(), exports_openai_query));
698814
698830
  const client3 = await getOpenAIClient({ apiKey, maxRetries: 0 });
698815
698831
  const resp = await client3.fetch(`${client3.baseURL}/responses`, {
698816
698832
  method: "POST",
@@ -698819,7 +698835,7 @@ async function verifyApiKey(apiKey, isNonInteractiveSession) {
698819
698835
  Authorization: `Bearer ${client3.apiKey}`
698820
698836
  },
698821
698837
  body: JSON.stringify({
698822
- model: process.env.OPENAI_MODEL || "gpt-4.1-mini",
698838
+ model: resolveOpenAIModel2(getSmallFastModel()),
698823
698839
  input: "test",
698824
698840
  max_output_tokens: 1
698825
698841
  })
@@ -756334,6 +756350,25 @@ var init_useTimeout = __esm(() => {
756334
756350
 
756335
756351
  // src/utils/preflightChecks.tsx
756336
756352
  async function checkEndpoints() {
756353
+ if (getAPIProvider() === "openai") {
756354
+ try {
756355
+ const resp = await axios_default.get("https://api.openai.com/v1/models", {
756356
+ headers: { "User-Agent": getUserAgent(), Authorization: `Bearer ${process.env.OPENAI_API_KEY || "test"}` },
756357
+ validateStatus: () => true
756358
+ });
756359
+ if (resp.status > 0) {
756360
+ return { success: true };
756361
+ }
756362
+ return { success: false, error: "Failed to connect to api.openai.com" };
756363
+ } catch (error42) {
756364
+ const sslHint = getSSLErrorHint(error42);
756365
+ return {
756366
+ success: false,
756367
+ error: `Failed to connect to api.openai.com: ${error42 instanceof Error ? error42.code || error42.message : String(error42)}`,
756368
+ sslHint: sslHint ?? undefined
756369
+ };
756370
+ }
756371
+ }
756337
756372
  try {
756338
756373
  const oauthConfig = getOauthConfig();
756339
756374
  const tokenUrl = new URL(oauthConfig.TOKEN_URL);
@@ -756494,6 +756529,7 @@ var init_preflightChecks = __esm(() => {
756494
756529
  init_ink2();
756495
756530
  init_errorUtils();
756496
756531
  init_product();
756532
+ init_providers();
756497
756533
  init_http2();
756498
756534
  init_log2();
756499
756535
  import_react_compiler_runtime372 = __toESM(require_dist7(), 1);
@@ -776992,4 +777028,4 @@ async function main2() {
776992
777028
  }
776993
777029
  main2();
776994
777030
 
776995
- //# debugId=B6963C77F1D1E9E764756E2164756E21
777031
+ //# debugId=2D1C56D0F9C1544E64756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-openai",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Claude Code CLI with OpenAI GPT-5.4 backend support",
5
5
  "type": "module",
6
6
  "bin": {