claude-code-openai 0.1.1 → 0.1.3

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 +239 -45
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -132036,6 +132036,9 @@ var init_configs = __esm(() => {
132036
132036
  function getAPIProvider() {
132037
132037
  return isEnvTruthy(process.env.CLAUDE_CODE_USE_OPENAI) ? "openai" : isEnvTruthy(process.env.CLAUDE_CODE_USE_BEDROCK) ? "bedrock" : isEnvTruthy(process.env.CLAUDE_CODE_USE_VERTEX) ? "vertex" : isEnvTruthy(process.env.CLAUDE_CODE_USE_FOUNDRY) ? "foundry" : "firstParty";
132038
132038
  }
132039
+ function isOpenAIProvider() {
132040
+ return getAPIProvider() === "openai";
132041
+ }
132039
132042
  function getAPIProviderForStatsig() {
132040
132043
  return getAPIProvider();
132041
132044
  }
@@ -137176,7 +137179,7 @@ function formatPrice(price) {
137176
137179
  function formatModelPricing(costs) {
137177
137180
  return `${formatPrice(costs.inputTokens)}/${formatPrice(costs.outputTokens)} per Mtok`;
137178
137181
  }
137179
- var COST_TIER_3_15, COST_TIER_15_75, COST_TIER_5_25, COST_TIER_30_150, COST_HAIKU_35, COST_HAIKU_45, DEFAULT_UNKNOWN_MODEL_COST, MODEL_COSTS;
137182
+ var COST_TIER_3_15, COST_TIER_15_75, COST_TIER_5_25, COST_TIER_30_150, COST_HAIKU_35, COST_HAIKU_45, COST_GPT_54, COST_GPT_54_MINI, COST_GPT_41_MINI, COST_GPT_41, DEFAULT_UNKNOWN_MODEL_COST, MODEL_COSTS;
137180
137183
  var init_modelCost = __esm(() => {
137181
137184
  init_analytics();
137182
137185
  init_state();
@@ -137225,6 +137228,34 @@ var init_modelCost = __esm(() => {
137225
137228
  promptCacheReadTokens: 0.1,
137226
137229
  webSearchRequests: 0.01
137227
137230
  };
137231
+ COST_GPT_54 = {
137232
+ inputTokens: 2.5,
137233
+ outputTokens: 15,
137234
+ promptCacheWriteTokens: 2.5,
137235
+ promptCacheReadTokens: 0.625,
137236
+ webSearchRequests: 0.025
137237
+ };
137238
+ COST_GPT_54_MINI = {
137239
+ inputTokens: 0.4,
137240
+ outputTokens: 1.6,
137241
+ promptCacheWriteTokens: 0.4,
137242
+ promptCacheReadTokens: 0.1,
137243
+ webSearchRequests: 0.025
137244
+ };
137245
+ COST_GPT_41_MINI = {
137246
+ inputTokens: 0.4,
137247
+ outputTokens: 1.6,
137248
+ promptCacheWriteTokens: 0.4,
137249
+ promptCacheReadTokens: 0.1,
137250
+ webSearchRequests: 0.025
137251
+ };
137252
+ COST_GPT_41 = {
137253
+ inputTokens: 2,
137254
+ outputTokens: 8,
137255
+ promptCacheWriteTokens: 2,
137256
+ promptCacheReadTokens: 0.5,
137257
+ webSearchRequests: 0.025
137258
+ };
137228
137259
  DEFAULT_UNKNOWN_MODEL_COST = COST_TIER_5_25;
137229
137260
  MODEL_COSTS = {
137230
137261
  [firstPartyNameToCanonical(CLAUDE_3_5_HAIKU_CONFIG.firstParty)]: COST_HAIKU_35,
@@ -137237,7 +137268,11 @@ var init_modelCost = __esm(() => {
137237
137268
  [firstPartyNameToCanonical(CLAUDE_OPUS_4_CONFIG.firstParty)]: COST_TIER_15_75,
137238
137269
  [firstPartyNameToCanonical(CLAUDE_OPUS_4_1_CONFIG.firstParty)]: COST_TIER_15_75,
137239
137270
  [firstPartyNameToCanonical(CLAUDE_OPUS_4_5_CONFIG.firstParty)]: COST_TIER_5_25,
137240
- [firstPartyNameToCanonical(CLAUDE_OPUS_4_6_CONFIG.firstParty)]: COST_TIER_5_25
137271
+ [firstPartyNameToCanonical(CLAUDE_OPUS_4_6_CONFIG.firstParty)]: COST_TIER_5_25,
137272
+ "gpt-5.4": COST_GPT_54,
137273
+ "gpt-5.4-mini": COST_GPT_54_MINI,
137274
+ "gpt-4.1": COST_GPT_41,
137275
+ "gpt-4.1-mini": COST_GPT_41_MINI
137241
137276
  };
137242
137277
  });
137243
137278
 
@@ -137605,6 +137640,9 @@ function getPublicModelDisplayName(model) {
137605
137640
  case getModelStrings2().haiku35:
137606
137641
  return "Haiku 3.5";
137607
137642
  default:
137643
+ if (model.startsWith("gpt-")) {
137644
+ return model.toUpperCase().replace("GPT-", "GPT-");
137645
+ }
137608
137646
  return null;
137609
137647
  }
137610
137648
  }
@@ -137637,8 +137675,14 @@ function renderModelName(model) {
137637
137675
  function getPublicModelName(model) {
137638
137676
  const publicName = getPublicModelDisplayName(model);
137639
137677
  if (publicName) {
137678
+ if (model.startsWith("gpt-")) {
137679
+ return publicName;
137680
+ }
137640
137681
  return `Claude ${publicName}`;
137641
137682
  }
137683
+ if (model.startsWith("gpt-")) {
137684
+ return model;
137685
+ }
137642
137686
  return `Claude (${model})`;
137643
137687
  }
137644
137688
  function parseUserSpecifiedModel(modelInput) {
@@ -204160,7 +204204,7 @@ var init_metadata = __esm(() => {
204160
204204
  isClaudeAiAuth: isClaudeAISubscriber(),
204161
204205
  version: "2.1.88-rebuild",
204162
204206
  versionBase: getVersionBase(),
204163
- buildTime: "2026-04-01T06:28:49.572Z",
204207
+ buildTime: "2026-04-01T08:22:00.019Z",
204164
204208
  deploymentEnvironment: env4.detectDeploymentEnvironment(),
204165
204209
  ...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
204166
204210
  githubEventName: process.env.GITHUB_EVENT_NAME,
@@ -206699,6 +206743,9 @@ var init_sink = __esm(() => {
206699
206743
  // src/constants/system.ts
206700
206744
  function getCLISyspromptPrefix(options) {
206701
206745
  const apiProvider = getAPIProvider();
206746
+ if (apiProvider === "openai") {
206747
+ return OPENAI_DEFAULT_PREFIX;
206748
+ }
206702
206749
  if (apiProvider === "vertex") {
206703
206750
  return DEFAULT_PREFIX;
206704
206751
  }
@@ -206729,7 +206776,7 @@ function getAttributionHeader(fingerprint) {
206729
206776
  logForDebugging(`attribution header ${header}`);
206730
206777
  return header;
206731
206778
  }
206732
- var DEFAULT_PREFIX = `You are Claude Code, Anthropic's official CLI for Claude.`, AGENT_SDK_CLAUDE_CODE_PRESET_PREFIX = `You are Claude Code, Anthropic's official CLI for Claude, running within the Claude Agent SDK.`, AGENT_SDK_PREFIX = `You are a Claude agent, built on Anthropic's Claude Agent SDK.`, CLI_SYSPROMPT_PREFIX_VALUES, CLI_SYSPROMPT_PREFIXES;
206779
+ var DEFAULT_PREFIX = `You are Claude Code, Anthropic's official CLI for Claude.`, AGENT_SDK_CLAUDE_CODE_PRESET_PREFIX = `You are Claude Code, Anthropic's official CLI for Claude, running within the Claude Agent SDK.`, AGENT_SDK_PREFIX = `You are a Claude agent, built on Anthropic's Claude Agent SDK.`, CLI_SYSPROMPT_PREFIX_VALUES, CLI_SYSPROMPT_PREFIXES, OPENAI_DEFAULT_PREFIX = `You are Claude Code (OpenAI mode), a CLI coding assistant powered by OpenAI GPT models.`;
206733
206780
  var init_system = __esm(() => {
206734
206781
  init_growthbook();
206735
206782
  init_debug();
@@ -290038,7 +290085,8 @@ function getSSLErrorHint(error42) {
290038
290085
  if (!details?.isSSLError) {
290039
290086
  return null;
290040
290087
  }
290041
- return `SSL certificate error (${details.code}). If you are behind a corporate proxy or TLS-intercepting firewall, set NODE_EXTRA_CA_CERTS to your CA bundle path, or ask IT to allowlist *.anthropic.com. Run /doctor for details.`;
290088
+ const domain2 = isOpenAIProvider() ? "*.openai.com" : "*.anthropic.com";
290089
+ return `SSL certificate error (${details.code}). If you are behind a corporate proxy or TLS-intercepting firewall, set NODE_EXTRA_CA_CERTS to your CA bundle path, or ask IT to allowlist ${domain2}. Run /doctor for details.`;
290042
290090
  }
290043
290091
  function sanitizeMessageHTML(message) {
290044
290092
  if (message.includes("<!DOCTYPE html") || message.includes("<html")) {
@@ -290126,6 +290174,7 @@ function formatAPIError(error42) {
290126
290174
  }
290127
290175
  var SSL_ERROR_CODES;
290128
290176
  var init_errorUtils = __esm(() => {
290177
+ init_providers();
290129
290178
  SSL_ERROR_CODES = new Set([
290130
290179
  "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
290131
290180
  "UNABLE_TO_GET_ISSUER_CERT",
@@ -407315,6 +407364,24 @@ function toInfraSessionId(id) {
407315
407364
  var _isCseShimEnabled;
407316
407365
 
407317
407366
  // src/constants/product.ts
407367
+ function _isOpenAI() {
407368
+ return isEnvTruthy(process.env.CLAUDE_CODE_USE_OPENAI);
407369
+ }
407370
+ function getProductName() {
407371
+ return _isOpenAI() ? "Claude Code (OpenAI)" : "Claude Code";
407372
+ }
407373
+ function getProviderName() {
407374
+ return _isOpenAI() ? "OpenAI" : "Anthropic";
407375
+ }
407376
+ function getProviderStatusUrl() {
407377
+ return _isOpenAI() ? "status.openai.com" : "status.anthropic.com";
407378
+ }
407379
+ function getProviderPolicyUrl() {
407380
+ return _isOpenAI() ? "https://openai.com/policies/usage-policies" : "https://www.anthropic.com/legal/aup";
407381
+ }
407382
+ function getAssistantLabel() {
407383
+ return _isOpenAI() ? "Assistant" : "Claude";
407384
+ }
407318
407385
  function isRemoteSessionStaging(sessionId, ingressUrl) {
407319
407386
  return sessionId?.includes("_staging_") === true || ingressUrl?.includes("staging") === true;
407320
407387
  }
@@ -407337,6 +407404,9 @@ function getRemoteSessionUrl(sessionId, ingressUrl) {
407337
407404
  return `${baseUrl}/code/${compatId}`;
407338
407405
  }
407339
407406
  var PRODUCT_URL = "https://claude.com/claude-code", CLAUDE_AI_BASE_URL = "https://claude.ai", CLAUDE_AI_STAGING_BASE_URL = "https://claude-ai.staging.ant.dev", CLAUDE_AI_LOCAL_BASE_URL = "http://localhost:4000";
407407
+ var init_product = __esm(() => {
407408
+ init_envUtils();
407409
+ });
407340
407410
 
407341
407411
  // src/keybindings/defaultBindings.ts
407342
407412
  var IMAGE_PASTE_KEY, SUPPORTS_TERMINAL_VT_MODE, MODE_CYCLE_KEY, DEFAULT_BINDINGS;
@@ -423771,7 +423841,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
423771
423841
  name: "claude-code",
423772
423842
  title: "Claude Code",
423773
423843
  version: "2.1.88-rebuild",
423774
- description: "Anthropic's agentic coding tool",
423844
+ description: "AI-powered agentic coding tool",
423775
423845
  websiteUrl: PRODUCT_URL
423776
423846
  }, {
423777
423847
  capabilities: {}
@@ -423831,6 +423901,7 @@ var init_client8 = __esm(() => {
423831
423901
  init_p_map();
423832
423902
  init_state();
423833
423903
  init_oauth();
423904
+ init_product();
423834
423905
  init_Tool();
423835
423906
  init_ListMcpResourcesTool();
423836
423907
  init_MCPTool();
@@ -424125,7 +424196,7 @@ var init_client8 = __esm(() => {
424125
424196
  name: "claude-code",
424126
424197
  title: "Claude Code",
424127
424198
  version: "2.1.88-rebuild",
424128
- description: "Anthropic's agentic coding tool",
424199
+ description: "AI-powered agentic coding tool",
424129
424200
  websiteUrl: PRODUCT_URL
424130
424201
  }, {
424131
424202
  capabilities: {
@@ -503315,7 +503386,7 @@ function buildAPIProviderProperties() {
503315
503386
  const anthropicBaseUrl = process.env.ANTHROPIC_BASE_URL;
503316
503387
  if (anthropicBaseUrl) {
503317
503388
  properties.push({
503318
- label: "Anthropic base URL",
503389
+ label: "API base URL",
503319
503390
  value: anthropicBaseUrl
503320
503391
  });
503321
503392
  }
@@ -511885,6 +511956,7 @@ function buildActiveFooterText(url3) {
511885
511956
  }
511886
511957
  var FAILED_FOOTER_TEXT = "Something went wrong, please try again";
511887
511958
  var init_bridgeStatusUtil = __esm(() => {
511959
+ init_product();
511888
511960
  init_stringWidth();
511889
511961
  init_format();
511890
511962
  init_intl();
@@ -536185,6 +536257,7 @@ function getRemoteTaskSessionUrl(sessionId) {
536185
536257
  }
536186
536258
  var REMOTE_TASK_TYPES, completionCheckers, RemoteAgentTask;
536187
536259
  var init_RemoteAgentTask = __esm(() => {
536260
+ init_product();
536188
536261
  init_xml();
536189
536262
  init_Task();
536190
536263
  init_TodoWriteTool();
@@ -574322,7 +574395,7 @@ function renderToolResultMessage15(output, _progressMessages, options) {
574322
574395
  flexDirection: "row"
574323
574396
  }, /* @__PURE__ */ import_react120.default.createElement(ThemedText, {
574324
574397
  color: "briefLabelClaude"
574325
- }, "Claude"), ts ? /* @__PURE__ */ import_react120.default.createElement(ThemedText, {
574398
+ }, getAssistantLabel()), ts ? /* @__PURE__ */ import_react120.default.createElement(ThemedText, {
574326
574399
  dimColor: true
574327
574400
  }, " ", ts) : null), /* @__PURE__ */ import_react120.default.createElement(ThemedBox_default, {
574328
574401
  flexDirection: "column"
@@ -574388,6 +574461,7 @@ var init_UI15 = __esm(() => {
574388
574461
  init_ink2();
574389
574462
  init_file();
574390
574463
  init_format();
574464
+ init_product();
574391
574465
  import_react_compiler_runtime117 = __toESM(require_dist7(), 1);
574392
574466
  import_react120 = __toESM(require_react(), 1);
574393
574467
  });
@@ -578422,7 +578496,38 @@ function getOpusPlanOption() {
578422
578496
  description: "Use Opus 4.6 in plan mode, Sonnet 4.6 otherwise"
578423
578497
  };
578424
578498
  }
578499
+ function getOpenAIModelOptions() {
578500
+ return [
578501
+ {
578502
+ value: "gpt-5.4",
578503
+ label: "GPT-5.4 (recommended)",
578504
+ description: `GPT-5.4 · Most capable · ${formatModelPricing(COST_GPT_54)}`,
578505
+ descriptionForModel: "GPT-5.4 - most capable for complex work"
578506
+ },
578507
+ {
578508
+ value: "gpt-5.4-mini",
578509
+ label: "GPT-5.4 Mini",
578510
+ description: `GPT-5.4 Mini · Fast and affordable · ${formatModelPricing(COST_GPT_54_MINI)}`,
578511
+ descriptionForModel: "GPT-5.4 Mini - fast and affordable for everyday tasks"
578512
+ },
578513
+ {
578514
+ value: "gpt-4.1",
578515
+ label: "GPT-4.1",
578516
+ description: `GPT-4.1 · Balanced performance · ${formatModelPricing(COST_GPT_41)}`,
578517
+ descriptionForModel: "GPT-4.1 - balanced performance and cost"
578518
+ },
578519
+ {
578520
+ value: "gpt-4.1-mini",
578521
+ label: "GPT-4.1 Mini",
578522
+ description: `GPT-4.1 Mini · Fastest and cheapest · ${formatModelPricing(COST_GPT_41_MINI)}`,
578523
+ descriptionForModel: "GPT-4.1 Mini - fastest and cheapest option"
578524
+ }
578525
+ ];
578526
+ }
578425
578527
  function getModelOptionsBase(fastMode = false) {
578528
+ if (isOpenAIProvider()) {
578529
+ return getOpenAIModelOptions();
578530
+ }
578426
578531
  if (process.env.USER_TYPE === "ant") {
578427
578532
  const antModelOptions = getAntModels().map((m3) => ({
578428
578533
  value: m3.alias,
@@ -578628,6 +578733,7 @@ var init_modelOptions = __esm(() => {
578628
578733
  init_model();
578629
578734
  init_context();
578630
578735
  init_config2();
578736
+ init_providers();
578631
578737
  MaxSonnet46Option = {
578632
578738
  value: "sonnet",
578633
578739
  label: "Sonnet",
@@ -585959,8 +586065,10 @@ function getAttributionTexts() {
585959
586065
  const model = getMainLoopModel();
585960
586066
  const isKnownPublicModel = getPublicModelDisplayName(model) !== null;
585961
586067
  const modelName = isInternalModelRepoCached() || isKnownPublicModel ? getPublicModelName(model) : "Claude Opus 4.6";
585962
- const defaultAttribution = `\uD83E\uDD16 Generated with [Claude Code](${PRODUCT_URL})`;
585963
- const defaultCommit = `Co-Authored-By: ${modelName} <noreply@anthropic.com>`;
586068
+ const productName = getProductName();
586069
+ const providerDomain = getProviderName() === "OpenAI" ? "openai.com" : "anthropic.com";
586070
+ const defaultAttribution = `\uD83E\uDD16 Generated with [${productName}](${PRODUCT_URL})`;
586071
+ const defaultCommit = `Co-Authored-By: ${modelName} <noreply@${providerDomain}>`;
585964
586072
  const settings = getInitialSettings();
585965
586073
  if (settings.attribution) {
585966
586074
  return {
@@ -586119,6 +586227,7 @@ async function getEnhancedPRAttribution(getAppState) {
586119
586227
  var MEMORY_ACCESS_TOOL_NAMES;
586120
586228
  var init_attribution = __esm(() => {
586121
586229
  init_state();
586230
+ init_product();
586122
586231
  init_xml();
586123
586232
  init_prompt2();
586124
586233
  init_prompt3();
@@ -592457,7 +592566,7 @@ function getAnthropicEnvMetadata() {
592457
592566
  function getBuildAgeMinutes() {
592458
592567
  if (false)
592459
592568
  ;
592460
- const buildTime = new Date("2026-04-01T06:28:49.572Z").getTime();
592569
+ const buildTime = new Date("2026-04-01T08:22:00.019Z").getTime();
592461
592570
  if (isNaN(buildTime))
592462
592571
  return;
592463
592572
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -594549,16 +594658,24 @@ function convertAssistantMessage(msg, items) {
594549
594658
  }
594550
594659
  }
594551
594660
  function convertToolSchemas(tools) {
594552
- return tools.filter((t2) => t2.type === "custom" || !("type" in t2) || t2.type === undefined).map((t2) => {
594553
- const tool = t2;
594554
- return {
594555
- type: "function",
594556
- name: tool.name,
594557
- description: tool.description ?? "",
594558
- parameters: tool.input_schema,
594559
- strict: tool.strict === true
594560
- };
594561
- });
594661
+ const oaiTools = [];
594662
+ for (const t2 of tools) {
594663
+ if ("type" in t2 && typeof t2.type === "string" && t2.type.startsWith("web_search")) {
594664
+ oaiTools.push({ type: "web_search_preview", search_context_size: "medium" });
594665
+ continue;
594666
+ }
594667
+ if (t2.type === "custom" || !("type" in t2) || t2.type === undefined) {
594668
+ const tool = t2;
594669
+ oaiTools.push({
594670
+ type: "function",
594671
+ name: tool.name,
594672
+ description: tool.description ?? "",
594673
+ parameters: tool.input_schema,
594674
+ strict: tool.strict === true
594675
+ });
594676
+ }
594677
+ }
594678
+ return oaiTools;
594562
594679
  }
594563
594680
  function convertToolChoice(toolChoice) {
594564
594681
  if (!toolChoice)
@@ -594668,19 +594785,21 @@ async function* queryModelOpenAI(messages, systemPrompt, thinkingConfig, tools,
594668
594785
  } else {
594669
594786
  input = convertMessages(messages);
594670
594787
  }
594671
- const maxOutputTokens = options.maxOutputTokensOverride || 16384;
594788
+ const maxOutputTokens = options.maxOutputTokensOverride || MAX_OUTPUT_TOKENS[openaiModel] || 16384;
594789
+ const hasFunctionTools = oaiTools.some((t2) => t2.type === "function");
594672
594790
  const params = {
594673
594791
  model: openaiModel,
594674
594792
  instructions: instructions || undefined,
594675
594793
  input,
594676
594794
  tools: oaiTools.length > 0 ? oaiTools : undefined,
594677
- tool_choice: oaiTools.length > 0 ? toolChoice : undefined,
594678
- parallel_tool_calls: false,
594795
+ tool_choice: hasFunctionTools ? toolChoice : undefined,
594796
+ parallel_tool_calls: hasFunctionTools ? false : undefined,
594679
594797
  stream: true,
594680
594798
  max_output_tokens: maxOutputTokens,
594681
594799
  temperature: options.temperatureOverride ?? 1,
594682
594800
  reasoning,
594683
- previous_response_id: usePreviousResponseId ? _lastResponseId : undefined
594801
+ previous_response_id: usePreviousResponseId ? _lastResponseId : undefined,
594802
+ store: true
594684
594803
  };
594685
594804
  logForDebugging(`[OpenAI] Request: model=${openaiModel} input=${input.length} items (${usePreviousResponseId ? "incremental, chain=" + _lastResponseId : "full"}) tools=${oaiTools.length}`);
594686
594805
  const start = Date.now();
@@ -594787,6 +594906,8 @@ async function* queryModelOpenAI(messages, systemPrompt, thinkingConfig, tools,
594787
594906
  const functionCallState = new Map;
594788
594907
  const textState = new Map;
594789
594908
  const reasoningState = new Map;
594909
+ const webSearchState = new Map;
594910
+ const pendingAnnotations = new Map;
594790
594911
  const reader = response.body.getReader();
594791
594912
  const decoder = new TextDecoder;
594792
594913
  let buffer = "";
@@ -594899,6 +595020,9 @@ async function* queryModelOpenAI(messages, systemPrompt, thinkingConfig, tools,
594899
595020
  content_block: { type: "thinking", thinking: "", signature: "openai-reasoning" }
594900
595021
  }
594901
595022
  };
595023
+ } else if (item.type === "web_search_call") {
595024
+ webSearchState.set(event.output_index, item.id);
595025
+ logForDebugging(`[OpenAI] web_search_call started: ${item.id}`);
594902
595026
  }
594903
595027
  break;
594904
595028
  }
@@ -595008,10 +595132,16 @@ async function* queryModelOpenAI(messages, systemPrompt, thinkingConfig, tools,
595008
595132
  responseStatus = "incomplete";
595009
595133
  break;
595010
595134
  }
595135
+ case "response.output_text.done": {
595136
+ if (event.annotations && event.annotations.length > 0) {
595137
+ pendingAnnotations.set(event.output_index, event.annotations);
595138
+ logForDebugging(`[OpenAI] Got ${event.annotations.length} annotations for output_index ${event.output_index}`);
595139
+ }
595140
+ break;
595141
+ }
595011
595142
  case "response.in_progress":
595012
595143
  case "response.content_part.added":
595013
595144
  case "response.content_part.done":
595014
- case "response.output_text.done":
595015
595145
  break;
595016
595146
  case "error": {
595017
595147
  logForDebugging(`[OpenAI] Stream error: ${event.error.message}`);
@@ -595027,6 +595157,36 @@ async function* queryModelOpenAI(messages, systemPrompt, thinkingConfig, tools,
595027
595157
  } finally {
595028
595158
  reader.releaseLock();
595029
595159
  }
595160
+ if (pendingAnnotations.size > 0) {
595161
+ for (const [outputIdx, annotations] of pendingAnnotations) {
595162
+ const blockIdx = findBlockIndex(contentBlocks, outputIdx, "text", textState, functionCallState, reasoningState);
595163
+ if (blockIdx >= 0) {
595164
+ const block = contentBlocks[blockIdx];
595165
+ const uniqueUrls = new Map;
595166
+ for (const ann of annotations) {
595167
+ if (ann.type === "url_citation" && ann.url && !uniqueUrls.has(ann.url)) {
595168
+ uniqueUrls.set(ann.url, ann.title || ann.url);
595169
+ }
595170
+ }
595171
+ if (uniqueUrls.size > 0) {
595172
+ const sourcesText = `
595173
+
595174
+ Sources:
595175
+ ` + [...uniqueUrls].map(([url3, title]) => `- [${title}](${url3})`).join(`
595176
+ `);
595177
+ block.text += sourcesText;
595178
+ yield {
595179
+ type: "stream_event",
595180
+ event: {
595181
+ type: "content_block_delta",
595182
+ index: blockIdx,
595183
+ delta: { type: "text_delta", text: sourcesText }
595184
+ }
595185
+ };
595186
+ }
595187
+ }
595188
+ }
595189
+ }
595030
595190
  const stopReason = convertStopReason(responseStatus);
595031
595191
  yield {
595032
595192
  type: "stream_event",
@@ -595105,18 +595265,36 @@ async function queryModelOpenAINonStreaming(messages, systemPrompt, thinkingConf
595105
595265
  }
595106
595266
  return result;
595107
595267
  }
595108
- var OPENAI_MODEL_MAP, _lastResponseId = null;
595268
+ var OPENAI_MODEL_MAP, MAX_OUTPUT_TOKENS, _lastResponseId = null;
595109
595269
  var init_openai_query = __esm(() => {
595110
595270
  init_messages7();
595111
595271
  init_debug();
595112
595272
  init_client5();
595113
595273
  OPENAI_MODEL_MAP = {
595114
595274
  "claude-opus-4-6-20260401": "gpt-5.4",
595275
+ "claude-opus-4-5-20250918": "gpt-5.4",
595276
+ "claude-opus-4-1-20250415": "gpt-5.4",
595277
+ "claude-opus-4-20250115": "gpt-5.4",
595278
+ "claude-sonnet-4-6-20260401": "gpt-5.4-mini",
595115
595279
  "claude-sonnet-4-5-20250929": "gpt-5.4-mini",
595280
+ "claude-sonnet-4-20250514": "gpt-5.4-mini",
595281
+ "claude-3-7-sonnet-20250219": "gpt-5.4-mini",
595282
+ "claude-3-5-sonnet-20241022": "gpt-5.4-mini",
595116
595283
  "claude-haiku-4-5-20251001": "gpt-4.1-mini",
595284
+ "claude-3-5-haiku-20241022": "gpt-4.1-mini",
595117
595285
  opus: "gpt-5.4",
595118
595286
  sonnet: "gpt-5.4-mini",
595119
- haiku: "gpt-4.1-mini"
595287
+ haiku: "gpt-4.1-mini",
595288
+ "gpt-5.4": "gpt-5.4",
595289
+ "gpt-5.4-mini": "gpt-5.4-mini",
595290
+ "gpt-4.1": "gpt-4.1",
595291
+ "gpt-4.1-mini": "gpt-4.1-mini"
595292
+ };
595293
+ MAX_OUTPUT_TOKENS = {
595294
+ "gpt-5.4": 32768,
595295
+ "gpt-5.4-mini": 16384,
595296
+ "gpt-4.1": 16384,
595297
+ "gpt-4.1-mini": 16384
595120
595298
  };
595121
595299
  });
595122
595300
 
@@ -608974,10 +609152,12 @@ function getRequestTooLargeErrorMessage() {
608974
609152
  return getIsNonInteractiveSession() ? `Request too large (${limits}). Try with a smaller file.` : `Request too large (${limits}). Double press esc to go back and try with a smaller file.`;
608975
609153
  }
608976
609154
  function getTokenRevokedErrorMessage() {
608977
- return getIsNonInteractiveSession() ? "Your account does not have access to Claude. Please login again or contact your administrator." : TOKEN_REVOKED_ERROR_MESSAGE;
609155
+ const serviceName = isOpenAIProvider() ? "OpenAI API" : "Claude";
609156
+ return getIsNonInteractiveSession() ? `Your account does not have access to ${serviceName}. Please login again or contact your administrator.` : TOKEN_REVOKED_ERROR_MESSAGE;
608978
609157
  }
608979
609158
  function getOauthOrgNotAllowedErrorMessage() {
608980
- return getIsNonInteractiveSession() ? "Your organization does not have access to Claude. Please login again or contact your administrator." : OAUTH_ORG_NOT_ALLOWED_ERROR_MESSAGE;
609159
+ const serviceName = isOpenAIProvider() ? "OpenAI API" : "Claude";
609160
+ return getIsNonInteractiveSession() ? `Your organization does not have access to ${serviceName}. Please login again or contact your administrator.` : OAUTH_ORG_NOT_ALLOWED_ERROR_MESSAGE;
608981
609161
  }
608982
609162
  function isCCRMode() {
608983
609163
  return isEnvTruthy(process.env.CLAUDE_CODE_REMOTE);
@@ -609178,7 +609358,7 @@ function getAssistantMessageFromError(error42, model, options) {
609178
609358
  const innerMessage = stripped.match(/"message"\s*:\s*"([^"]*)"/)?.[1];
609179
609359
  const detail = innerMessage || stripped;
609180
609360
  return createAssistantAPIErrorMessage({
609181
- content: `${API_ERROR_MESSAGE_PREFIX}: Request rejected (429) · ${detail || "this may be a temporary capacity issue — check status.anthropic.com"}`,
609361
+ content: `${API_ERROR_MESSAGE_PREFIX}: Request rejected (429) · ${detail || `this may be a temporary capacity issue — check ${getProviderStatusUrl()}`}`,
609182
609362
  error: "rate_limit"
609183
609363
  });
609184
609364
  }
@@ -609273,7 +609453,7 @@ Run /share and post the JSON file to ${"https://github.com/anthropics/claude-cod
609273
609453
  }
609274
609454
  if (isClaudeAISubscriber() && error42 instanceof APIError && error42.status === 400 && error42.message.toLowerCase().includes("invalid model name") && (isNonCustomOpusModel(model) || model === "opus")) {
609275
609455
  return createAssistantAPIErrorMessage({
609276
- content: "Claude Opus is not available with the Claude Pro plan. If you have updated your subscription plan recently, run /logout and /login for the plan to take effect.",
609456
+ content: `${isOpenAIProvider() ? "This model" : "Claude Opus"} is not available with ${isOpenAIProvider() ? "your current plan" : "the Claude Pro plan"}. If you have updated your subscription plan recently, run /logout and /login for the plan to take effect.`,
609277
609457
  error: "invalid_request"
609278
609458
  });
609279
609459
  }
@@ -609489,14 +609669,16 @@ function getErrorMessageIfRefusal(stopReason, model) {
609489
609669
  return;
609490
609670
  }
609491
609671
  logEvent("tengu_refusal_api_response", {});
609492
- const baseMessage = getIsNonInteractiveSession() ? `${API_ERROR_MESSAGE_PREFIX}: Claude Code is unable to respond to this request, which appears to violate our Usage Policy (https://www.anthropic.com/legal/aup). Try rephrasing the request or attempting a different approach.` : `${API_ERROR_MESSAGE_PREFIX}: Claude Code is unable to respond to this request, which appears to violate our Usage Policy (https://www.anthropic.com/legal/aup). Please double press esc to edit your last message or start a new session for Claude Code to assist with a different task.`;
609672
+ const policyUrl = getProviderPolicyUrl();
609673
+ const productName = getProductName();
609674
+ const baseMessage = getIsNonInteractiveSession() ? `${API_ERROR_MESSAGE_PREFIX}: ${productName} is unable to respond to this request, which appears to violate our Usage Policy (${policyUrl}). Try rephrasing the request or attempting a different approach.` : `${API_ERROR_MESSAGE_PREFIX}: ${productName} is unable to respond to this request, which appears to violate our Usage Policy (${policyUrl}). Please double press esc to edit your last message or start a new session for ${productName} to assist with a different task.`;
609493
609675
  const modelSuggestion = model !== "claude-sonnet-4-20250514" ? " If you are seeing this refusal repeatedly, try running /model claude-sonnet-4-20250514 to switch models." : "";
609494
609676
  return createAssistantAPIErrorMessage({
609495
609677
  content: baseMessage + modelSuggestion,
609496
609678
  error: "invalid_request"
609497
609679
  });
609498
609680
  }
609499
- var API_ERROR_MESSAGE_PREFIX = "API Error", PROMPT_TOO_LONG_ERROR_MESSAGE = "Prompt is too long", CREDIT_BALANCE_TOO_LOW_ERROR_MESSAGE = "Credit balance is too low", INVALID_API_KEY_ERROR_MESSAGE = "Not logged in · Please run /login", INVALID_API_KEY_ERROR_MESSAGE_EXTERNAL = "Invalid API key · Fix external API key", ORG_DISABLED_ERROR_MESSAGE_ENV_KEY_WITH_OAUTH = "Your ANTHROPIC_API_KEY belongs to a disabled organization · Unset the environment variable to use your subscription instead", ORG_DISABLED_ERROR_MESSAGE_ENV_KEY = "Your ANTHROPIC_API_KEY belongs to a disabled organization · Update or unset the environment variable", TOKEN_REVOKED_ERROR_MESSAGE = "OAuth token revoked · Please run /login", CCR_AUTH_ERROR_MESSAGE = "Authentication error · This may be a temporary network issue, please try again", REPEATED_529_ERROR_MESSAGE = "Repeated 529 Overloaded errors", CUSTOM_OFF_SWITCH_MESSAGE = "Opus is experiencing high load, please use /model to switch to Sonnet", API_TIMEOUT_ERROR_MESSAGE = "Request timed out", OAUTH_ORG_NOT_ALLOWED_ERROR_MESSAGE = "Your account does not have access to Claude Code. Please run /login.";
609681
+ var API_ERROR_MESSAGE_PREFIX = "API Error", PROMPT_TOO_LONG_ERROR_MESSAGE = "Prompt is too long", CREDIT_BALANCE_TOO_LOW_ERROR_MESSAGE = "Credit balance is too low", INVALID_API_KEY_ERROR_MESSAGE = "Not logged in · Please run /login", INVALID_API_KEY_ERROR_MESSAGE_EXTERNAL = "Invalid API key · Fix external API key", ORG_DISABLED_ERROR_MESSAGE_ENV_KEY_WITH_OAUTH = "Your ANTHROPIC_API_KEY belongs to a disabled organization · Unset the environment variable to use your subscription instead", ORG_DISABLED_ERROR_MESSAGE_ENV_KEY = "Your ANTHROPIC_API_KEY belongs to a disabled organization · Update or unset the environment variable", TOKEN_REVOKED_ERROR_MESSAGE = "OAuth token revoked · Please run /login", CCR_AUTH_ERROR_MESSAGE = "Authentication error · This may be a temporary network issue, please try again", REPEATED_529_ERROR_MESSAGE = "Repeated 529 Overloaded errors", CUSTOM_OFF_SWITCH_MESSAGE = "Opus is experiencing high load, please use /model to switch to Sonnet", API_TIMEOUT_ERROR_MESSAGE = "Request timed out", OAUTH_ORG_NOT_ALLOWED_ERROR_MESSAGE;
609500
609682
  var init_errors8 = __esm(() => {
609501
609683
  init_sdk();
609502
609684
  init_betas();
@@ -609505,6 +609687,7 @@ var init_errors8 = __esm(() => {
609505
609687
  init_model();
609506
609688
  init_modelStrings();
609507
609689
  init_providers();
609690
+ init_product();
609508
609691
  init_state();
609509
609692
  init_apiLimits();
609510
609693
  init_envUtils();
@@ -609515,6 +609698,7 @@ var init_errors8 = __esm(() => {
609515
609698
  init_claudeAiLimits();
609516
609699
  init_rateLimitMocking();
609517
609700
  init_errorUtils();
609701
+ OAUTH_ORG_NOT_ALLOWED_ERROR_MESSAGE = `Your account does not have access to ${getProductName()}. Please run /login.`;
609518
609702
  });
609519
609703
 
609520
609704
  // src/utils/shell/prefix.ts
@@ -631404,23 +631588,25 @@ var init_keybindings2 = __esm(() => {
631404
631588
  var login_default = () => ({
631405
631589
  type: "local-jsx",
631406
631590
  name: "login",
631407
- description: hasAnthropicApiKeyAuth() ? "Switch Anthropic accounts" : "Sign in with your Anthropic account",
631591
+ description: hasAnthropicApiKeyAuth() ? `Switch ${getProviderName()} accounts` : `Sign in with your ${getProviderName()} account`,
631408
631592
  isEnabled: () => !isEnvTruthy(process.env.DISABLE_LOGIN_COMMAND),
631409
631593
  load: () => Promise.resolve().then(() => (init_login(), exports_login))
631410
631594
  });
631411
631595
  var init_login2 = __esm(() => {
631412
631596
  init_auth2();
631413
631597
  init_envUtils();
631598
+ init_product();
631414
631599
  });
631415
631600
 
631416
631601
  // src/commands/logout/index.ts
631417
631602
  var logout_default;
631418
631603
  var init_logout2 = __esm(() => {
631419
631604
  init_envUtils();
631605
+ init_product();
631420
631606
  logout_default = {
631421
631607
  type: "local-jsx",
631422
631608
  name: "logout",
631423
- description: "Sign out from your Anthropic account",
631609
+ description: `Sign out from your ${getProviderName()} account`,
631424
631610
  isEnabled: () => !isEnvTruthy(process.env.DISABLE_LOGOUT_COMMAND),
631425
631611
  load: () => Promise.resolve().then(() => (init_logout(), exports_logout))
631426
631612
  };
@@ -661919,6 +662105,7 @@ var ULTRAPLAN_TIMEOUT_MS, CCR_TERMS_URL2 = "https://code.claude.com/docs/en/clau
661919
662105
  var init_ultraplan = __esm(() => {
661920
662106
  init_types12();
661921
662107
  init_figures2();
662108
+ init_product();
661922
662109
  init_growthbook();
661923
662110
  init_analytics();
661924
662111
  init_RemoteAgentTask();
@@ -678802,7 +678989,7 @@ var init_bridge_kick = __esm(() => {
678802
678989
  var call56 = async () => {
678803
678990
  return {
678804
678991
  type: "text",
678805
- value: `${"2.1.88-rebuild"} (built ${"2026-04-01T06:28:49.572Z"})`
678992
+ value: `${"2.1.88-rebuild"} (built ${"2026-04-01T08:22:00.019Z"})`
678806
678993
  };
678807
678994
  }, version6, version_default;
678808
678995
  var init_version = __esm(() => {
@@ -704216,7 +704403,7 @@ function CostThresholdDialog(t0) {
704216
704403
  let t4;
704217
704404
  if ($4[4] !== onDone || $4[5] !== t3) {
704218
704405
  t4 = /* @__PURE__ */ import_react290.default.createElement(Dialog, {
704219
- title: "You've spent $5 on the Anthropic API this session.",
704406
+ title: `You've spent $5 on the ${getProviderName()} API this session.`,
704220
704407
  onCancel: onDone
704221
704408
  }, t1, t3);
704222
704409
  $4[4] = onDone;
@@ -704230,6 +704417,7 @@ function CostThresholdDialog(t0) {
704230
704417
  var import_react_compiler_runtime282, import_react290;
704231
704418
  var init_CostThresholdDialog = __esm(() => {
704232
704419
  init_ink2();
704420
+ init_product();
704233
704421
  init_CustomSelect();
704234
704422
  init_Dialog();
704235
704423
  import_react_compiler_runtime282 = __toESM(require_dist7(), 1);
@@ -704874,6 +705062,7 @@ var init_useReplBridge = __esm(() => {
704874
705062
  init_inboundMessages();
704875
705063
  init_replBridgeHandle();
704876
705064
  init_commands2();
705065
+ init_product();
704877
705066
  init_notifications();
704878
705067
  init_ink2();
704879
705068
  init_growthbook();
@@ -756211,7 +756400,7 @@ function PreflightStep(t0) {
756211
756400
  gap: 1
756212
756401
  }, /* @__PURE__ */ import_react439.default.createElement(ThemedText, {
756213
756402
  color: "error"
756214
- }, "Unable to connect to Anthropic services"), /* @__PURE__ */ import_react439.default.createElement(ThemedText, {
756403
+ }, "Unable to connect to ", getProviderName(), " services"), /* @__PURE__ */ import_react439.default.createElement(ThemedText, {
756215
756404
  color: "error"
756216
756405
  }, result?.error), result?.sslHint ? /* @__PURE__ */ import_react439.default.createElement(ThemedBox_default, {
756217
756406
  flexDirection: "column",
@@ -756257,6 +756446,7 @@ var init_preflightChecks = __esm(() => {
756257
756446
  init_useTimeout();
756258
756447
  init_ink2();
756259
756448
  init_errorUtils();
756449
+ init_product();
756260
756450
  init_http2();
756261
756451
  init_log2();
756262
756452
  import_react_compiler_runtime372 = __toESM(require_dist7(), 1);
@@ -756412,7 +756602,7 @@ function WelcomeV2() {
756412
756602
  if ($4[0] !== theme2) {
756413
756603
  t02 = /* @__PURE__ */ import_react441.default.createElement(AppleTerminalWelcomeV2, {
756414
756604
  theme: theme2,
756415
- welcomeMessage: "Welcome to Claude Code"
756605
+ welcomeMessage: `Welcome to ${getProductName()}`
756416
756606
  });
756417
756607
  $4[0] = theme2;
756418
756608
  $4[1] = t02;
@@ -756434,7 +756624,7 @@ function WelcomeV2() {
756434
756624
  if ($4[2] === Symbol.for("react.memo_cache_sentinel")) {
756435
756625
  t02 = /* @__PURE__ */ import_react441.default.createElement(ThemedText, null, /* @__PURE__ */ import_react441.default.createElement(ThemedText, {
756436
756626
  color: "claude"
756437
- }, "Welcome to Claude Code", " "), /* @__PURE__ */ import_react441.default.createElement(ThemedText, {
756627
+ }, `Welcome to ${getProductName()}`, " "), /* @__PURE__ */ import_react441.default.createElement(ThemedText, {
756438
756628
  dimColor: true
756439
756629
  }, "v", "2.1.88-rebuild", " "));
756440
756630
  t17 = /* @__PURE__ */ import_react441.default.createElement(ThemedText, null, "…………………………………………………………………………………………………………………………………………………………");
@@ -756538,7 +756728,7 @@ function WelcomeV2() {
756538
756728
  if ($4[18] === Symbol.for("react.memo_cache_sentinel")) {
756539
756729
  t0 = /* @__PURE__ */ import_react441.default.createElement(ThemedText, null, /* @__PURE__ */ import_react441.default.createElement(ThemedText, {
756540
756730
  color: "claude"
756541
- }, "Welcome to Claude Code", " "), /* @__PURE__ */ import_react441.default.createElement(ThemedText, {
756731
+ }, `Welcome to ${getProductName()}`, " "), /* @__PURE__ */ import_react441.default.createElement(ThemedText, {
756542
756732
  dimColor: true
756543
756733
  }, "v", "2.1.88-rebuild", " "));
756544
756734
  t1 = /* @__PURE__ */ import_react441.default.createElement(ThemedText, null, "…………………………………………………………………………………………………………………………………………………………");
@@ -756941,6 +757131,7 @@ var import_react_compiler_runtime374, import_react441, WELCOME_V2_WIDTH = 58;
756941
757131
  var init_WelcomeV2 = __esm(() => {
756942
757132
  init_ink2();
756943
757133
  init_env();
757134
+ init_product();
756944
757135
  import_react_compiler_runtime374 = __toESM(require_dist7(), 1);
756945
757136
  import_react441 = __toESM(require_react(), 1);
756946
757137
  });
@@ -771425,6 +771616,7 @@ var init_print = __esm(() => {
771425
771616
  init_omit();
771426
771617
  init_reject2();
771427
771618
  init_policyLimits();
771619
+ init_product();
771428
771620
  init_bridgeStatusUtil();
771429
771621
  init_inboundMessages();
771430
771622
  init_inboundAttachments();
@@ -776515,6 +776707,7 @@ var init_main3 = __esm(() => {
776515
776707
  init_pickBy();
776516
776708
  init_uniqBy();
776517
776709
  init_oauth();
776710
+ init_product();
776518
776711
  init_context2();
776519
776712
  init_init3();
776520
776713
  init_history();
@@ -776667,7 +776860,8 @@ if (false) {}
776667
776860
  async function main2() {
776668
776861
  const args = process.argv.slice(2);
776669
776862
  if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
776670
- console.log(`${"2.1.88-rebuild"} (Claude Code)`);
776863
+ const label = process.env.CLAUDE_CODE_USE_OPENAI === "1" ? "Claude Code (OpenAI)" : "Claude Code";
776864
+ console.log(`${"2.1.88-rebuild"} (${label})`);
776671
776865
  return;
776672
776866
  }
776673
776867
  const {
@@ -776751,4 +776945,4 @@ async function main2() {
776751
776945
  }
776752
776946
  main2();
776753
776947
 
776754
- //# debugId=957A2F9C65034C9F64756E2164756E21
776948
+ //# debugId=EA0F0C0F950E52A464756E2164756E21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-openai",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Claude Code CLI with OpenAI GPT-5.4 backend support",
5
5
  "type": "module",
6
6
  "bin": {