@hasna/evals 0.1.22 → 0.1.23

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 (103) hide show
  1. package/dist/cli/index.js +1775 -324
  2. package/dist/index.js +3764 -898
  3. package/dist/mcp/index.js +3450 -1437
  4. package/dist/server/index.js +3764 -898
  5. package/package.json +1 -1
  6. package/dist/adapters/adapters.test.d.ts +0 -2
  7. package/dist/adapters/adapters.test.d.ts.map +0 -1
  8. package/dist/adapters/anthropic-openai.test.d.ts +0 -2
  9. package/dist/adapters/anthropic-openai.test.d.ts.map +0 -1
  10. package/dist/adapters/anthropic.d.ts +0 -4
  11. package/dist/adapters/anthropic.d.ts.map +0 -1
  12. package/dist/adapters/cli.d.ts +0 -4
  13. package/dist/adapters/cli.d.ts.map +0 -1
  14. package/dist/adapters/function.d.ts +0 -4
  15. package/dist/adapters/function.d.ts.map +0 -1
  16. package/dist/adapters/http-cli-coverage.test.d.ts +0 -2
  17. package/dist/adapters/http-cli-coverage.test.d.ts.map +0 -1
  18. package/dist/adapters/http.d.ts +0 -16
  19. package/dist/adapters/http.d.ts.map +0 -1
  20. package/dist/adapters/mcp-adapter.test.d.ts +0 -2
  21. package/dist/adapters/mcp-adapter.test.d.ts.map +0 -1
  22. package/dist/adapters/mcp.d.ts +0 -4
  23. package/dist/adapters/mcp.d.ts.map +0 -1
  24. package/dist/adapters/openai.d.ts +0 -4
  25. package/dist/adapters/openai.d.ts.map +0 -1
  26. package/dist/cli/adapter-parser.d.ts +0 -3
  27. package/dist/cli/adapter-parser.d.ts.map +0 -1
  28. package/dist/cli/cli.test.d.ts +0 -2
  29. package/dist/cli/cli.test.d.ts.map +0 -1
  30. package/dist/cli/commands/calibrate.d.ts +0 -3
  31. package/dist/cli/commands/calibrate.d.ts.map +0 -1
  32. package/dist/cli/commands/capture.d.ts +0 -3
  33. package/dist/cli/commands/capture.d.ts.map +0 -1
  34. package/dist/cli/commands/ci.d.ts +0 -3
  35. package/dist/cli/commands/ci.d.ts.map +0 -1
  36. package/dist/cli/commands/compare.d.ts +0 -5
  37. package/dist/cli/commands/compare.d.ts.map +0 -1
  38. package/dist/cli/commands/compare.test.d.ts +0 -2
  39. package/dist/cli/commands/compare.test.d.ts.map +0 -1
  40. package/dist/cli/commands/completion.d.ts +0 -3
  41. package/dist/cli/commands/completion.d.ts.map +0 -1
  42. package/dist/cli/commands/doctor.d.ts +0 -3
  43. package/dist/cli/commands/doctor.d.ts.map +0 -1
  44. package/dist/cli/commands/estimate.d.ts +0 -3
  45. package/dist/cli/commands/estimate.d.ts.map +0 -1
  46. package/dist/cli/commands/generate.d.ts +0 -3
  47. package/dist/cli/commands/generate.d.ts.map +0 -1
  48. package/dist/cli/commands/judge.d.ts +0 -3
  49. package/dist/cli/commands/judge.d.ts.map +0 -1
  50. package/dist/cli/commands/mcp.d.ts +0 -3
  51. package/dist/cli/commands/mcp.d.ts.map +0 -1
  52. package/dist/cli/commands/run.d.ts +0 -3
  53. package/dist/cli/commands/run.d.ts.map +0 -1
  54. package/dist/cli/commands/sync.d.ts +0 -3
  55. package/dist/cli/commands/sync.d.ts.map +0 -1
  56. package/dist/cli/index.d.ts +0 -3
  57. package/dist/cli/index.d.ts.map +0 -1
  58. package/dist/core/assertions-coverage.test.d.ts +0 -2
  59. package/dist/core/assertions-coverage.test.d.ts.map +0 -1
  60. package/dist/core/assertions.d.ts +0 -18
  61. package/dist/core/assertions.d.ts.map +0 -1
  62. package/dist/core/assertions.test.d.ts +0 -2
  63. package/dist/core/assertions.test.d.ts.map +0 -1
  64. package/dist/core/e2e.test.d.ts +0 -2
  65. package/dist/core/e2e.test.d.ts.map +0 -1
  66. package/dist/core/judge.d.ts +0 -13
  67. package/dist/core/judge.d.ts.map +0 -1
  68. package/dist/core/judge.test.d.ts +0 -2
  69. package/dist/core/judge.test.d.ts.map +0 -1
  70. package/dist/core/reporter.d.ts +0 -21
  71. package/dist/core/reporter.d.ts.map +0 -1
  72. package/dist/core/reporter.test.d.ts +0 -2
  73. package/dist/core/reporter.test.d.ts.map +0 -1
  74. package/dist/core/runner.d.ts +0 -4
  75. package/dist/core/runner.d.ts.map +0 -1
  76. package/dist/core/runner.test.d.ts +0 -2
  77. package/dist/core/runner.test.d.ts.map +0 -1
  78. package/dist/datasets/loader.d.ts +0 -18
  79. package/dist/datasets/loader.d.ts.map +0 -1
  80. package/dist/datasets/loader.test.d.ts +0 -2
  81. package/dist/datasets/loader.test.d.ts.map +0 -1
  82. package/dist/db/store.d.ts +0 -17
  83. package/dist/db/store.d.ts.map +0 -1
  84. package/dist/db/store.test.d.ts +0 -2
  85. package/dist/db/store.test.d.ts.map +0 -1
  86. package/dist/index.d.ts +0 -8
  87. package/dist/index.d.ts.map +0 -1
  88. package/dist/mcp/http.d.ts +0 -12
  89. package/dist/mcp/http.d.ts.map +0 -1
  90. package/dist/mcp/http.test.d.ts +0 -2
  91. package/dist/mcp/http.test.d.ts.map +0 -1
  92. package/dist/mcp/index.d.ts +0 -3
  93. package/dist/mcp/index.d.ts.map +0 -1
  94. package/dist/mcp/mcp.test.d.ts +0 -2
  95. package/dist/mcp/mcp.test.d.ts.map +0 -1
  96. package/dist/mcp/server.d.ts +0 -5
  97. package/dist/mcp/server.d.ts.map +0 -1
  98. package/dist/server/index.d.ts +0 -3
  99. package/dist/server/index.d.ts.map +0 -1
  100. package/dist/server/server.test.d.ts +0 -2
  101. package/dist/server/server.test.d.ts.map +0 -1
  102. package/dist/types/index.d.ts +0 -171
  103. package/dist/types/index.d.ts.map +0 -1
package/dist/cli/index.js CHANGED
@@ -5275,6 +5275,9 @@ var require_data = __commonJS((exports, module) => {
5275
5275
  var require_utils = __commonJS((exports, module) => {
5276
5276
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
5277
5277
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
5278
+ var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
5279
+ var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
5280
+ var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
5278
5281
  function stringArrayToHexStripped(input) {
5279
5282
  let acc = "";
5280
5283
  let code = 0;
@@ -5468,27 +5471,77 @@ var require_utils = __commonJS((exports, module) => {
5468
5471
  }
5469
5472
  return output.join("");
5470
5473
  }
5471
- function normalizeComponentEncoding(component, esc) {
5472
- const func = esc !== true ? escape : unescape;
5473
- if (component.scheme !== undefined) {
5474
- component.scheme = func(component.scheme);
5475
- }
5476
- if (component.userinfo !== undefined) {
5477
- component.userinfo = func(component.userinfo);
5478
- }
5479
- if (component.host !== undefined) {
5480
- component.host = func(component.host);
5474
+ var HOST_DELIMS = { "@": "%40", "/": "%2F", "?": "%3F", "#": "%23", ":": "%3A" };
5475
+ var HOST_DELIM_RE = /[@/?#:]/g;
5476
+ var HOST_DELIM_NO_COLON_RE = /[@/?#]/g;
5477
+ function reescapeHostDelimiters(host, isIP) {
5478
+ const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
5479
+ re.lastIndex = 0;
5480
+ return host.replace(re, (ch) => HOST_DELIMS[ch]);
5481
+ }
5482
+ function normalizePercentEncoding(input, decodeUnreserved = false) {
5483
+ if (input.indexOf("%") === -1) {
5484
+ return input;
5481
5485
  }
5482
- if (component.path !== undefined) {
5483
- component.path = func(component.path);
5486
+ let output = "";
5487
+ for (let i = 0;i < input.length; i++) {
5488
+ if (input[i] === "%" && i + 2 < input.length) {
5489
+ const hex = input.slice(i + 1, i + 3);
5490
+ if (isHexPair(hex)) {
5491
+ const normalizedHex = hex.toUpperCase();
5492
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
5493
+ if (decodeUnreserved && isUnreserved(decoded)) {
5494
+ output += decoded;
5495
+ } else {
5496
+ output += "%" + normalizedHex;
5497
+ }
5498
+ i += 2;
5499
+ continue;
5500
+ }
5501
+ }
5502
+ output += input[i];
5484
5503
  }
5485
- if (component.query !== undefined) {
5486
- component.query = func(component.query);
5504
+ return output;
5505
+ }
5506
+ function normalizePathEncoding(input) {
5507
+ let output = "";
5508
+ for (let i = 0;i < input.length; i++) {
5509
+ if (input[i] === "%" && i + 2 < input.length) {
5510
+ const hex = input.slice(i + 1, i + 3);
5511
+ if (isHexPair(hex)) {
5512
+ const normalizedHex = hex.toUpperCase();
5513
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
5514
+ if (decoded !== "." && isUnreserved(decoded)) {
5515
+ output += decoded;
5516
+ } else {
5517
+ output += "%" + normalizedHex;
5518
+ }
5519
+ i += 2;
5520
+ continue;
5521
+ }
5522
+ }
5523
+ if (isPathCharacter(input[i])) {
5524
+ output += input[i];
5525
+ } else {
5526
+ output += escape(input[i]);
5527
+ }
5487
5528
  }
5488
- if (component.fragment !== undefined) {
5489
- component.fragment = func(component.fragment);
5529
+ return output;
5530
+ }
5531
+ function escapePreservingEscapes(input) {
5532
+ let output = "";
5533
+ for (let i = 0;i < input.length; i++) {
5534
+ if (input[i] === "%" && i + 2 < input.length) {
5535
+ const hex = input.slice(i + 1, i + 3);
5536
+ if (isHexPair(hex)) {
5537
+ output += "%" + hex.toUpperCase();
5538
+ i += 2;
5539
+ continue;
5540
+ }
5541
+ }
5542
+ output += escape(input[i]);
5490
5543
  }
5491
- return component;
5544
+ return output;
5492
5545
  }
5493
5546
  function recomposeAuthority(component) {
5494
5547
  const uriTokens = [];
@@ -5503,7 +5556,7 @@ var require_utils = __commonJS((exports, module) => {
5503
5556
  if (ipV6res.isIPV6 === true) {
5504
5557
  host = `[${ipV6res.escapedHost}]`;
5505
5558
  } else {
5506
- host = component.host;
5559
+ host = reescapeHostDelimiters(host, false);
5507
5560
  }
5508
5561
  }
5509
5562
  uriTokens.push(host);
@@ -5517,7 +5570,10 @@ var require_utils = __commonJS((exports, module) => {
5517
5570
  module.exports = {
5518
5571
  nonSimpleDomain,
5519
5572
  recomposeAuthority,
5520
- normalizeComponentEncoding,
5573
+ reescapeHostDelimiters,
5574
+ normalizePercentEncoding,
5575
+ normalizePathEncoding,
5576
+ escapePreservingEscapes,
5521
5577
  removeDotSegments,
5522
5578
  isIPv4,
5523
5579
  isUUID,
@@ -5702,11 +5758,11 @@ var require_schemes = __commonJS((exports, module) => {
5702
5758
 
5703
5759
  // node_modules/fast-uri/index.js
5704
5760
  var require_fast_uri = __commonJS((exports, module) => {
5705
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils();
5761
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
5706
5762
  var { SCHEMES, getSchemeHandler } = require_schemes();
5707
5763
  function normalize(uri, options) {
5708
5764
  if (typeof uri === "string") {
5709
- uri = serialize(parse(uri, options), options);
5765
+ uri = normalizeString(uri, options);
5710
5766
  } else if (typeof uri === "object") {
5711
5767
  uri = parse(serialize(uri, options), options);
5712
5768
  }
@@ -5772,19 +5828,9 @@ var require_fast_uri = __commonJS((exports, module) => {
5772
5828
  return target;
5773
5829
  }
5774
5830
  function equal(uriA, uriB, options) {
5775
- if (typeof uriA === "string") {
5776
- uriA = unescape(uriA);
5777
- uriA = serialize(normalizeComponentEncoding(parse(uriA, options), true), { ...options, skipEscape: true });
5778
- } else if (typeof uriA === "object") {
5779
- uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
5780
- }
5781
- if (typeof uriB === "string") {
5782
- uriB = unescape(uriB);
5783
- uriB = serialize(normalizeComponentEncoding(parse(uriB, options), true), { ...options, skipEscape: true });
5784
- } else if (typeof uriB === "object") {
5785
- uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
5786
- }
5787
- return uriA.toLowerCase() === uriB.toLowerCase();
5831
+ const normalizedA = normalizeComparableURI(uriA, options);
5832
+ const normalizedB = normalizeComparableURI(uriB, options);
5833
+ return normalizedA !== undefined && normalizedB !== undefined && normalizedA.toLowerCase() === normalizedB.toLowerCase();
5788
5834
  }
5789
5835
  function serialize(cmpts, opts) {
5790
5836
  const component = {
@@ -5810,12 +5856,12 @@ var require_fast_uri = __commonJS((exports, module) => {
5810
5856
  schemeHandler.serialize(component, options);
5811
5857
  if (component.path !== undefined) {
5812
5858
  if (!options.skipEscape) {
5813
- component.path = escape(component.path);
5859
+ component.path = escapePreservingEscapes(component.path);
5814
5860
  if (component.scheme !== undefined) {
5815
5861
  component.path = component.path.split("%3A").join(":");
5816
5862
  }
5817
5863
  } else {
5818
- component.path = unescape(component.path);
5864
+ component.path = normalizePercentEncoding(component.path);
5819
5865
  }
5820
5866
  }
5821
5867
  if (options.reference !== "suffix" && component.scheme) {
@@ -5850,7 +5896,16 @@ var require_fast_uri = __commonJS((exports, module) => {
5850
5896
  return uriTokens.join("");
5851
5897
  }
5852
5898
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
5853
- function parse(uri, opts) {
5899
+ function getParseError(parsed, matches) {
5900
+ if (matches[2] !== undefined && parsed.path && parsed.path[0] !== "/") {
5901
+ return 'URI path must start with "/" when authority is present.';
5902
+ }
5903
+ if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
5904
+ return "URI port is malformed.";
5905
+ }
5906
+ return;
5907
+ }
5908
+ function parseWithStatus(uri, opts) {
5854
5909
  const options = Object.assign({}, opts);
5855
5910
  const parsed = {
5856
5911
  scheme: undefined,
@@ -5861,6 +5916,7 @@ var require_fast_uri = __commonJS((exports, module) => {
5861
5916
  query: undefined,
5862
5917
  fragment: undefined
5863
5918
  };
5919
+ let malformedAuthorityOrPort = false;
5864
5920
  let isIP = false;
5865
5921
  if (options.reference === "suffix") {
5866
5922
  if (options.scheme) {
@@ -5881,6 +5937,11 @@ var require_fast_uri = __commonJS((exports, module) => {
5881
5937
  if (isNaN(parsed.port)) {
5882
5938
  parsed.port = matches[5];
5883
5939
  }
5940
+ const parseError = getParseError(parsed, matches);
5941
+ if (parseError !== undefined) {
5942
+ parsed.error = parsed.error || parseError;
5943
+ malformedAuthorityOrPort = true;
5944
+ }
5884
5945
  if (parsed.host) {
5885
5946
  const ipv4result = isIPv4(parsed.host);
5886
5947
  if (ipv4result === false) {
@@ -5919,14 +5980,18 @@ var require_fast_uri = __commonJS((exports, module) => {
5919
5980
  parsed.scheme = unescape(parsed.scheme);
5920
5981
  }
5921
5982
  if (parsed.host !== undefined) {
5922
- parsed.host = unescape(parsed.host);
5983
+ parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
5923
5984
  }
5924
5985
  }
5925
5986
  if (parsed.path) {
5926
- parsed.path = escape(unescape(parsed.path));
5987
+ parsed.path = normalizePathEncoding(parsed.path);
5927
5988
  }
5928
5989
  if (parsed.fragment) {
5929
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
5990
+ try {
5991
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
5992
+ } catch {
5993
+ parsed.error = parsed.error || "URI malformed";
5994
+ }
5930
5995
  }
5931
5996
  }
5932
5997
  if (schemeHandler && schemeHandler.parse) {
@@ -5935,7 +6000,29 @@ var require_fast_uri = __commonJS((exports, module) => {
5935
6000
  } else {
5936
6001
  parsed.error = parsed.error || "URI can not be parsed.";
5937
6002
  }
5938
- return parsed;
6003
+ return { parsed, malformedAuthorityOrPort };
6004
+ }
6005
+ function parse(uri, opts) {
6006
+ return parseWithStatus(uri, opts).parsed;
6007
+ }
6008
+ function normalizeString(uri, opts) {
6009
+ return normalizeStringWithStatus(uri, opts).normalized;
6010
+ }
6011
+ function normalizeStringWithStatus(uri, opts) {
6012
+ const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
6013
+ return {
6014
+ normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
6015
+ malformedAuthorityOrPort
6016
+ };
6017
+ }
6018
+ function normalizeComparableURI(uri, opts) {
6019
+ if (typeof uri === "string") {
6020
+ const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
6021
+ return malformedAuthorityOrPort ? undefined : normalized;
6022
+ }
6023
+ if (typeof uri === "object") {
6024
+ return serialize(uri, opts);
6025
+ }
5939
6026
  }
5940
6027
  var fastUri = {
5941
6028
  SCHEMES,
@@ -6070,7 +6157,7 @@ var require_core = __commonJS((exports) => {
6070
6157
  constructor(opts = {}) {
6071
6158
  this.schemas = {};
6072
6159
  this.refs = {};
6073
- this.formats = {};
6160
+ this.formats = Object.create(null);
6074
6161
  this._compilations = new Set;
6075
6162
  this._loading = {};
6076
6163
  this._cache = new Map;
@@ -24195,6 +24282,33 @@ class InvalidWebhookSignatureError extends Error {
24195
24282
  }
24196
24283
  }
24197
24284
 
24285
+ class OAuthError extends APIError2 {
24286
+ constructor(status, error2, headers) {
24287
+ let finalMessage = "OAuth2 authentication error";
24288
+ let error_code = undefined;
24289
+ if (error2 && typeof error2 === "object") {
24290
+ const errorData = error2;
24291
+ error_code = errorData["error"];
24292
+ const description = errorData["error_description"];
24293
+ if (description && typeof description === "string") {
24294
+ finalMessage = description;
24295
+ } else if (error_code) {
24296
+ finalMessage = error_code;
24297
+ }
24298
+ }
24299
+ super(status, error2, finalMessage, headers);
24300
+ this.error_code = error_code;
24301
+ }
24302
+ }
24303
+
24304
+ class SubjectTokenProviderError extends OpenAIError {
24305
+ constructor(message, provider, cause) {
24306
+ super(message);
24307
+ this.provider = provider;
24308
+ this.cause = cause;
24309
+ }
24310
+ }
24311
+
24198
24312
  // node_modules/openai/internal/utils/values.mjs
24199
24313
  var startsWithSchemeRegexp2 = /^[a-z][a-z0-9+.-]*:/i;
24200
24314
  var isAbsoluteURL2 = (url) => {
@@ -24242,7 +24356,7 @@ var safeJSON2 = (text) => {
24242
24356
  var sleep2 = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
24243
24357
 
24244
24358
  // node_modules/openai/version.mjs
24245
- var VERSION2 = "6.33.0";
24359
+ var VERSION2 = "6.39.0";
24246
24360
 
24247
24361
  // node_modules/openai/internal/detect-platform.mjs
24248
24362
  var isRunningInBrowser2 = () => {
@@ -24933,7 +25047,7 @@ var formatRequestDetails2 = (details) => {
24933
25047
  if (details.headers) {
24934
25048
  details.headers = Object.fromEntries((details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map(([name, value]) => [
24935
25049
  name,
24936
- name.toLowerCase() === "authorization" || name.toLowerCase() === "cookie" || name.toLowerCase() === "set-cookie" ? "***" : value
25050
+ name.toLowerCase() === "authorization" || name.toLowerCase() === "api-key" || name.toLowerCase() === "x-api-key" || name.toLowerCase() === "cookie" || name.toLowerCase() === "set-cookie" ? "***" : value
24937
25051
  ]));
24938
25052
  }
24939
25053
  if ("retryOfRequestLogID" in details) {
@@ -25414,6 +25528,125 @@ class ConversationCursorPage extends AbstractPage2 {
25414
25528
  }
25415
25529
  }
25416
25530
 
25531
+ class NextCursorPage extends AbstractPage2 {
25532
+ constructor(client, response, body, options) {
25533
+ super(client, response, body, options);
25534
+ this.data = body.data || [];
25535
+ this.has_more = body.has_more || false;
25536
+ this.next = body.next || null;
25537
+ }
25538
+ getPaginatedItems() {
25539
+ return this.data ?? [];
25540
+ }
25541
+ hasNextPage() {
25542
+ if (this.has_more === false) {
25543
+ return false;
25544
+ }
25545
+ return super.hasNextPage();
25546
+ }
25547
+ nextPageRequestOptions() {
25548
+ const cursor = this.next;
25549
+ if (!cursor) {
25550
+ return null;
25551
+ }
25552
+ return {
25553
+ ...this.options,
25554
+ query: {
25555
+ ...maybeObj2(this.options.query),
25556
+ after: cursor
25557
+ }
25558
+ };
25559
+ }
25560
+ }
25561
+
25562
+ // node_modules/openai/auth/workload-identity-auth.mjs
25563
+ var SUBJECT_TOKEN_TYPES = {
25564
+ jwt: "urn:ietf:params:oauth:token-type:jwt",
25565
+ id: "urn:ietf:params:oauth:token-type:id_token"
25566
+ };
25567
+ var TOKEN_EXCHANGE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:token-exchange";
25568
+
25569
+ class WorkloadIdentityAuth {
25570
+ constructor(config, fetch2) {
25571
+ this.cachedToken = null;
25572
+ this.refreshPromise = null;
25573
+ this.tokenExchangeUrl = "https://auth.openai.com/oauth/token";
25574
+ this.config = config;
25575
+ this.fetch = fetch2 ?? getDefaultFetch2();
25576
+ }
25577
+ async getToken() {
25578
+ if (!this.cachedToken || this.isTokenExpired(this.cachedToken)) {
25579
+ if (this.refreshPromise) {
25580
+ return await this.refreshPromise;
25581
+ }
25582
+ this.refreshPromise = this.refreshToken();
25583
+ try {
25584
+ const token = await this.refreshPromise;
25585
+ return token;
25586
+ } finally {
25587
+ this.refreshPromise = null;
25588
+ }
25589
+ }
25590
+ if (this.needsRefresh(this.cachedToken) && !this.refreshPromise) {
25591
+ this.refreshPromise = this.refreshToken().finally(() => {
25592
+ this.refreshPromise = null;
25593
+ });
25594
+ }
25595
+ return this.cachedToken.token;
25596
+ }
25597
+ async refreshToken() {
25598
+ const subjectToken = await this.config.provider.getToken();
25599
+ const body = {
25600
+ grant_type: TOKEN_EXCHANGE_GRANT_TYPE,
25601
+ subject_token: subjectToken,
25602
+ subject_token_type: SUBJECT_TOKEN_TYPES[this.config.provider.tokenType],
25603
+ identity_provider_id: this.config.identityProviderId,
25604
+ service_account_id: this.config.serviceAccountId
25605
+ };
25606
+ if (this.config.clientId) {
25607
+ body["client_id"] = this.config.clientId;
25608
+ }
25609
+ const response = await this.fetch(this.tokenExchangeUrl, {
25610
+ method: "POST",
25611
+ headers: {
25612
+ "Content-Type": "application/json"
25613
+ },
25614
+ body: JSON.stringify(body)
25615
+ });
25616
+ if (!response.ok) {
25617
+ const errorText = await response.text();
25618
+ let body2 = undefined;
25619
+ try {
25620
+ body2 = JSON.parse(errorText);
25621
+ } catch {}
25622
+ if (response.status === 400 || response.status === 401 || response.status === 403) {
25623
+ throw new OAuthError(response.status, body2, response.headers);
25624
+ }
25625
+ throw APIError2.generate(response.status, body2, `Token exchange failed with status ${response.status}`, response.headers);
25626
+ }
25627
+ const tokenResponse = await response.json();
25628
+ const expiresIn = tokenResponse.expires_in || 3600;
25629
+ const expiresAt = Date.now() + expiresIn * 1000;
25630
+ this.cachedToken = {
25631
+ token: tokenResponse.access_token,
25632
+ expiresAt
25633
+ };
25634
+ return tokenResponse.access_token;
25635
+ }
25636
+ isTokenExpired(cachedToken) {
25637
+ return Date.now() >= cachedToken.expiresAt;
25638
+ }
25639
+ needsRefresh(cachedToken) {
25640
+ const bufferSeconds = this.config.refreshBufferSeconds ?? 1200;
25641
+ const bufferMs = bufferSeconds * 1000;
25642
+ return Date.now() >= cachedToken.expiresAt - bufferMs;
25643
+ }
25644
+ invalidateToken() {
25645
+ this.cachedToken = null;
25646
+ this.refreshPromise = null;
25647
+ }
25648
+ }
25649
+
25417
25650
  // node_modules/openai/internal/uploads.mjs
25418
25651
  var checkFileSupport2 = () => {
25419
25652
  if (typeof File === "undefined") {
@@ -25620,7 +25853,7 @@ var path2 = /* @__PURE__ */ createPathTagFunction2(encodeURIPath2);
25620
25853
  // node_modules/openai/resources/chat/completions/messages.mjs
25621
25854
  class Messages3 extends APIResource2 {
25622
25855
  list(completionID, query = {}, options) {
25623
- return this._client.getAPIList(path2`/chat/completions/${completionID}/messages`, CursorPage, { query, ...options });
25856
+ return this._client.getAPIList(path2`/chat/completions/${completionID}/messages`, CursorPage, { query, ...options, __security: { bearerAuth: true } });
25624
25857
  }
25625
25858
  }
25626
25859
  // node_modules/openai/lib/parser.mjs
@@ -26881,19 +27114,38 @@ class Completions2 extends APIResource2 {
26881
27114
  this.messages = new Messages3(this._client);
26882
27115
  }
26883
27116
  create(body, options) {
26884
- return this._client.post("/chat/completions", { body, ...options, stream: body.stream ?? false });
27117
+ return this._client.post("/chat/completions", {
27118
+ body,
27119
+ ...options,
27120
+ stream: body.stream ?? false,
27121
+ __security: { bearerAuth: true }
27122
+ });
26885
27123
  }
26886
27124
  retrieve(completionID, options) {
26887
- return this._client.get(path2`/chat/completions/${completionID}`, options);
27125
+ return this._client.get(path2`/chat/completions/${completionID}`, {
27126
+ ...options,
27127
+ __security: { bearerAuth: true }
27128
+ });
26888
27129
  }
26889
27130
  update(completionID, body, options) {
26890
- return this._client.post(path2`/chat/completions/${completionID}`, { body, ...options });
27131
+ return this._client.post(path2`/chat/completions/${completionID}`, {
27132
+ body,
27133
+ ...options,
27134
+ __security: { bearerAuth: true }
27135
+ });
26891
27136
  }
26892
27137
  list(query = {}, options) {
26893
- return this._client.getAPIList("/chat/completions", CursorPage, { query, ...options });
27138
+ return this._client.getAPIList("/chat/completions", CursorPage, {
27139
+ query,
27140
+ ...options,
27141
+ __security: { bearerAuth: true }
27142
+ });
26894
27143
  }
26895
27144
  delete(completionID, options) {
26896
- return this._client.delete(path2`/chat/completions/${completionID}`, options);
27145
+ return this._client.delete(path2`/chat/completions/${completionID}`, {
27146
+ ...options,
27147
+ __security: { bearerAuth: true }
27148
+ });
26897
27149
  }
26898
27150
  parse(body, options) {
26899
27151
  validateInputTools(body.tools);
@@ -26925,160 +27177,1053 @@ class Chat extends APIResource2 {
26925
27177
  }
26926
27178
  }
26927
27179
  Chat.Completions = Completions2;
26928
- // node_modules/openai/internal/headers.mjs
26929
- var brand_privateNullableHeaders2 = /* @__PURE__ */ Symbol("brand.privateNullableHeaders");
26930
- function* iterateHeaders2(headers) {
26931
- if (!headers)
26932
- return;
26933
- if (brand_privateNullableHeaders2 in headers) {
26934
- const { values, nulls } = headers;
26935
- yield* values.entries();
26936
- for (const name of nulls) {
26937
- yield [name, null];
26938
- }
26939
- return;
26940
- }
26941
- let shouldClear = false;
26942
- let iter;
26943
- if (headers instanceof Headers) {
26944
- iter = headers.entries();
26945
- } else if (isReadonlyArray2(headers)) {
26946
- iter = headers;
26947
- } else {
26948
- shouldClear = true;
26949
- iter = Object.entries(headers ?? {});
26950
- }
26951
- for (let row of iter) {
26952
- const name = row[0];
26953
- if (typeof name !== "string")
26954
- throw new TypeError("expected header name to be a string");
26955
- const values = isReadonlyArray2(row[1]) ? row[1] : [row[1]];
26956
- let didClear = false;
26957
- for (const value of values) {
26958
- if (value === undefined)
26959
- continue;
26960
- if (shouldClear && !didClear) {
26961
- didClear = true;
26962
- yield [name, null];
26963
- }
26964
- yield [name, value];
26965
- }
26966
- }
26967
- }
26968
- var buildHeaders2 = (newHeaders) => {
26969
- const targetHeaders = new Headers;
26970
- const nullHeaders = new Set;
26971
- for (const headers of newHeaders) {
26972
- const seenHeaders = new Set;
26973
- for (const [name, value] of iterateHeaders2(headers)) {
26974
- const lowerName = name.toLowerCase();
26975
- if (!seenHeaders.has(lowerName)) {
26976
- targetHeaders.delete(name);
26977
- seenHeaders.add(lowerName);
26978
- }
26979
- if (value === null) {
26980
- targetHeaders.delete(name);
26981
- nullHeaders.add(lowerName);
26982
- } else {
26983
- targetHeaders.append(name, value);
26984
- nullHeaders.delete(lowerName);
26985
- }
26986
- }
26987
- }
26988
- return { [brand_privateNullableHeaders2]: true, values: targetHeaders, nulls: nullHeaders };
26989
- };
26990
-
26991
- // node_modules/openai/resources/audio/speech.mjs
26992
- class Speech extends APIResource2 {
27180
+ // node_modules/openai/resources/admin/organization/admin-api-keys.mjs
27181
+ class AdminAPIKeys extends APIResource2 {
26993
27182
  create(body, options) {
26994
- return this._client.post("/audio/speech", {
27183
+ return this._client.post("/organization/admin_api_keys", {
26995
27184
  body,
26996
27185
  ...options,
26997
- headers: buildHeaders2([{ Accept: "application/octet-stream" }, options?.headers]),
26998
- __binaryResponse: true
27186
+ __security: { adminAPIKeyAuth: true }
26999
27187
  });
27000
27188
  }
27001
- }
27002
-
27003
- // node_modules/openai/resources/audio/transcriptions.mjs
27004
- class Transcriptions extends APIResource2 {
27005
- create(body, options) {
27006
- return this._client.post("/audio/transcriptions", multipartFormRequestOptions2({
27007
- body,
27189
+ retrieve(keyID, options) {
27190
+ return this._client.get(path2`/organization/admin_api_keys/${keyID}`, {
27008
27191
  ...options,
27009
- stream: body.stream ?? false,
27010
- __metadata: { model: body.model }
27011
- }, this._client));
27192
+ __security: { adminAPIKeyAuth: true }
27193
+ });
27012
27194
  }
27013
- }
27014
-
27015
- // node_modules/openai/resources/audio/translations.mjs
27016
- class Translations extends APIResource2 {
27017
- create(body, options) {
27018
- return this._client.post("/audio/translations", multipartFormRequestOptions2({ body, ...options, __metadata: { model: body.model } }, this._client));
27195
+ list(query = {}, options) {
27196
+ return this._client.getAPIList("/organization/admin_api_keys", CursorPage, {
27197
+ query,
27198
+ ...options,
27199
+ __security: { adminAPIKeyAuth: true }
27200
+ });
27019
27201
  }
27020
- }
27021
-
27022
- // node_modules/openai/resources/audio/audio.mjs
27023
- class Audio extends APIResource2 {
27024
- constructor() {
27025
- super(...arguments);
27026
- this.transcriptions = new Transcriptions(this._client);
27027
- this.translations = new Translations(this._client);
27028
- this.speech = new Speech(this._client);
27202
+ delete(keyID, options) {
27203
+ return this._client.delete(path2`/organization/admin_api_keys/${keyID}`, {
27204
+ ...options,
27205
+ __security: { adminAPIKeyAuth: true }
27206
+ });
27029
27207
  }
27030
27208
  }
27031
- Audio.Transcriptions = Transcriptions;
27032
- Audio.Translations = Translations;
27033
- Audio.Speech = Speech;
27034
- // node_modules/openai/resources/batches.mjs
27035
- class Batches3 extends APIResource2 {
27036
- create(body, options) {
27037
- return this._client.post("/batches", { body, ...options });
27038
- }
27039
- retrieve(batchID, options) {
27040
- return this._client.get(path2`/batches/${batchID}`, options);
27041
- }
27209
+
27210
+ // node_modules/openai/resources/admin/organization/audit-logs.mjs
27211
+ class AuditLogs extends APIResource2 {
27042
27212
  list(query = {}, options) {
27043
- return this._client.getAPIList("/batches", CursorPage, { query, ...options });
27044
- }
27045
- cancel(batchID, options) {
27046
- return this._client.post(path2`/batches/${batchID}/cancel`, options);
27213
+ return this._client.getAPIList("/organization/audit_logs", ConversationCursorPage, {
27214
+ query,
27215
+ ...options,
27216
+ __security: { adminAPIKeyAuth: true }
27217
+ });
27047
27218
  }
27048
27219
  }
27049
- // node_modules/openai/resources/beta/assistants.mjs
27050
- class Assistants extends APIResource2 {
27220
+
27221
+ // node_modules/openai/resources/admin/organization/certificates.mjs
27222
+ class Certificates extends APIResource2 {
27051
27223
  create(body, options) {
27052
- return this._client.post("/assistants", {
27224
+ return this._client.post("/organization/certificates", {
27053
27225
  body,
27054
27226
  ...options,
27055
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
27227
+ __security: { adminAPIKeyAuth: true }
27056
27228
  });
27057
27229
  }
27058
- retrieve(assistantID, options) {
27059
- return this._client.get(path2`/assistants/${assistantID}`, {
27230
+ retrieve(certificateID, query = {}, options) {
27231
+ return this._client.get(path2`/organization/certificates/${certificateID}`, {
27232
+ query,
27060
27233
  ...options,
27061
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
27234
+ __security: { adminAPIKeyAuth: true }
27062
27235
  });
27063
27236
  }
27064
- update(assistantID, body, options) {
27065
- return this._client.post(path2`/assistants/${assistantID}`, {
27237
+ update(certificateID, body, options) {
27238
+ return this._client.post(path2`/organization/certificates/${certificateID}`, {
27066
27239
  body,
27067
27240
  ...options,
27068
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
27241
+ __security: { adminAPIKeyAuth: true }
27069
27242
  });
27070
27243
  }
27071
27244
  list(query = {}, options) {
27072
- return this._client.getAPIList("/assistants", CursorPage, {
27245
+ return this._client.getAPIList("/organization/certificates", ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
27246
+ }
27247
+ delete(certificateID, options) {
27248
+ return this._client.delete(path2`/organization/certificates/${certificateID}`, {
27249
+ ...options,
27250
+ __security: { adminAPIKeyAuth: true }
27251
+ });
27252
+ }
27253
+ activate(body, options) {
27254
+ return this._client.getAPIList("/organization/certificates/activate", Page2, {
27255
+ body,
27256
+ method: "post",
27257
+ ...options,
27258
+ __security: { adminAPIKeyAuth: true }
27259
+ });
27260
+ }
27261
+ deactivate(body, options) {
27262
+ return this._client.getAPIList("/organization/certificates/deactivate", Page2, { body, method: "post", ...options, __security: { adminAPIKeyAuth: true } });
27263
+ }
27264
+ }
27265
+
27266
+ // node_modules/openai/resources/admin/organization/data-retention.mjs
27267
+ class DataRetention extends APIResource2 {
27268
+ retrieve(options) {
27269
+ return this._client.get("/organization/data_retention", {
27270
+ ...options,
27271
+ __security: { adminAPIKeyAuth: true }
27272
+ });
27273
+ }
27274
+ update(body, options) {
27275
+ return this._client.post("/organization/data_retention", {
27276
+ body,
27277
+ ...options,
27278
+ __security: { adminAPIKeyAuth: true }
27279
+ });
27280
+ }
27281
+ }
27282
+
27283
+ // node_modules/openai/resources/admin/organization/invites.mjs
27284
+ class Invites extends APIResource2 {
27285
+ create(body, options) {
27286
+ return this._client.post("/organization/invites", {
27287
+ body,
27288
+ ...options,
27289
+ __security: { adminAPIKeyAuth: true }
27290
+ });
27291
+ }
27292
+ retrieve(inviteID, options) {
27293
+ return this._client.get(path2`/organization/invites/${inviteID}`, {
27294
+ ...options,
27295
+ __security: { adminAPIKeyAuth: true }
27296
+ });
27297
+ }
27298
+ list(query = {}, options) {
27299
+ return this._client.getAPIList("/organization/invites", ConversationCursorPage, {
27300
+ query,
27301
+ ...options,
27302
+ __security: { adminAPIKeyAuth: true }
27303
+ });
27304
+ }
27305
+ delete(inviteID, options) {
27306
+ return this._client.delete(path2`/organization/invites/${inviteID}`, {
27307
+ ...options,
27308
+ __security: { adminAPIKeyAuth: true }
27309
+ });
27310
+ }
27311
+ }
27312
+
27313
+ // node_modules/openai/resources/admin/organization/roles.mjs
27314
+ class Roles extends APIResource2 {
27315
+ create(body, options) {
27316
+ return this._client.post("/organization/roles", {
27317
+ body,
27318
+ ...options,
27319
+ __security: { adminAPIKeyAuth: true }
27320
+ });
27321
+ }
27322
+ retrieve(roleID, options) {
27323
+ return this._client.get(path2`/organization/roles/${roleID}`, {
27324
+ ...options,
27325
+ __security: { adminAPIKeyAuth: true }
27326
+ });
27327
+ }
27328
+ update(roleID, body, options) {
27329
+ return this._client.post(path2`/organization/roles/${roleID}`, {
27330
+ body,
27331
+ ...options,
27332
+ __security: { adminAPIKeyAuth: true }
27333
+ });
27334
+ }
27335
+ list(query = {}, options) {
27336
+ return this._client.getAPIList("/organization/roles", NextCursorPage, {
27337
+ query,
27338
+ ...options,
27339
+ __security: { adminAPIKeyAuth: true }
27340
+ });
27341
+ }
27342
+ delete(roleID, options) {
27343
+ return this._client.delete(path2`/organization/roles/${roleID}`, {
27344
+ ...options,
27345
+ __security: { adminAPIKeyAuth: true }
27346
+ });
27347
+ }
27348
+ }
27349
+
27350
+ // node_modules/openai/resources/admin/organization/spend-alerts.mjs
27351
+ class SpendAlerts extends APIResource2 {
27352
+ create(body, options) {
27353
+ return this._client.post("/organization/spend_alerts", {
27354
+ body,
27355
+ ...options,
27356
+ __security: { adminAPIKeyAuth: true }
27357
+ });
27358
+ }
27359
+ update(alertID, body, options) {
27360
+ return this._client.post(path2`/organization/spend_alerts/${alertID}`, {
27361
+ body,
27362
+ ...options,
27363
+ __security: { adminAPIKeyAuth: true }
27364
+ });
27365
+ }
27366
+ list(query = {}, options) {
27367
+ return this._client.getAPIList("/organization/spend_alerts", ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
27368
+ }
27369
+ delete(alertID, options) {
27370
+ return this._client.delete(path2`/organization/spend_alerts/${alertID}`, {
27371
+ ...options,
27372
+ __security: { adminAPIKeyAuth: true }
27373
+ });
27374
+ }
27375
+ }
27376
+
27377
+ // node_modules/openai/resources/admin/organization/usage.mjs
27378
+ class Usage extends APIResource2 {
27379
+ audioSpeeches(query, options) {
27380
+ return this._client.get("/organization/usage/audio_speeches", {
27381
+ query,
27382
+ ...options,
27383
+ __security: { adminAPIKeyAuth: true }
27384
+ });
27385
+ }
27386
+ audioTranscriptions(query, options) {
27387
+ return this._client.get("/organization/usage/audio_transcriptions", {
27388
+ query,
27389
+ ...options,
27390
+ __security: { adminAPIKeyAuth: true }
27391
+ });
27392
+ }
27393
+ codeInterpreterSessions(query, options) {
27394
+ return this._client.get("/organization/usage/code_interpreter_sessions", {
27395
+ query,
27396
+ ...options,
27397
+ __security: { adminAPIKeyAuth: true }
27398
+ });
27399
+ }
27400
+ completions(query, options) {
27401
+ return this._client.get("/organization/usage/completions", {
27402
+ query,
27403
+ ...options,
27404
+ __security: { adminAPIKeyAuth: true }
27405
+ });
27406
+ }
27407
+ costs(query, options) {
27408
+ return this._client.get("/organization/costs", {
27409
+ query,
27410
+ ...options,
27411
+ __security: { adminAPIKeyAuth: true }
27412
+ });
27413
+ }
27414
+ embeddings(query, options) {
27415
+ return this._client.get("/organization/usage/embeddings", {
27416
+ query,
27417
+ ...options,
27418
+ __security: { adminAPIKeyAuth: true }
27419
+ });
27420
+ }
27421
+ fileSearchCalls(query, options) {
27422
+ return this._client.get("/organization/usage/file_search_calls", {
27423
+ query,
27424
+ ...options,
27425
+ __security: { adminAPIKeyAuth: true }
27426
+ });
27427
+ }
27428
+ images(query, options) {
27429
+ return this._client.get("/organization/usage/images", {
27430
+ query,
27431
+ ...options,
27432
+ __security: { adminAPIKeyAuth: true }
27433
+ });
27434
+ }
27435
+ moderations(query, options) {
27436
+ return this._client.get("/organization/usage/moderations", {
27437
+ query,
27438
+ ...options,
27439
+ __security: { adminAPIKeyAuth: true }
27440
+ });
27441
+ }
27442
+ vectorStores(query, options) {
27443
+ return this._client.get("/organization/usage/vector_stores", {
27444
+ query,
27445
+ ...options,
27446
+ __security: { adminAPIKeyAuth: true }
27447
+ });
27448
+ }
27449
+ webSearchCalls(query, options) {
27450
+ return this._client.get("/organization/usage/web_search_calls", {
27451
+ query,
27452
+ ...options,
27453
+ __security: { adminAPIKeyAuth: true }
27454
+ });
27455
+ }
27456
+ }
27457
+
27458
+ // node_modules/openai/resources/admin/organization/groups/roles.mjs
27459
+ class Roles2 extends APIResource2 {
27460
+ create(groupID, body, options) {
27461
+ return this._client.post(path2`/organization/groups/${groupID}/roles`, {
27462
+ body,
27463
+ ...options,
27464
+ __security: { adminAPIKeyAuth: true }
27465
+ });
27466
+ }
27467
+ retrieve(roleID, params, options) {
27468
+ const { group_id } = params;
27469
+ return this._client.get(path2`/organization/groups/${group_id}/roles/${roleID}`, {
27470
+ ...options,
27471
+ __security: { adminAPIKeyAuth: true }
27472
+ });
27473
+ }
27474
+ list(groupID, query = {}, options) {
27475
+ return this._client.getAPIList(path2`/organization/groups/${groupID}/roles`, NextCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
27476
+ }
27477
+ delete(roleID, params, options) {
27478
+ const { group_id } = params;
27479
+ return this._client.delete(path2`/organization/groups/${group_id}/roles/${roleID}`, {
27480
+ ...options,
27481
+ __security: { adminAPIKeyAuth: true }
27482
+ });
27483
+ }
27484
+ }
27485
+
27486
+ // node_modules/openai/resources/admin/organization/groups/users.mjs
27487
+ class Users extends APIResource2 {
27488
+ create(groupID, body, options) {
27489
+ return this._client.post(path2`/organization/groups/${groupID}/users`, {
27490
+ body,
27491
+ ...options,
27492
+ __security: { adminAPIKeyAuth: true }
27493
+ });
27494
+ }
27495
+ retrieve(userID, params, options) {
27496
+ const { group_id } = params;
27497
+ return this._client.get(path2`/organization/groups/${group_id}/users/${userID}`, {
27498
+ ...options,
27499
+ __security: { adminAPIKeyAuth: true }
27500
+ });
27501
+ }
27502
+ list(groupID, query = {}, options) {
27503
+ return this._client.getAPIList(path2`/organization/groups/${groupID}/users`, NextCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
27504
+ }
27505
+ delete(userID, params, options) {
27506
+ const { group_id } = params;
27507
+ return this._client.delete(path2`/organization/groups/${group_id}/users/${userID}`, {
27508
+ ...options,
27509
+ __security: { adminAPIKeyAuth: true }
27510
+ });
27511
+ }
27512
+ }
27513
+
27514
+ // node_modules/openai/resources/admin/organization/groups/groups.mjs
27515
+ class Groups extends APIResource2 {
27516
+ constructor() {
27517
+ super(...arguments);
27518
+ this.users = new Users(this._client);
27519
+ this.roles = new Roles2(this._client);
27520
+ }
27521
+ create(body, options) {
27522
+ return this._client.post("/organization/groups", {
27523
+ body,
27524
+ ...options,
27525
+ __security: { adminAPIKeyAuth: true }
27526
+ });
27527
+ }
27528
+ retrieve(groupID, options) {
27529
+ return this._client.get(path2`/organization/groups/${groupID}`, {
27530
+ ...options,
27531
+ __security: { adminAPIKeyAuth: true }
27532
+ });
27533
+ }
27534
+ update(groupID, body, options) {
27535
+ return this._client.post(path2`/organization/groups/${groupID}`, {
27536
+ body,
27537
+ ...options,
27538
+ __security: { adminAPIKeyAuth: true }
27539
+ });
27540
+ }
27541
+ list(query = {}, options) {
27542
+ return this._client.getAPIList("/organization/groups", NextCursorPage, {
27543
+ query,
27544
+ ...options,
27545
+ __security: { adminAPIKeyAuth: true }
27546
+ });
27547
+ }
27548
+ delete(groupID, options) {
27549
+ return this._client.delete(path2`/organization/groups/${groupID}`, {
27550
+ ...options,
27551
+ __security: { adminAPIKeyAuth: true }
27552
+ });
27553
+ }
27554
+ }
27555
+ Groups.Users = Users;
27556
+ Groups.Roles = Roles2;
27557
+
27558
+ // node_modules/openai/resources/admin/organization/projects/api-keys.mjs
27559
+ class APIKeys extends APIResource2 {
27560
+ retrieve(apiKeyID, params, options) {
27561
+ const { project_id } = params;
27562
+ return this._client.get(path2`/organization/projects/${project_id}/api_keys/${apiKeyID}`, {
27563
+ ...options,
27564
+ __security: { adminAPIKeyAuth: true }
27565
+ });
27566
+ }
27567
+ list(projectID, query = {}, options) {
27568
+ return this._client.getAPIList(path2`/organization/projects/${projectID}/api_keys`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
27569
+ }
27570
+ delete(apiKeyID, params, options) {
27571
+ const { project_id } = params;
27572
+ return this._client.delete(path2`/organization/projects/${project_id}/api_keys/${apiKeyID}`, {
27573
+ ...options,
27574
+ __security: { adminAPIKeyAuth: true }
27575
+ });
27576
+ }
27577
+ }
27578
+
27579
+ // node_modules/openai/resources/admin/organization/projects/certificates.mjs
27580
+ class Certificates2 extends APIResource2 {
27581
+ list(projectID, query = {}, options) {
27582
+ return this._client.getAPIList(path2`/organization/projects/${projectID}/certificates`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
27583
+ }
27584
+ activate(projectID, body, options) {
27585
+ return this._client.getAPIList(path2`/organization/projects/${projectID}/certificates/activate`, Page2, { body, method: "post", ...options, __security: { adminAPIKeyAuth: true } });
27586
+ }
27587
+ deactivate(projectID, body, options) {
27588
+ return this._client.getAPIList(path2`/organization/projects/${projectID}/certificates/deactivate`, Page2, { body, method: "post", ...options, __security: { adminAPIKeyAuth: true } });
27589
+ }
27590
+ }
27591
+
27592
+ // node_modules/openai/resources/admin/organization/projects/data-retention.mjs
27593
+ class DataRetention2 extends APIResource2 {
27594
+ retrieve(projectID, options) {
27595
+ return this._client.get(path2`/organization/projects/${projectID}/data_retention`, {
27596
+ ...options,
27597
+ __security: { adminAPIKeyAuth: true }
27598
+ });
27599
+ }
27600
+ update(projectID, body, options) {
27601
+ return this._client.post(path2`/organization/projects/${projectID}/data_retention`, {
27602
+ body,
27603
+ ...options,
27604
+ __security: { adminAPIKeyAuth: true }
27605
+ });
27606
+ }
27607
+ }
27608
+
27609
+ // node_modules/openai/resources/admin/organization/projects/hosted-tool-permissions.mjs
27610
+ class HostedToolPermissions extends APIResource2 {
27611
+ retrieve(projectID, options) {
27612
+ return this._client.get(path2`/organization/projects/${projectID}/hosted_tool_permissions`, {
27613
+ ...options,
27614
+ __security: { adminAPIKeyAuth: true }
27615
+ });
27616
+ }
27617
+ update(projectID, body, options) {
27618
+ return this._client.post(path2`/organization/projects/${projectID}/hosted_tool_permissions`, {
27619
+ body,
27620
+ ...options,
27621
+ __security: { adminAPIKeyAuth: true }
27622
+ });
27623
+ }
27624
+ }
27625
+
27626
+ // node_modules/openai/resources/admin/organization/projects/model-permissions.mjs
27627
+ class ModelPermissions extends APIResource2 {
27628
+ retrieve(projectID, options) {
27629
+ return this._client.get(path2`/organization/projects/${projectID}/model_permissions`, {
27630
+ ...options,
27631
+ __security: { adminAPIKeyAuth: true }
27632
+ });
27633
+ }
27634
+ update(projectID, body, options) {
27635
+ return this._client.post(path2`/organization/projects/${projectID}/model_permissions`, {
27636
+ body,
27637
+ ...options,
27638
+ __security: { adminAPIKeyAuth: true }
27639
+ });
27640
+ }
27641
+ delete(projectID, options) {
27642
+ return this._client.delete(path2`/organization/projects/${projectID}/model_permissions`, {
27643
+ ...options,
27644
+ __security: { adminAPIKeyAuth: true }
27645
+ });
27646
+ }
27647
+ }
27648
+
27649
+ // node_modules/openai/resources/admin/organization/projects/rate-limits.mjs
27650
+ class RateLimits extends APIResource2 {
27651
+ listRateLimits(projectID, query = {}, options) {
27652
+ return this._client.getAPIList(path2`/organization/projects/${projectID}/rate_limits`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
27653
+ }
27654
+ updateRateLimit(rateLimitID, params, options) {
27655
+ const { project_id, ...body } = params;
27656
+ return this._client.post(path2`/organization/projects/${project_id}/rate_limits/${rateLimitID}`, {
27657
+ body,
27658
+ ...options,
27659
+ __security: { adminAPIKeyAuth: true }
27660
+ });
27661
+ }
27662
+ }
27663
+
27664
+ // node_modules/openai/resources/admin/organization/projects/roles.mjs
27665
+ class Roles3 extends APIResource2 {
27666
+ create(projectID, body, options) {
27667
+ return this._client.post(path2`/projects/${projectID}/roles`, {
27668
+ body,
27669
+ ...options,
27670
+ __security: { adminAPIKeyAuth: true }
27671
+ });
27672
+ }
27673
+ retrieve(roleID, params, options) {
27674
+ const { project_id } = params;
27675
+ return this._client.get(path2`/projects/${project_id}/roles/${roleID}`, {
27676
+ ...options,
27677
+ __security: { adminAPIKeyAuth: true }
27678
+ });
27679
+ }
27680
+ update(roleID, params, options) {
27681
+ const { project_id, ...body } = params;
27682
+ return this._client.post(path2`/projects/${project_id}/roles/${roleID}`, {
27683
+ body,
27684
+ ...options,
27685
+ __security: { adminAPIKeyAuth: true }
27686
+ });
27687
+ }
27688
+ list(projectID, query = {}, options) {
27689
+ return this._client.getAPIList(path2`/projects/${projectID}/roles`, NextCursorPage, {
27690
+ query,
27691
+ ...options,
27692
+ __security: { adminAPIKeyAuth: true }
27693
+ });
27694
+ }
27695
+ delete(roleID, params, options) {
27696
+ const { project_id } = params;
27697
+ return this._client.delete(path2`/projects/${project_id}/roles/${roleID}`, {
27698
+ ...options,
27699
+ __security: { adminAPIKeyAuth: true }
27700
+ });
27701
+ }
27702
+ }
27703
+
27704
+ // node_modules/openai/resources/admin/organization/projects/service-accounts.mjs
27705
+ class ServiceAccounts extends APIResource2 {
27706
+ create(projectID, body, options) {
27707
+ return this._client.post(path2`/organization/projects/${projectID}/service_accounts`, {
27708
+ body,
27709
+ ...options,
27710
+ __security: { adminAPIKeyAuth: true }
27711
+ });
27712
+ }
27713
+ retrieve(serviceAccountID, params, options) {
27714
+ const { project_id } = params;
27715
+ return this._client.get(path2`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, {
27716
+ ...options,
27717
+ __security: { adminAPIKeyAuth: true }
27718
+ });
27719
+ }
27720
+ update(serviceAccountID, params, options) {
27721
+ const { project_id, ...body } = params;
27722
+ return this._client.post(path2`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, { body, ...options, __security: { adminAPIKeyAuth: true } });
27723
+ }
27724
+ list(projectID, query = {}, options) {
27725
+ return this._client.getAPIList(path2`/organization/projects/${projectID}/service_accounts`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
27726
+ }
27727
+ delete(serviceAccountID, params, options) {
27728
+ const { project_id } = params;
27729
+ return this._client.delete(path2`/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, { ...options, __security: { adminAPIKeyAuth: true } });
27730
+ }
27731
+ }
27732
+
27733
+ // node_modules/openai/resources/admin/organization/projects/spend-alerts.mjs
27734
+ class SpendAlerts2 extends APIResource2 {
27735
+ create(projectID, body, options) {
27736
+ return this._client.post(path2`/organization/projects/${projectID}/spend_alerts`, {
27737
+ body,
27738
+ ...options,
27739
+ __security: { adminAPIKeyAuth: true }
27740
+ });
27741
+ }
27742
+ update(alertID, params, options) {
27743
+ const { project_id, ...body } = params;
27744
+ return this._client.post(path2`/organization/projects/${project_id}/spend_alerts/${alertID}`, {
27745
+ body,
27746
+ ...options,
27747
+ __security: { adminAPIKeyAuth: true }
27748
+ });
27749
+ }
27750
+ list(projectID, query = {}, options) {
27751
+ return this._client.getAPIList(path2`/organization/projects/${projectID}/spend_alerts`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
27752
+ }
27753
+ delete(alertID, params, options) {
27754
+ const { project_id } = params;
27755
+ return this._client.delete(path2`/organization/projects/${project_id}/spend_alerts/${alertID}`, {
27756
+ ...options,
27757
+ __security: { adminAPIKeyAuth: true }
27758
+ });
27759
+ }
27760
+ }
27761
+
27762
+ // node_modules/openai/resources/admin/organization/projects/groups/roles.mjs
27763
+ class Roles4 extends APIResource2 {
27764
+ create(groupID, params, options) {
27765
+ const { project_id, ...body } = params;
27766
+ return this._client.post(path2`/projects/${project_id}/groups/${groupID}/roles`, {
27767
+ body,
27768
+ ...options,
27769
+ __security: { adminAPIKeyAuth: true }
27770
+ });
27771
+ }
27772
+ retrieve(roleID, params, options) {
27773
+ const { project_id, group_id } = params;
27774
+ return this._client.get(path2`/projects/${project_id}/groups/${group_id}/roles/${roleID}`, {
27775
+ ...options,
27776
+ __security: { adminAPIKeyAuth: true }
27777
+ });
27778
+ }
27779
+ list(groupID, params, options) {
27780
+ const { project_id, ...query } = params;
27781
+ return this._client.getAPIList(path2`/projects/${project_id}/groups/${groupID}/roles`, NextCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
27782
+ }
27783
+ delete(roleID, params, options) {
27784
+ const { project_id, group_id } = params;
27785
+ return this._client.delete(path2`/projects/${project_id}/groups/${group_id}/roles/${roleID}`, {
27786
+ ...options,
27787
+ __security: { adminAPIKeyAuth: true }
27788
+ });
27789
+ }
27790
+ }
27791
+
27792
+ // node_modules/openai/resources/admin/organization/projects/groups/groups.mjs
27793
+ class Groups2 extends APIResource2 {
27794
+ constructor() {
27795
+ super(...arguments);
27796
+ this.roles = new Roles4(this._client);
27797
+ }
27798
+ create(projectID, body, options) {
27799
+ return this._client.post(path2`/organization/projects/${projectID}/groups`, {
27800
+ body,
27801
+ ...options,
27802
+ __security: { adminAPIKeyAuth: true }
27803
+ });
27804
+ }
27805
+ retrieve(groupID, params, options) {
27806
+ const { project_id, ...query } = params;
27807
+ return this._client.get(path2`/organization/projects/${project_id}/groups/${groupID}`, {
27808
+ query,
27809
+ ...options,
27810
+ __security: { adminAPIKeyAuth: true }
27811
+ });
27812
+ }
27813
+ list(projectID, query = {}, options) {
27814
+ return this._client.getAPIList(path2`/organization/projects/${projectID}/groups`, NextCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
27815
+ }
27816
+ delete(groupID, params, options) {
27817
+ const { project_id } = params;
27818
+ return this._client.delete(path2`/organization/projects/${project_id}/groups/${groupID}`, {
27819
+ ...options,
27820
+ __security: { adminAPIKeyAuth: true }
27821
+ });
27822
+ }
27823
+ }
27824
+ Groups2.Roles = Roles4;
27825
+
27826
+ // node_modules/openai/resources/admin/organization/projects/users/roles.mjs
27827
+ class Roles5 extends APIResource2 {
27828
+ create(userID, params, options) {
27829
+ const { project_id, ...body } = params;
27830
+ return this._client.post(path2`/projects/${project_id}/users/${userID}/roles`, {
27831
+ body,
27832
+ ...options,
27833
+ __security: { adminAPIKeyAuth: true }
27834
+ });
27835
+ }
27836
+ retrieve(roleID, params, options) {
27837
+ const { project_id, user_id } = params;
27838
+ return this._client.get(path2`/projects/${project_id}/users/${user_id}/roles/${roleID}`, {
27839
+ ...options,
27840
+ __security: { adminAPIKeyAuth: true }
27841
+ });
27842
+ }
27843
+ list(userID, params, options) {
27844
+ const { project_id, ...query } = params;
27845
+ return this._client.getAPIList(path2`/projects/${project_id}/users/${userID}/roles`, NextCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
27846
+ }
27847
+ delete(roleID, params, options) {
27848
+ const { project_id, user_id } = params;
27849
+ return this._client.delete(path2`/projects/${project_id}/users/${user_id}/roles/${roleID}`, {
27850
+ ...options,
27851
+ __security: { adminAPIKeyAuth: true }
27852
+ });
27853
+ }
27854
+ }
27855
+
27856
+ // node_modules/openai/resources/admin/organization/projects/users/users.mjs
27857
+ class Users2 extends APIResource2 {
27858
+ constructor() {
27859
+ super(...arguments);
27860
+ this.roles = new Roles5(this._client);
27861
+ }
27862
+ create(projectID, body, options) {
27863
+ return this._client.post(path2`/organization/projects/${projectID}/users`, {
27864
+ body,
27865
+ ...options,
27866
+ __security: { adminAPIKeyAuth: true }
27867
+ });
27868
+ }
27869
+ retrieve(userID, params, options) {
27870
+ const { project_id } = params;
27871
+ return this._client.get(path2`/organization/projects/${project_id}/users/${userID}`, {
27872
+ ...options,
27873
+ __security: { adminAPIKeyAuth: true }
27874
+ });
27875
+ }
27876
+ update(userID, params, options) {
27877
+ const { project_id, ...body } = params;
27878
+ return this._client.post(path2`/organization/projects/${project_id}/users/${userID}`, {
27879
+ body,
27880
+ ...options,
27881
+ __security: { adminAPIKeyAuth: true }
27882
+ });
27883
+ }
27884
+ list(projectID, query = {}, options) {
27885
+ return this._client.getAPIList(path2`/organization/projects/${projectID}/users`, ConversationCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
27886
+ }
27887
+ delete(userID, params, options) {
27888
+ const { project_id } = params;
27889
+ return this._client.delete(path2`/organization/projects/${project_id}/users/${userID}`, {
27890
+ ...options,
27891
+ __security: { adminAPIKeyAuth: true }
27892
+ });
27893
+ }
27894
+ }
27895
+ Users2.Roles = Roles5;
27896
+
27897
+ // node_modules/openai/resources/admin/organization/projects/projects.mjs
27898
+ class Projects extends APIResource2 {
27899
+ constructor() {
27900
+ super(...arguments);
27901
+ this.users = new Users2(this._client);
27902
+ this.serviceAccounts = new ServiceAccounts(this._client);
27903
+ this.apiKeys = new APIKeys(this._client);
27904
+ this.rateLimits = new RateLimits(this._client);
27905
+ this.modelPermissions = new ModelPermissions(this._client);
27906
+ this.hostedToolPermissions = new HostedToolPermissions(this._client);
27907
+ this.groups = new Groups2(this._client);
27908
+ this.roles = new Roles3(this._client);
27909
+ this.dataRetention = new DataRetention2(this._client);
27910
+ this.spendAlerts = new SpendAlerts2(this._client);
27911
+ this.certificates = new Certificates2(this._client);
27912
+ }
27913
+ create(body, options) {
27914
+ return this._client.post("/organization/projects", {
27915
+ body,
27916
+ ...options,
27917
+ __security: { adminAPIKeyAuth: true }
27918
+ });
27919
+ }
27920
+ retrieve(projectID, options) {
27921
+ return this._client.get(path2`/organization/projects/${projectID}`, {
27922
+ ...options,
27923
+ __security: { adminAPIKeyAuth: true }
27924
+ });
27925
+ }
27926
+ update(projectID, body, options) {
27927
+ return this._client.post(path2`/organization/projects/${projectID}`, {
27928
+ body,
27929
+ ...options,
27930
+ __security: { adminAPIKeyAuth: true }
27931
+ });
27932
+ }
27933
+ list(query = {}, options) {
27934
+ return this._client.getAPIList("/organization/projects", ConversationCursorPage, {
27935
+ query,
27936
+ ...options,
27937
+ __security: { adminAPIKeyAuth: true }
27938
+ });
27939
+ }
27940
+ archive(projectID, options) {
27941
+ return this._client.post(path2`/organization/projects/${projectID}/archive`, {
27942
+ ...options,
27943
+ __security: { adminAPIKeyAuth: true }
27944
+ });
27945
+ }
27946
+ }
27947
+ Projects.Users = Users2;
27948
+ Projects.ServiceAccounts = ServiceAccounts;
27949
+ Projects.APIKeys = APIKeys;
27950
+ Projects.RateLimits = RateLimits;
27951
+ Projects.ModelPermissions = ModelPermissions;
27952
+ Projects.HostedToolPermissions = HostedToolPermissions;
27953
+ Projects.Groups = Groups2;
27954
+ Projects.Roles = Roles3;
27955
+ Projects.DataRetention = DataRetention2;
27956
+ Projects.SpendAlerts = SpendAlerts2;
27957
+ Projects.Certificates = Certificates2;
27958
+
27959
+ // node_modules/openai/resources/admin/organization/users/roles.mjs
27960
+ class Roles6 extends APIResource2 {
27961
+ create(userID, body, options) {
27962
+ return this._client.post(path2`/organization/users/${userID}/roles`, {
27963
+ body,
27964
+ ...options,
27965
+ __security: { adminAPIKeyAuth: true }
27966
+ });
27967
+ }
27968
+ retrieve(roleID, params, options) {
27969
+ const { user_id } = params;
27970
+ return this._client.get(path2`/organization/users/${user_id}/roles/${roleID}`, {
27971
+ ...options,
27972
+ __security: { adminAPIKeyAuth: true }
27973
+ });
27974
+ }
27975
+ list(userID, query = {}, options) {
27976
+ return this._client.getAPIList(path2`/organization/users/${userID}/roles`, NextCursorPage, { query, ...options, __security: { adminAPIKeyAuth: true } });
27977
+ }
27978
+ delete(roleID, params, options) {
27979
+ const { user_id } = params;
27980
+ return this._client.delete(path2`/organization/users/${user_id}/roles/${roleID}`, {
27981
+ ...options,
27982
+ __security: { adminAPIKeyAuth: true }
27983
+ });
27984
+ }
27985
+ }
27986
+
27987
+ // node_modules/openai/resources/admin/organization/users/users.mjs
27988
+ class Users3 extends APIResource2 {
27989
+ constructor() {
27990
+ super(...arguments);
27991
+ this.roles = new Roles6(this._client);
27992
+ }
27993
+ retrieve(userID, options) {
27994
+ return this._client.get(path2`/organization/users/${userID}`, {
27995
+ ...options,
27996
+ __security: { adminAPIKeyAuth: true }
27997
+ });
27998
+ }
27999
+ update(userID, body, options) {
28000
+ return this._client.post(path2`/organization/users/${userID}`, {
28001
+ body,
28002
+ ...options,
28003
+ __security: { adminAPIKeyAuth: true }
28004
+ });
28005
+ }
28006
+ list(query = {}, options) {
28007
+ return this._client.getAPIList("/organization/users", ConversationCursorPage, {
28008
+ query,
28009
+ ...options,
28010
+ __security: { adminAPIKeyAuth: true }
28011
+ });
28012
+ }
28013
+ delete(userID, options) {
28014
+ return this._client.delete(path2`/organization/users/${userID}`, {
28015
+ ...options,
28016
+ __security: { adminAPIKeyAuth: true }
28017
+ });
28018
+ }
28019
+ }
28020
+ Users3.Roles = Roles6;
28021
+
28022
+ // node_modules/openai/resources/admin/organization/organization.mjs
28023
+ class Organization extends APIResource2 {
28024
+ constructor() {
28025
+ super(...arguments);
28026
+ this.auditLogs = new AuditLogs(this._client);
28027
+ this.adminAPIKeys = new AdminAPIKeys(this._client);
28028
+ this.usage = new Usage(this._client);
28029
+ this.invites = new Invites(this._client);
28030
+ this.users = new Users3(this._client);
28031
+ this.groups = new Groups(this._client);
28032
+ this.roles = new Roles(this._client);
28033
+ this.dataRetention = new DataRetention(this._client);
28034
+ this.spendAlerts = new SpendAlerts(this._client);
28035
+ this.certificates = new Certificates(this._client);
28036
+ this.projects = new Projects(this._client);
28037
+ }
28038
+ }
28039
+ Organization.AuditLogs = AuditLogs;
28040
+ Organization.AdminAPIKeys = AdminAPIKeys;
28041
+ Organization.Usage = Usage;
28042
+ Organization.Invites = Invites;
28043
+ Organization.Users = Users3;
28044
+ Organization.Groups = Groups;
28045
+ Organization.Roles = Roles;
28046
+ Organization.DataRetention = DataRetention;
28047
+ Organization.SpendAlerts = SpendAlerts;
28048
+ Organization.Certificates = Certificates;
28049
+ Organization.Projects = Projects;
28050
+
28051
+ // node_modules/openai/resources/admin/admin.mjs
28052
+ class Admin extends APIResource2 {
28053
+ constructor() {
28054
+ super(...arguments);
28055
+ this.organization = new Organization(this._client);
28056
+ }
28057
+ }
28058
+ Admin.Organization = Organization;
28059
+ // node_modules/openai/internal/headers.mjs
28060
+ var brand_privateNullableHeaders2 = /* @__PURE__ */ Symbol("brand.privateNullableHeaders");
28061
+ function* iterateHeaders2(headers) {
28062
+ if (!headers)
28063
+ return;
28064
+ if (brand_privateNullableHeaders2 in headers) {
28065
+ const { values, nulls } = headers;
28066
+ yield* values.entries();
28067
+ for (const name of nulls) {
28068
+ yield [name, null];
28069
+ }
28070
+ return;
28071
+ }
28072
+ let shouldClear = false;
28073
+ let iter;
28074
+ if (headers instanceof Headers) {
28075
+ iter = headers.entries();
28076
+ } else if (isReadonlyArray2(headers)) {
28077
+ iter = headers;
28078
+ } else {
28079
+ shouldClear = true;
28080
+ iter = Object.entries(headers ?? {});
28081
+ }
28082
+ for (let row of iter) {
28083
+ const name = row[0];
28084
+ if (typeof name !== "string")
28085
+ throw new TypeError("expected header name to be a string");
28086
+ const values = isReadonlyArray2(row[1]) ? row[1] : [row[1]];
28087
+ let didClear = false;
28088
+ for (const value of values) {
28089
+ if (value === undefined)
28090
+ continue;
28091
+ if (shouldClear && !didClear) {
28092
+ didClear = true;
28093
+ yield [name, null];
28094
+ }
28095
+ yield [name, value];
28096
+ }
28097
+ }
28098
+ }
28099
+ var buildHeaders2 = (newHeaders) => {
28100
+ const targetHeaders = new Headers;
28101
+ const nullHeaders = new Set;
28102
+ for (const headers of newHeaders) {
28103
+ const seenHeaders = new Set;
28104
+ for (const [name, value] of iterateHeaders2(headers)) {
28105
+ const lowerName = name.toLowerCase();
28106
+ if (!seenHeaders.has(lowerName)) {
28107
+ targetHeaders.delete(name);
28108
+ seenHeaders.add(lowerName);
28109
+ }
28110
+ if (value === null) {
28111
+ targetHeaders.delete(name);
28112
+ nullHeaders.add(lowerName);
28113
+ } else {
28114
+ targetHeaders.append(name, value);
28115
+ nullHeaders.delete(lowerName);
28116
+ }
28117
+ }
28118
+ }
28119
+ return { [brand_privateNullableHeaders2]: true, values: targetHeaders, nulls: nullHeaders };
28120
+ };
28121
+
28122
+ // node_modules/openai/resources/audio/speech.mjs
28123
+ class Speech extends APIResource2 {
28124
+ create(body, options) {
28125
+ return this._client.post("/audio/speech", {
28126
+ body,
28127
+ ...options,
28128
+ headers: buildHeaders2([{ Accept: "application/octet-stream" }, options?.headers]),
28129
+ __security: { bearerAuth: true },
28130
+ __binaryResponse: true
28131
+ });
28132
+ }
28133
+ }
28134
+
28135
+ // node_modules/openai/resources/audio/transcriptions.mjs
28136
+ class Transcriptions extends APIResource2 {
28137
+ create(body, options) {
28138
+ return this._client.post("/audio/transcriptions", multipartFormRequestOptions2({
28139
+ body,
28140
+ ...options,
28141
+ stream: body.stream ?? false,
28142
+ __metadata: { model: body.model },
28143
+ __security: { bearerAuth: true }
28144
+ }, this._client));
28145
+ }
28146
+ }
28147
+
28148
+ // node_modules/openai/resources/audio/translations.mjs
28149
+ class Translations extends APIResource2 {
28150
+ create(body, options) {
28151
+ return this._client.post("/audio/translations", multipartFormRequestOptions2({ body, ...options, __metadata: { model: body.model }, __security: { bearerAuth: true } }, this._client));
28152
+ }
28153
+ }
28154
+
28155
+ // node_modules/openai/resources/audio/audio.mjs
28156
+ class Audio extends APIResource2 {
28157
+ constructor() {
28158
+ super(...arguments);
28159
+ this.transcriptions = new Transcriptions(this._client);
28160
+ this.translations = new Translations(this._client);
28161
+ this.speech = new Speech(this._client);
28162
+ }
28163
+ }
28164
+ Audio.Transcriptions = Transcriptions;
28165
+ Audio.Translations = Translations;
28166
+ Audio.Speech = Speech;
28167
+ // node_modules/openai/resources/batches.mjs
28168
+ class Batches3 extends APIResource2 {
28169
+ create(body, options) {
28170
+ return this._client.post("/batches", { body, ...options, __security: { bearerAuth: true } });
28171
+ }
28172
+ retrieve(batchID, options) {
28173
+ return this._client.get(path2`/batches/${batchID}`, { ...options, __security: { bearerAuth: true } });
28174
+ }
28175
+ list(query = {}, options) {
28176
+ return this._client.getAPIList("/batches", CursorPage, {
28177
+ query,
28178
+ ...options,
28179
+ __security: { bearerAuth: true }
28180
+ });
28181
+ }
28182
+ cancel(batchID, options) {
28183
+ return this._client.post(path2`/batches/${batchID}/cancel`, {
28184
+ ...options,
28185
+ __security: { bearerAuth: true }
28186
+ });
28187
+ }
28188
+ }
28189
+ // node_modules/openai/resources/beta/assistants.mjs
28190
+ class Assistants extends APIResource2 {
28191
+ create(body, options) {
28192
+ return this._client.post("/assistants", {
28193
+ body,
28194
+ ...options,
28195
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28196
+ __security: { bearerAuth: true }
28197
+ });
28198
+ }
28199
+ retrieve(assistantID, options) {
28200
+ return this._client.get(path2`/assistants/${assistantID}`, {
28201
+ ...options,
28202
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28203
+ __security: { bearerAuth: true }
28204
+ });
28205
+ }
28206
+ update(assistantID, body, options) {
28207
+ return this._client.post(path2`/assistants/${assistantID}`, {
28208
+ body,
28209
+ ...options,
28210
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28211
+ __security: { bearerAuth: true }
28212
+ });
28213
+ }
28214
+ list(query = {}, options) {
28215
+ return this._client.getAPIList("/assistants", CursorPage, {
27073
28216
  query,
27074
28217
  ...options,
27075
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28218
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28219
+ __security: { bearerAuth: true }
27076
28220
  });
27077
28221
  }
27078
28222
  delete(assistantID, options) {
27079
28223
  return this._client.delete(path2`/assistants/${assistantID}`, {
27080
28224
  ...options,
27081
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28225
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28226
+ __security: { bearerAuth: true }
27082
28227
  });
27083
28228
  }
27084
28229
  }
@@ -27089,7 +28234,8 @@ class Sessions extends APIResource2 {
27089
28234
  return this._client.post("/realtime/sessions", {
27090
28235
  body,
27091
28236
  ...options,
27092
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28237
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28238
+ __security: { bearerAuth: true }
27093
28239
  });
27094
28240
  }
27095
28241
  }
@@ -27100,7 +28246,8 @@ class TranscriptionSessions extends APIResource2 {
27100
28246
  return this._client.post("/realtime/transcription_sessions", {
27101
28247
  body,
27102
28248
  ...options,
27103
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28249
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28250
+ __security: { bearerAuth: true }
27104
28251
  });
27105
28252
  }
27106
28253
  }
@@ -27122,13 +28269,15 @@ class Sessions2 extends APIResource2 {
27122
28269
  return this._client.post("/chatkit/sessions", {
27123
28270
  body,
27124
28271
  ...options,
27125
- headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
28272
+ headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]),
28273
+ __security: { bearerAuth: true }
27126
28274
  });
27127
28275
  }
27128
28276
  cancel(sessionID, options) {
27129
28277
  return this._client.post(path2`/chatkit/sessions/${sessionID}/cancel`, {
27130
28278
  ...options,
27131
- headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
28279
+ headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]),
28280
+ __security: { bearerAuth: true }
27132
28281
  });
27133
28282
  }
27134
28283
  }
@@ -27138,24 +28287,32 @@ class Threads extends APIResource2 {
27138
28287
  retrieve(threadID, options) {
27139
28288
  return this._client.get(path2`/chatkit/threads/${threadID}`, {
27140
28289
  ...options,
27141
- headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
28290
+ headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]),
28291
+ __security: { bearerAuth: true }
27142
28292
  });
27143
28293
  }
27144
28294
  list(query = {}, options) {
27145
28295
  return this._client.getAPIList("/chatkit/threads", ConversationCursorPage, {
27146
28296
  query,
27147
28297
  ...options,
27148
- headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
28298
+ headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]),
28299
+ __security: { bearerAuth: true }
27149
28300
  });
27150
28301
  }
27151
28302
  delete(threadID, options) {
27152
28303
  return this._client.delete(path2`/chatkit/threads/${threadID}`, {
27153
28304
  ...options,
27154
- headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers])
28305
+ headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]),
28306
+ __security: { bearerAuth: true }
27155
28307
  });
27156
28308
  }
27157
28309
  listItems(threadID, query = {}, options) {
27158
- return this._client.getAPIList(path2`/chatkit/threads/${threadID}/items`, ConversationCursorPage, { query, ...options, headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]) });
28310
+ return this._client.getAPIList(path2`/chatkit/threads/${threadID}/items`, ConversationCursorPage, {
28311
+ query,
28312
+ ...options,
28313
+ headers: buildHeaders2([{ "OpenAI-Beta": "chatkit_beta=v1" }, options?.headers]),
28314
+ __security: { bearerAuth: true }
28315
+ });
27159
28316
  }
27160
28317
  }
27161
28318
 
@@ -27176,14 +28333,16 @@ class Messages4 extends APIResource2 {
27176
28333
  return this._client.post(path2`/threads/${threadID}/messages`, {
27177
28334
  body,
27178
28335
  ...options,
27179
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28336
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28337
+ __security: { bearerAuth: true }
27180
28338
  });
27181
28339
  }
27182
28340
  retrieve(messageID, params, options) {
27183
28341
  const { thread_id } = params;
27184
28342
  return this._client.get(path2`/threads/${thread_id}/messages/${messageID}`, {
27185
28343
  ...options,
27186
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28344
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28345
+ __security: { bearerAuth: true }
27187
28346
  });
27188
28347
  }
27189
28348
  update(messageID, params, options) {
@@ -27191,21 +28350,24 @@ class Messages4 extends APIResource2 {
27191
28350
  return this._client.post(path2`/threads/${thread_id}/messages/${messageID}`, {
27192
28351
  body,
27193
28352
  ...options,
27194
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28353
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28354
+ __security: { bearerAuth: true }
27195
28355
  });
27196
28356
  }
27197
28357
  list(threadID, query = {}, options) {
27198
28358
  return this._client.getAPIList(path2`/threads/${threadID}/messages`, CursorPage, {
27199
28359
  query,
27200
28360
  ...options,
27201
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28361
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28362
+ __security: { bearerAuth: true }
27202
28363
  });
27203
28364
  }
27204
28365
  delete(messageID, params, options) {
27205
28366
  const { thread_id } = params;
27206
28367
  return this._client.delete(path2`/threads/${thread_id}/messages/${messageID}`, {
27207
28368
  ...options,
27208
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28369
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28370
+ __security: { bearerAuth: true }
27209
28371
  });
27210
28372
  }
27211
28373
  }
@@ -27217,7 +28379,8 @@ class Steps extends APIResource2 {
27217
28379
  return this._client.get(path2`/threads/${thread_id}/runs/${run_id}/steps/${stepID}`, {
27218
28380
  query,
27219
28381
  ...options,
27220
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28382
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28383
+ __security: { bearerAuth: true }
27221
28384
  });
27222
28385
  }
27223
28386
  list(runID, params, options) {
@@ -27225,7 +28388,8 @@ class Steps extends APIResource2 {
27225
28388
  return this._client.getAPIList(path2`/threads/${thread_id}/runs/${runID}/steps`, CursorPage, {
27226
28389
  query,
27227
28390
  ...options,
27228
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28391
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28392
+ __security: { bearerAuth: true }
27229
28393
  });
27230
28394
  }
27231
28395
  }
@@ -27247,10 +28411,10 @@ var toFloat32Array = (base64Str) => {
27247
28411
  // node_modules/openai/internal/utils/env.mjs
27248
28412
  var readEnv2 = (env) => {
27249
28413
  if (typeof globalThis.process !== "undefined") {
27250
- return globalThis.process.env?.[env]?.trim() ?? undefined;
28414
+ return globalThis.process.env?.[env]?.trim() || undefined;
27251
28415
  }
27252
28416
  if (typeof globalThis.Deno !== "undefined") {
27253
- return globalThis.Deno.env?.get?.(env)?.trim();
28417
+ return globalThis.Deno.env?.get?.(env)?.trim() || undefined;
27254
28418
  }
27255
28419
  return;
27256
28420
  };
@@ -27807,14 +28971,16 @@ class Runs extends APIResource2 {
27807
28971
  ...options,
27808
28972
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
27809
28973
  stream: params.stream ?? false,
27810
- __synthesizeEventData: true
28974
+ __synthesizeEventData: true,
28975
+ __security: { bearerAuth: true }
27811
28976
  });
27812
28977
  }
27813
28978
  retrieve(runID, params, options) {
27814
28979
  const { thread_id } = params;
27815
28980
  return this._client.get(path2`/threads/${thread_id}/runs/${runID}`, {
27816
28981
  ...options,
27817
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28982
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28983
+ __security: { bearerAuth: true }
27818
28984
  });
27819
28985
  }
27820
28986
  update(runID, params, options) {
@@ -27822,21 +28988,24 @@ class Runs extends APIResource2 {
27822
28988
  return this._client.post(path2`/threads/${thread_id}/runs/${runID}`, {
27823
28989
  body,
27824
28990
  ...options,
27825
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28991
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
28992
+ __security: { bearerAuth: true }
27826
28993
  });
27827
28994
  }
27828
28995
  list(threadID, query2 = {}, options) {
27829
28996
  return this._client.getAPIList(path2`/threads/${threadID}/runs`, CursorPage, {
27830
28997
  query: query2,
27831
28998
  ...options,
27832
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
28999
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29000
+ __security: { bearerAuth: true }
27833
29001
  });
27834
29002
  }
27835
29003
  cancel(runID, params, options) {
27836
29004
  const { thread_id } = params;
27837
29005
  return this._client.post(path2`/threads/${thread_id}/runs/${runID}/cancel`, {
27838
29006
  ...options,
27839
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29007
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29008
+ __security: { bearerAuth: true }
27840
29009
  });
27841
29010
  }
27842
29011
  async createAndPoll(threadId, body, options) {
@@ -27897,7 +29066,8 @@ class Runs extends APIResource2 {
27897
29066
  ...options,
27898
29067
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
27899
29068
  stream: params.stream ?? false,
27900
- __synthesizeEventData: true
29069
+ __synthesizeEventData: true,
29070
+ __security: { bearerAuth: true }
27901
29071
  });
27902
29072
  }
27903
29073
  async submitToolOutputsAndPoll(runId, params, options) {
@@ -27921,26 +29091,30 @@ class Threads2 extends APIResource2 {
27921
29091
  return this._client.post("/threads", {
27922
29092
  body,
27923
29093
  ...options,
27924
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29094
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29095
+ __security: { bearerAuth: true }
27925
29096
  });
27926
29097
  }
27927
29098
  retrieve(threadID, options) {
27928
29099
  return this._client.get(path2`/threads/${threadID}`, {
27929
29100
  ...options,
27930
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29101
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29102
+ __security: { bearerAuth: true }
27931
29103
  });
27932
29104
  }
27933
29105
  update(threadID, body, options) {
27934
29106
  return this._client.post(path2`/threads/${threadID}`, {
27935
29107
  body,
27936
29108
  ...options,
27937
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29109
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29110
+ __security: { bearerAuth: true }
27938
29111
  });
27939
29112
  }
27940
29113
  delete(threadID, options) {
27941
29114
  return this._client.delete(path2`/threads/${threadID}`, {
27942
29115
  ...options,
27943
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
29116
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
29117
+ __security: { bearerAuth: true }
27944
29118
  });
27945
29119
  }
27946
29120
  createAndRun(body, options) {
@@ -27949,7 +29123,8 @@ class Threads2 extends APIResource2 {
27949
29123
  ...options,
27950
29124
  headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
27951
29125
  stream: body.stream ?? false,
27952
- __synthesizeEventData: true
29126
+ __synthesizeEventData: true,
29127
+ __security: { bearerAuth: true }
27953
29128
  });
27954
29129
  }
27955
29130
  async createAndRunPoll(body, options) {
@@ -27980,7 +29155,12 @@ Beta2.Threads = Threads2;
27980
29155
  // node_modules/openai/resources/completions.mjs
27981
29156
  class Completions3 extends APIResource2 {
27982
29157
  create(body, options) {
27983
- return this._client.post("/completions", { body, ...options, stream: body.stream ?? false });
29158
+ return this._client.post("/completions", {
29159
+ body,
29160
+ ...options,
29161
+ stream: body.stream ?? false,
29162
+ __security: { bearerAuth: true }
29163
+ });
27984
29164
  }
27985
29165
  }
27986
29166
  // node_modules/openai/resources/containers/files/content.mjs
@@ -27990,6 +29170,7 @@ class Content extends APIResource2 {
27990
29170
  return this._client.get(path2`/containers/${container_id}/files/${fileID}/content`, {
27991
29171
  ...options,
27992
29172
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
29173
+ __security: { bearerAuth: true },
27993
29174
  __binaryResponse: true
27994
29175
  });
27995
29176
  }
@@ -28002,23 +29183,28 @@ class Files2 extends APIResource2 {
28002
29183
  this.content = new Content(this._client);
28003
29184
  }
28004
29185
  create(containerID, body, options) {
28005
- return this._client.post(path2`/containers/${containerID}/files`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
29186
+ return this._client.post(path2`/containers/${containerID}/files`, maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
28006
29187
  }
28007
29188
  retrieve(fileID, params, options) {
28008
29189
  const { container_id } = params;
28009
- return this._client.get(path2`/containers/${container_id}/files/${fileID}`, options);
29190
+ return this._client.get(path2`/containers/${container_id}/files/${fileID}`, {
29191
+ ...options,
29192
+ __security: { bearerAuth: true }
29193
+ });
28010
29194
  }
28011
29195
  list(containerID, query2 = {}, options) {
28012
29196
  return this._client.getAPIList(path2`/containers/${containerID}/files`, CursorPage, {
28013
29197
  query: query2,
28014
- ...options
29198
+ ...options,
29199
+ __security: { bearerAuth: true }
28015
29200
  });
28016
29201
  }
28017
29202
  delete(fileID, params, options) {
28018
29203
  const { container_id } = params;
28019
29204
  return this._client.delete(path2`/containers/${container_id}/files/${fileID}`, {
28020
29205
  ...options,
28021
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
29206
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
29207
+ __security: { bearerAuth: true }
28022
29208
  });
28023
29209
  }
28024
29210
  }
@@ -28031,18 +29217,26 @@ class Containers extends APIResource2 {
28031
29217
  this.files = new Files2(this._client);
28032
29218
  }
28033
29219
  create(body, options) {
28034
- return this._client.post("/containers", { body, ...options });
29220
+ return this._client.post("/containers", { body, ...options, __security: { bearerAuth: true } });
28035
29221
  }
28036
29222
  retrieve(containerID, options) {
28037
- return this._client.get(path2`/containers/${containerID}`, options);
29223
+ return this._client.get(path2`/containers/${containerID}`, {
29224
+ ...options,
29225
+ __security: { bearerAuth: true }
29226
+ });
28038
29227
  }
28039
29228
  list(query2 = {}, options) {
28040
- return this._client.getAPIList("/containers", CursorPage, { query: query2, ...options });
29229
+ return this._client.getAPIList("/containers", CursorPage, {
29230
+ query: query2,
29231
+ ...options,
29232
+ __security: { bearerAuth: true }
29233
+ });
28041
29234
  }
28042
29235
  delete(containerID, options) {
28043
29236
  return this._client.delete(path2`/containers/${containerID}`, {
28044
29237
  ...options,
28045
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
29238
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
29239
+ __security: { bearerAuth: true }
28046
29240
  });
28047
29241
  }
28048
29242
  }
@@ -28054,19 +29248,27 @@ class Items extends APIResource2 {
28054
29248
  return this._client.post(path2`/conversations/${conversationID}/items`, {
28055
29249
  query: { include },
28056
29250
  body,
28057
- ...options
29251
+ ...options,
29252
+ __security: { bearerAuth: true }
28058
29253
  });
28059
29254
  }
28060
29255
  retrieve(itemID, params, options) {
28061
29256
  const { conversation_id, ...query2 } = params;
28062
- return this._client.get(path2`/conversations/${conversation_id}/items/${itemID}`, { query: query2, ...options });
29257
+ return this._client.get(path2`/conversations/${conversation_id}/items/${itemID}`, {
29258
+ query: query2,
29259
+ ...options,
29260
+ __security: { bearerAuth: true }
29261
+ });
28063
29262
  }
28064
29263
  list(conversationID, query2 = {}, options) {
28065
- return this._client.getAPIList(path2`/conversations/${conversationID}/items`, ConversationCursorPage, { query: query2, ...options });
29264
+ return this._client.getAPIList(path2`/conversations/${conversationID}/items`, ConversationCursorPage, { query: query2, ...options, __security: { bearerAuth: true } });
28066
29265
  }
28067
29266
  delete(itemID, params, options) {
28068
29267
  const { conversation_id } = params;
28069
- return this._client.delete(path2`/conversations/${conversation_id}/items/${itemID}`, options);
29268
+ return this._client.delete(path2`/conversations/${conversation_id}/items/${itemID}`, {
29269
+ ...options,
29270
+ __security: { bearerAuth: true }
29271
+ });
28070
29272
  }
28071
29273
  }
28072
29274
 
@@ -28077,16 +29279,26 @@ class Conversations extends APIResource2 {
28077
29279
  this.items = new Items(this._client);
28078
29280
  }
28079
29281
  create(body = {}, options) {
28080
- return this._client.post("/conversations", { body, ...options });
29282
+ return this._client.post("/conversations", { body, ...options, __security: { bearerAuth: true } });
28081
29283
  }
28082
29284
  retrieve(conversationID, options) {
28083
- return this._client.get(path2`/conversations/${conversationID}`, options);
29285
+ return this._client.get(path2`/conversations/${conversationID}`, {
29286
+ ...options,
29287
+ __security: { bearerAuth: true }
29288
+ });
28084
29289
  }
28085
29290
  update(conversationID, body, options) {
28086
- return this._client.post(path2`/conversations/${conversationID}`, { body, ...options });
29291
+ return this._client.post(path2`/conversations/${conversationID}`, {
29292
+ body,
29293
+ ...options,
29294
+ __security: { bearerAuth: true }
29295
+ });
28087
29296
  }
28088
29297
  delete(conversationID, options) {
28089
- return this._client.delete(path2`/conversations/${conversationID}`, options);
29298
+ return this._client.delete(path2`/conversations/${conversationID}`, {
29299
+ ...options,
29300
+ __security: { bearerAuth: true }
29301
+ });
28090
29302
  }
28091
29303
  }
28092
29304
  Conversations.Items = Items;
@@ -28103,7 +29315,8 @@ class Embeddings extends APIResource2 {
28103
29315
  ...body,
28104
29316
  encoding_format
28105
29317
  },
28106
- ...options
29318
+ ...options,
29319
+ __security: { bearerAuth: true }
28107
29320
  });
28108
29321
  if (hasUserProvidedEncodingFormat) {
28109
29322
  return response;
@@ -28124,11 +29337,14 @@ class Embeddings extends APIResource2 {
28124
29337
  class OutputItems extends APIResource2 {
28125
29338
  retrieve(outputItemID, params, options) {
28126
29339
  const { eval_id, run_id } = params;
28127
- return this._client.get(path2`/evals/${eval_id}/runs/${run_id}/output_items/${outputItemID}`, options);
29340
+ return this._client.get(path2`/evals/${eval_id}/runs/${run_id}/output_items/${outputItemID}`, {
29341
+ ...options,
29342
+ __security: { bearerAuth: true }
29343
+ });
28128
29344
  }
28129
29345
  list(runID, params, options) {
28130
29346
  const { eval_id, ...query2 } = params;
28131
- return this._client.getAPIList(path2`/evals/${eval_id}/runs/${runID}/output_items`, CursorPage, { query: query2, ...options });
29347
+ return this._client.getAPIList(path2`/evals/${eval_id}/runs/${runID}/output_items`, CursorPage, { query: query2, ...options, __security: { bearerAuth: true } });
28132
29348
  }
28133
29349
  }
28134
29350
 
@@ -28139,25 +29355,39 @@ class Runs2 extends APIResource2 {
28139
29355
  this.outputItems = new OutputItems(this._client);
28140
29356
  }
28141
29357
  create(evalID, body, options) {
28142
- return this._client.post(path2`/evals/${evalID}/runs`, { body, ...options });
29358
+ return this._client.post(path2`/evals/${evalID}/runs`, {
29359
+ body,
29360
+ ...options,
29361
+ __security: { bearerAuth: true }
29362
+ });
28143
29363
  }
28144
29364
  retrieve(runID, params, options) {
28145
29365
  const { eval_id } = params;
28146
- return this._client.get(path2`/evals/${eval_id}/runs/${runID}`, options);
29366
+ return this._client.get(path2`/evals/${eval_id}/runs/${runID}`, {
29367
+ ...options,
29368
+ __security: { bearerAuth: true }
29369
+ });
28147
29370
  }
28148
29371
  list(evalID, query2 = {}, options) {
28149
29372
  return this._client.getAPIList(path2`/evals/${evalID}/runs`, CursorPage, {
28150
29373
  query: query2,
28151
- ...options
29374
+ ...options,
29375
+ __security: { bearerAuth: true }
28152
29376
  });
28153
29377
  }
28154
29378
  delete(runID, params, options) {
28155
29379
  const { eval_id } = params;
28156
- return this._client.delete(path2`/evals/${eval_id}/runs/${runID}`, options);
29380
+ return this._client.delete(path2`/evals/${eval_id}/runs/${runID}`, {
29381
+ ...options,
29382
+ __security: { bearerAuth: true }
29383
+ });
28157
29384
  }
28158
29385
  cancel(runID, params, options) {
28159
29386
  const { eval_id } = params;
28160
- return this._client.post(path2`/evals/${eval_id}/runs/${runID}`, options);
29387
+ return this._client.post(path2`/evals/${eval_id}/runs/${runID}`, {
29388
+ ...options,
29389
+ __security: { bearerAuth: true }
29390
+ });
28161
29391
  }
28162
29392
  }
28163
29393
  Runs2.OutputItems = OutputItems;
@@ -28169,40 +29399,49 @@ class Evals extends APIResource2 {
28169
29399
  this.runs = new Runs2(this._client);
28170
29400
  }
28171
29401
  create(body, options) {
28172
- return this._client.post("/evals", { body, ...options });
29402
+ return this._client.post("/evals", { body, ...options, __security: { bearerAuth: true } });
28173
29403
  }
28174
29404
  retrieve(evalID, options) {
28175
- return this._client.get(path2`/evals/${evalID}`, options);
29405
+ return this._client.get(path2`/evals/${evalID}`, { ...options, __security: { bearerAuth: true } });
28176
29406
  }
28177
29407
  update(evalID, body, options) {
28178
- return this._client.post(path2`/evals/${evalID}`, { body, ...options });
29408
+ return this._client.post(path2`/evals/${evalID}`, { body, ...options, __security: { bearerAuth: true } });
28179
29409
  }
28180
29410
  list(query2 = {}, options) {
28181
- return this._client.getAPIList("/evals", CursorPage, { query: query2, ...options });
29411
+ return this._client.getAPIList("/evals", CursorPage, {
29412
+ query: query2,
29413
+ ...options,
29414
+ __security: { bearerAuth: true }
29415
+ });
28182
29416
  }
28183
29417
  delete(evalID, options) {
28184
- return this._client.delete(path2`/evals/${evalID}`, options);
29418
+ return this._client.delete(path2`/evals/${evalID}`, { ...options, __security: { bearerAuth: true } });
28185
29419
  }
28186
29420
  }
28187
29421
  Evals.Runs = Runs2;
28188
29422
  // node_modules/openai/resources/files.mjs
28189
29423
  class Files3 extends APIResource2 {
28190
29424
  create(body, options) {
28191
- return this._client.post("/files", multipartFormRequestOptions2({ body, ...options }, this._client));
29425
+ return this._client.post("/files", multipartFormRequestOptions2({ body, ...options, __security: { bearerAuth: true } }, this._client));
28192
29426
  }
28193
29427
  retrieve(fileID, options) {
28194
- return this._client.get(path2`/files/${fileID}`, options);
29428
+ return this._client.get(path2`/files/${fileID}`, { ...options, __security: { bearerAuth: true } });
28195
29429
  }
28196
29430
  list(query2 = {}, options) {
28197
- return this._client.getAPIList("/files", CursorPage, { query: query2, ...options });
29431
+ return this._client.getAPIList("/files", CursorPage, {
29432
+ query: query2,
29433
+ ...options,
29434
+ __security: { bearerAuth: true }
29435
+ });
28198
29436
  }
28199
29437
  delete(fileID, options) {
28200
- return this._client.delete(path2`/files/${fileID}`, options);
29438
+ return this._client.delete(path2`/files/${fileID}`, { ...options, __security: { bearerAuth: true } });
28201
29439
  }
28202
29440
  content(fileID, options) {
28203
29441
  return this._client.get(path2`/files/${fileID}/content`, {
28204
29442
  ...options,
28205
29443
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
29444
+ __security: { bearerAuth: true },
28206
29445
  __binaryResponse: true
28207
29446
  });
28208
29447
  }
@@ -28229,10 +29468,18 @@ class Methods extends APIResource2 {
28229
29468
  // node_modules/openai/resources/fine-tuning/alpha/graders.mjs
28230
29469
  class Graders extends APIResource2 {
28231
29470
  run(body, options) {
28232
- return this._client.post("/fine_tuning/alpha/graders/run", { body, ...options });
29471
+ return this._client.post("/fine_tuning/alpha/graders/run", {
29472
+ body,
29473
+ ...options,
29474
+ __security: { bearerAuth: true }
29475
+ });
28233
29476
  }
28234
29477
  validate(body, options) {
28235
- return this._client.post("/fine_tuning/alpha/graders/validate", { body, ...options });
29478
+ return this._client.post("/fine_tuning/alpha/graders/validate", {
29479
+ body,
29480
+ ...options,
29481
+ __security: { bearerAuth: true }
29482
+ });
28236
29483
  }
28237
29484
  }
28238
29485
 
@@ -28248,20 +29495,21 @@ Alpha.Graders = Graders;
28248
29495
  // node_modules/openai/resources/fine-tuning/checkpoints/permissions.mjs
28249
29496
  class Permissions extends APIResource2 {
28250
29497
  create(fineTunedModelCheckpoint, body, options) {
28251
- return this._client.getAPIList(path2`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, Page2, { body, method: "post", ...options });
29498
+ return this._client.getAPIList(path2`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, Page2, { body, method: "post", ...options, __security: { adminAPIKeyAuth: true } });
28252
29499
  }
28253
29500
  retrieve(fineTunedModelCheckpoint, query2 = {}, options) {
28254
29501
  return this._client.get(path2`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, {
28255
29502
  query: query2,
28256
- ...options
29503
+ ...options,
29504
+ __security: { adminAPIKeyAuth: true }
28257
29505
  });
28258
29506
  }
28259
29507
  list(fineTunedModelCheckpoint, query2 = {}, options) {
28260
- return this._client.getAPIList(path2`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, ConversationCursorPage, { query: query2, ...options });
29508
+ return this._client.getAPIList(path2`/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, ConversationCursorPage, { query: query2, ...options, __security: { adminAPIKeyAuth: true } });
28261
29509
  }
28262
29510
  delete(permissionID, params, options) {
28263
29511
  const { fine_tuned_model_checkpoint } = params;
28264
- return this._client.delete(path2`/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, options);
29512
+ return this._client.delete(path2`/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, { ...options, __security: { adminAPIKeyAuth: true } });
28265
29513
  }
28266
29514
  }
28267
29515
 
@@ -28277,7 +29525,7 @@ Checkpoints.Permissions = Permissions;
28277
29525
  // node_modules/openai/resources/fine-tuning/jobs/checkpoints.mjs
28278
29526
  class Checkpoints2 extends APIResource2 {
28279
29527
  list(fineTuningJobID, query2 = {}, options) {
28280
- return this._client.getAPIList(path2`/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, CursorPage, { query: query2, ...options });
29528
+ return this._client.getAPIList(path2`/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, CursorPage, { query: query2, ...options, __security: { bearerAuth: true } });
28281
29529
  }
28282
29530
  }
28283
29531
 
@@ -28288,25 +29536,41 @@ class Jobs extends APIResource2 {
28288
29536
  this.checkpoints = new Checkpoints2(this._client);
28289
29537
  }
28290
29538
  create(body, options) {
28291
- return this._client.post("/fine_tuning/jobs", { body, ...options });
29539
+ return this._client.post("/fine_tuning/jobs", { body, ...options, __security: { bearerAuth: true } });
28292
29540
  }
28293
29541
  retrieve(fineTuningJobID, options) {
28294
- return this._client.get(path2`/fine_tuning/jobs/${fineTuningJobID}`, options);
29542
+ return this._client.get(path2`/fine_tuning/jobs/${fineTuningJobID}`, {
29543
+ ...options,
29544
+ __security: { bearerAuth: true }
29545
+ });
28295
29546
  }
28296
29547
  list(query2 = {}, options) {
28297
- return this._client.getAPIList("/fine_tuning/jobs", CursorPage, { query: query2, ...options });
29548
+ return this._client.getAPIList("/fine_tuning/jobs", CursorPage, {
29549
+ query: query2,
29550
+ ...options,
29551
+ __security: { bearerAuth: true }
29552
+ });
28298
29553
  }
28299
29554
  cancel(fineTuningJobID, options) {
28300
- return this._client.post(path2`/fine_tuning/jobs/${fineTuningJobID}/cancel`, options);
29555
+ return this._client.post(path2`/fine_tuning/jobs/${fineTuningJobID}/cancel`, {
29556
+ ...options,
29557
+ __security: { bearerAuth: true }
29558
+ });
28301
29559
  }
28302
29560
  listEvents(fineTuningJobID, query2 = {}, options) {
28303
- return this._client.getAPIList(path2`/fine_tuning/jobs/${fineTuningJobID}/events`, CursorPage, { query: query2, ...options });
29561
+ return this._client.getAPIList(path2`/fine_tuning/jobs/${fineTuningJobID}/events`, CursorPage, { query: query2, ...options, __security: { bearerAuth: true } });
28304
29562
  }
28305
29563
  pause(fineTuningJobID, options) {
28306
- return this._client.post(path2`/fine_tuning/jobs/${fineTuningJobID}/pause`, options);
29564
+ return this._client.post(path2`/fine_tuning/jobs/${fineTuningJobID}/pause`, {
29565
+ ...options,
29566
+ __security: { bearerAuth: true }
29567
+ });
28307
29568
  }
28308
29569
  resume(fineTuningJobID, options) {
28309
- return this._client.post(path2`/fine_tuning/jobs/${fineTuningJobID}/resume`, options);
29570
+ return this._client.post(path2`/fine_tuning/jobs/${fineTuningJobID}/resume`, {
29571
+ ...options,
29572
+ __security: { bearerAuth: true }
29573
+ });
28310
29574
  }
28311
29575
  }
28312
29576
  Jobs.Checkpoints = Checkpoints2;
@@ -28340,31 +29604,36 @@ Graders2.GraderModels = GraderModels;
28340
29604
  // node_modules/openai/resources/images.mjs
28341
29605
  class Images extends APIResource2 {
28342
29606
  createVariation(body, options) {
28343
- return this._client.post("/images/variations", multipartFormRequestOptions2({ body, ...options }, this._client));
29607
+ return this._client.post("/images/variations", multipartFormRequestOptions2({ body, ...options, __security: { bearerAuth: true } }, this._client));
28344
29608
  }
28345
29609
  edit(body, options) {
28346
- return this._client.post("/images/edits", multipartFormRequestOptions2({ body, ...options, stream: body.stream ?? false }, this._client));
29610
+ return this._client.post("/images/edits", multipartFormRequestOptions2({ body, ...options, stream: body.stream ?? false, __security: { bearerAuth: true } }, this._client));
28347
29611
  }
28348
29612
  generate(body, options) {
28349
- return this._client.post("/images/generations", { body, ...options, stream: body.stream ?? false });
29613
+ return this._client.post("/images/generations", {
29614
+ body,
29615
+ ...options,
29616
+ stream: body.stream ?? false,
29617
+ __security: { bearerAuth: true }
29618
+ });
28350
29619
  }
28351
29620
  }
28352
29621
  // node_modules/openai/resources/models.mjs
28353
29622
  class Models3 extends APIResource2 {
28354
29623
  retrieve(model, options) {
28355
- return this._client.get(path2`/models/${model}`, options);
29624
+ return this._client.get(path2`/models/${model}`, { ...options, __security: { bearerAuth: true } });
28356
29625
  }
28357
29626
  list(options) {
28358
- return this._client.getAPIList("/models", Page2, options);
29627
+ return this._client.getAPIList("/models", Page2, { ...options, __security: { bearerAuth: true } });
28359
29628
  }
28360
29629
  delete(model, options) {
28361
- return this._client.delete(path2`/models/${model}`, options);
29630
+ return this._client.delete(path2`/models/${model}`, { ...options, __security: { bearerAuth: true } });
28362
29631
  }
28363
29632
  }
28364
29633
  // node_modules/openai/resources/moderations.mjs
28365
29634
  class Moderations extends APIResource2 {
28366
29635
  create(body, options) {
28367
- return this._client.post("/moderations", { body, ...options });
29636
+ return this._client.post("/moderations", { body, ...options, __security: { bearerAuth: true } });
28368
29637
  }
28369
29638
  }
28370
29639
  // node_modules/openai/resources/realtime/calls.mjs
@@ -28373,27 +29642,31 @@ class Calls extends APIResource2 {
28373
29642
  return this._client.post(path2`/realtime/calls/${callID}/accept`, {
28374
29643
  body,
28375
29644
  ...options,
28376
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
29645
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
29646
+ __security: { bearerAuth: true }
28377
29647
  });
28378
29648
  }
28379
29649
  hangup(callID, options) {
28380
29650
  return this._client.post(path2`/realtime/calls/${callID}/hangup`, {
28381
29651
  ...options,
28382
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
29652
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
29653
+ __security: { bearerAuth: true }
28383
29654
  });
28384
29655
  }
28385
29656
  refer(callID, body, options) {
28386
29657
  return this._client.post(path2`/realtime/calls/${callID}/refer`, {
28387
29658
  body,
28388
29659
  ...options,
28389
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
29660
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
29661
+ __security: { bearerAuth: true }
28390
29662
  });
28391
29663
  }
28392
29664
  reject(callID, body = {}, options) {
28393
29665
  return this._client.post(path2`/realtime/calls/${callID}/reject`, {
28394
29666
  body,
28395
29667
  ...options,
28396
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
29668
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
29669
+ __security: { bearerAuth: true }
28397
29670
  });
28398
29671
  }
28399
29672
  }
@@ -28401,7 +29674,11 @@ class Calls extends APIResource2 {
28401
29674
  // node_modules/openai/resources/realtime/client-secrets.mjs
28402
29675
  class ClientSecrets extends APIResource2 {
28403
29676
  create(body, options) {
28404
- return this._client.post("/realtime/client_secrets", { body, ...options });
29677
+ return this._client.post("/realtime/client_secrets", {
29678
+ body,
29679
+ ...options,
29680
+ __security: { bearerAuth: true }
29681
+ });
28405
29682
  }
28406
29683
  }
28407
29684
 
@@ -28798,14 +30075,18 @@ function finalizeResponse(snapshot, params) {
28798
30075
  // node_modules/openai/resources/responses/input-items.mjs
28799
30076
  class InputItems extends APIResource2 {
28800
30077
  list(responseID, query2 = {}, options) {
28801
- return this._client.getAPIList(path2`/responses/${responseID}/input_items`, CursorPage, { query: query2, ...options });
30078
+ return this._client.getAPIList(path2`/responses/${responseID}/input_items`, CursorPage, { query: query2, ...options, __security: { bearerAuth: true } });
28802
30079
  }
28803
30080
  }
28804
30081
 
28805
30082
  // node_modules/openai/resources/responses/input-tokens.mjs
28806
30083
  class InputTokens extends APIResource2 {
28807
30084
  count(body = {}, options) {
28808
- return this._client.post("/responses/input_tokens", { body, ...options });
30085
+ return this._client.post("/responses/input_tokens", {
30086
+ body,
30087
+ ...options,
30088
+ __security: { bearerAuth: true }
30089
+ });
28809
30090
  }
28810
30091
  }
28811
30092
 
@@ -28817,7 +30098,12 @@ class Responses extends APIResource2 {
28817
30098
  this.inputTokens = new InputTokens(this._client);
28818
30099
  }
28819
30100
  create(body, options) {
28820
- return this._client.post("/responses", { body, ...options, stream: body.stream ?? false })._thenUnwrap((rsp) => {
30101
+ return this._client.post("/responses", {
30102
+ body,
30103
+ ...options,
30104
+ stream: body.stream ?? false,
30105
+ __security: { bearerAuth: true }
30106
+ })._thenUnwrap((rsp) => {
28821
30107
  if ("object" in rsp && rsp.object === "response") {
28822
30108
  addOutputText(rsp);
28823
30109
  }
@@ -28828,7 +30114,8 @@ class Responses extends APIResource2 {
28828
30114
  return this._client.get(path2`/responses/${responseID}`, {
28829
30115
  query: query2,
28830
30116
  ...options,
28831
- stream: query2?.stream ?? false
30117
+ stream: query2?.stream ?? false,
30118
+ __security: { bearerAuth: true }
28832
30119
  })._thenUnwrap((rsp) => {
28833
30120
  if ("object" in rsp && rsp.object === "response") {
28834
30121
  addOutputText(rsp);
@@ -28839,7 +30126,8 @@ class Responses extends APIResource2 {
28839
30126
  delete(responseID, options) {
28840
30127
  return this._client.delete(path2`/responses/${responseID}`, {
28841
30128
  ...options,
28842
- headers: buildHeaders2([{ Accept: "*/*" }, options?.headers])
30129
+ headers: buildHeaders2([{ Accept: "*/*" }, options?.headers]),
30130
+ __security: { bearerAuth: true }
28843
30131
  });
28844
30132
  }
28845
30133
  parse(body, options) {
@@ -28849,10 +30137,13 @@ class Responses extends APIResource2 {
28849
30137
  return ResponseStream.createResponse(this._client, body, options);
28850
30138
  }
28851
30139
  cancel(responseID, options) {
28852
- return this._client.post(path2`/responses/${responseID}/cancel`, options);
30140
+ return this._client.post(path2`/responses/${responseID}/cancel`, {
30141
+ ...options,
30142
+ __security: { bearerAuth: true }
30143
+ });
28853
30144
  }
28854
30145
  compact(body, options) {
28855
- return this._client.post("/responses/compact", { body, ...options });
30146
+ return this._client.post("/responses/compact", { body, ...options, __security: { bearerAuth: true } });
28856
30147
  }
28857
30148
  }
28858
30149
  Responses.InputItems = InputItems;
@@ -28863,6 +30154,7 @@ class Content2 extends APIResource2 {
28863
30154
  return this._client.get(path2`/skills/${skillID}/content`, {
28864
30155
  ...options,
28865
30156
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
30157
+ __security: { bearerAuth: true },
28866
30158
  __binaryResponse: true
28867
30159
  });
28868
30160
  }
@@ -28875,6 +30167,7 @@ class Content3 extends APIResource2 {
28875
30167
  return this._client.get(path2`/skills/${skill_id}/versions/${version}/content`, {
28876
30168
  ...options,
28877
30169
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
30170
+ __security: { bearerAuth: true },
28878
30171
  __binaryResponse: true
28879
30172
  });
28880
30173
  }
@@ -28887,21 +30180,28 @@ class Versions2 extends APIResource2 {
28887
30180
  this.content = new Content3(this._client);
28888
30181
  }
28889
30182
  create(skillID, body = {}, options) {
28890
- return this._client.post(path2`/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
30183
+ return this._client.post(path2`/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
28891
30184
  }
28892
30185
  retrieve(version, params, options) {
28893
30186
  const { skill_id } = params;
28894
- return this._client.get(path2`/skills/${skill_id}/versions/${version}`, options);
30187
+ return this._client.get(path2`/skills/${skill_id}/versions/${version}`, {
30188
+ ...options,
30189
+ __security: { bearerAuth: true }
30190
+ });
28895
30191
  }
28896
30192
  list(skillID, query2 = {}, options) {
28897
30193
  return this._client.getAPIList(path2`/skills/${skillID}/versions`, CursorPage, {
28898
30194
  query: query2,
28899
- ...options
30195
+ ...options,
30196
+ __security: { bearerAuth: true }
28900
30197
  });
28901
30198
  }
28902
30199
  delete(version, params, options) {
28903
30200
  const { skill_id } = params;
28904
- return this._client.delete(path2`/skills/${skill_id}/versions/${version}`, options);
30201
+ return this._client.delete(path2`/skills/${skill_id}/versions/${version}`, {
30202
+ ...options,
30203
+ __security: { bearerAuth: true }
30204
+ });
28905
30205
  }
28906
30206
  }
28907
30207
  Versions2.Content = Content3;
@@ -28914,19 +30214,27 @@ class Skills2 extends APIResource2 {
28914
30214
  this.versions = new Versions2(this._client);
28915
30215
  }
28916
30216
  create(body = {}, options) {
28917
- return this._client.post("/skills", maybeMultipartFormRequestOptions({ body, ...options }, this._client));
30217
+ return this._client.post("/skills", maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
28918
30218
  }
28919
30219
  retrieve(skillID, options) {
28920
- return this._client.get(path2`/skills/${skillID}`, options);
30220
+ return this._client.get(path2`/skills/${skillID}`, { ...options, __security: { bearerAuth: true } });
28921
30221
  }
28922
30222
  update(skillID, body, options) {
28923
- return this._client.post(path2`/skills/${skillID}`, { body, ...options });
30223
+ return this._client.post(path2`/skills/${skillID}`, {
30224
+ body,
30225
+ ...options,
30226
+ __security: { bearerAuth: true }
30227
+ });
28924
30228
  }
28925
30229
  list(query2 = {}, options) {
28926
- return this._client.getAPIList("/skills", CursorPage, { query: query2, ...options });
30230
+ return this._client.getAPIList("/skills", CursorPage, {
30231
+ query: query2,
30232
+ ...options,
30233
+ __security: { bearerAuth: true }
30234
+ });
28927
30235
  }
28928
30236
  delete(skillID, options) {
28929
- return this._client.delete(path2`/skills/${skillID}`, options);
30237
+ return this._client.delete(path2`/skills/${skillID}`, { ...options, __security: { bearerAuth: true } });
28930
30238
  }
28931
30239
  }
28932
30240
  Skills2.Content = Content2;
@@ -28934,7 +30242,7 @@ Skills2.Versions = Versions2;
28934
30242
  // node_modules/openai/resources/uploads/parts.mjs
28935
30243
  class Parts extends APIResource2 {
28936
30244
  create(uploadID, body, options) {
28937
- return this._client.post(path2`/uploads/${uploadID}/parts`, multipartFormRequestOptions2({ body, ...options }, this._client));
30245
+ return this._client.post(path2`/uploads/${uploadID}/parts`, multipartFormRequestOptions2({ body, ...options, __security: { bearerAuth: true } }, this._client));
28938
30246
  }
28939
30247
  }
28940
30248
 
@@ -28945,13 +30253,20 @@ class Uploads extends APIResource2 {
28945
30253
  this.parts = new Parts(this._client);
28946
30254
  }
28947
30255
  create(body, options) {
28948
- return this._client.post("/uploads", { body, ...options });
30256
+ return this._client.post("/uploads", { body, ...options, __security: { bearerAuth: true } });
28949
30257
  }
28950
30258
  cancel(uploadID, options) {
28951
- return this._client.post(path2`/uploads/${uploadID}/cancel`, options);
30259
+ return this._client.post(path2`/uploads/${uploadID}/cancel`, {
30260
+ ...options,
30261
+ __security: { bearerAuth: true }
30262
+ });
28952
30263
  }
28953
30264
  complete(uploadID, body, options) {
28954
- return this._client.post(path2`/uploads/${uploadID}/complete`, { body, ...options });
30265
+ return this._client.post(path2`/uploads/${uploadID}/complete`, {
30266
+ body,
30267
+ ...options,
30268
+ __security: { bearerAuth: true }
30269
+ });
28955
30270
  }
28956
30271
  }
28957
30272
  Uploads.Parts = Parts;
@@ -28980,21 +30295,24 @@ class FileBatches extends APIResource2 {
28980
30295
  return this._client.post(path2`/vector_stores/${vectorStoreID}/file_batches`, {
28981
30296
  body,
28982
30297
  ...options,
28983
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
30298
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30299
+ __security: { bearerAuth: true }
28984
30300
  });
28985
30301
  }
28986
30302
  retrieve(batchID, params, options) {
28987
30303
  const { vector_store_id } = params;
28988
30304
  return this._client.get(path2`/vector_stores/${vector_store_id}/file_batches/${batchID}`, {
28989
30305
  ...options,
28990
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
30306
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30307
+ __security: { bearerAuth: true }
28991
30308
  });
28992
30309
  }
28993
30310
  cancel(batchID, params, options) {
28994
30311
  const { vector_store_id } = params;
28995
30312
  return this._client.post(path2`/vector_stores/${vector_store_id}/file_batches/${batchID}/cancel`, {
28996
30313
  ...options,
28997
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
30314
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30315
+ __security: { bearerAuth: true }
28998
30316
  });
28999
30317
  }
29000
30318
  async createAndPoll(vectorStoreId, body, options) {
@@ -29003,7 +30321,12 @@ class FileBatches extends APIResource2 {
29003
30321
  }
29004
30322
  listFiles(batchID, params, options) {
29005
30323
  const { vector_store_id, ...query2 } = params;
29006
- return this._client.getAPIList(path2`/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, CursorPage, { query: query2, ...options, headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]) });
30324
+ return this._client.getAPIList(path2`/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, CursorPage, {
30325
+ query: query2,
30326
+ ...options,
30327
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30328
+ __security: { bearerAuth: true }
30329
+ });
29007
30330
  }
29008
30331
  async poll(vectorStoreID, batchID, options) {
29009
30332
  const headers = buildHeaders2([
@@ -29070,14 +30393,16 @@ class Files4 extends APIResource2 {
29070
30393
  return this._client.post(path2`/vector_stores/${vectorStoreID}/files`, {
29071
30394
  body,
29072
30395
  ...options,
29073
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
30396
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30397
+ __security: { bearerAuth: true }
29074
30398
  });
29075
30399
  }
29076
30400
  retrieve(fileID, params, options) {
29077
30401
  const { vector_store_id } = params;
29078
30402
  return this._client.get(path2`/vector_stores/${vector_store_id}/files/${fileID}`, {
29079
30403
  ...options,
29080
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
30404
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30405
+ __security: { bearerAuth: true }
29081
30406
  });
29082
30407
  }
29083
30408
  update(fileID, params, options) {
@@ -29085,21 +30410,24 @@ class Files4 extends APIResource2 {
29085
30410
  return this._client.post(path2`/vector_stores/${vector_store_id}/files/${fileID}`, {
29086
30411
  body,
29087
30412
  ...options,
29088
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
30413
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30414
+ __security: { bearerAuth: true }
29089
30415
  });
29090
30416
  }
29091
30417
  list(vectorStoreID, query2 = {}, options) {
29092
30418
  return this._client.getAPIList(path2`/vector_stores/${vectorStoreID}/files`, CursorPage, {
29093
30419
  query: query2,
29094
30420
  ...options,
29095
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
30421
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30422
+ __security: { bearerAuth: true }
29096
30423
  });
29097
30424
  }
29098
30425
  delete(fileID, params, options) {
29099
30426
  const { vector_store_id } = params;
29100
30427
  return this._client.delete(path2`/vector_stores/${vector_store_id}/files/${fileID}`, {
29101
30428
  ...options,
29102
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
30429
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30430
+ __security: { bearerAuth: true }
29103
30431
  });
29104
30432
  }
29105
30433
  async createAndPoll(vectorStoreId, body, options) {
@@ -29151,7 +30479,11 @@ class Files4 extends APIResource2 {
29151
30479
  }
29152
30480
  content(fileID, params, options) {
29153
30481
  const { vector_store_id } = params;
29154
- return this._client.getAPIList(path2`/vector_stores/${vector_store_id}/files/${fileID}/content`, Page2, { ...options, headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]) });
30482
+ return this._client.getAPIList(path2`/vector_stores/${vector_store_id}/files/${fileID}/content`, Page2, {
30483
+ ...options,
30484
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30485
+ __security: { bearerAuth: true }
30486
+ });
29155
30487
  }
29156
30488
  }
29157
30489
 
@@ -29166,33 +30498,38 @@ class VectorStores extends APIResource2 {
29166
30498
  return this._client.post("/vector_stores", {
29167
30499
  body,
29168
30500
  ...options,
29169
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
30501
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30502
+ __security: { bearerAuth: true }
29170
30503
  });
29171
30504
  }
29172
30505
  retrieve(vectorStoreID, options) {
29173
30506
  return this._client.get(path2`/vector_stores/${vectorStoreID}`, {
29174
30507
  ...options,
29175
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
30508
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30509
+ __security: { bearerAuth: true }
29176
30510
  });
29177
30511
  }
29178
30512
  update(vectorStoreID, body, options) {
29179
30513
  return this._client.post(path2`/vector_stores/${vectorStoreID}`, {
29180
30514
  body,
29181
30515
  ...options,
29182
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
30516
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30517
+ __security: { bearerAuth: true }
29183
30518
  });
29184
30519
  }
29185
30520
  list(query2 = {}, options) {
29186
30521
  return this._client.getAPIList("/vector_stores", CursorPage, {
29187
30522
  query: query2,
29188
30523
  ...options,
29189
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
30524
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30525
+ __security: { bearerAuth: true }
29190
30526
  });
29191
30527
  }
29192
30528
  delete(vectorStoreID, options) {
29193
30529
  return this._client.delete(path2`/vector_stores/${vectorStoreID}`, {
29194
30530
  ...options,
29195
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
30531
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30532
+ __security: { bearerAuth: true }
29196
30533
  });
29197
30534
  }
29198
30535
  search(vectorStoreID, body, options) {
@@ -29200,7 +30537,8 @@ class VectorStores extends APIResource2 {
29200
30537
  body,
29201
30538
  method: "post",
29202
30539
  ...options,
29203
- headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers])
30540
+ headers: buildHeaders2([{ "OpenAI-Beta": "assistants=v2" }, options?.headers]),
30541
+ __security: { bearerAuth: true }
29204
30542
  });
29205
30543
  }
29206
30544
  }
@@ -29209,39 +30547,47 @@ VectorStores.FileBatches = FileBatches;
29209
30547
  // node_modules/openai/resources/videos.mjs
29210
30548
  class Videos extends APIResource2 {
29211
30549
  create(body, options) {
29212
- return this._client.post("/videos", multipartFormRequestOptions2({ body, ...options }, this._client));
30550
+ return this._client.post("/videos", multipartFormRequestOptions2({ body, ...options, __security: { bearerAuth: true } }, this._client));
29213
30551
  }
29214
30552
  retrieve(videoID, options) {
29215
- return this._client.get(path2`/videos/${videoID}`, options);
30553
+ return this._client.get(path2`/videos/${videoID}`, { ...options, __security: { bearerAuth: true } });
29216
30554
  }
29217
30555
  list(query2 = {}, options) {
29218
- return this._client.getAPIList("/videos", ConversationCursorPage, { query: query2, ...options });
30556
+ return this._client.getAPIList("/videos", ConversationCursorPage, {
30557
+ query: query2,
30558
+ ...options,
30559
+ __security: { bearerAuth: true }
30560
+ });
29219
30561
  }
29220
30562
  delete(videoID, options) {
29221
- return this._client.delete(path2`/videos/${videoID}`, options);
30563
+ return this._client.delete(path2`/videos/${videoID}`, { ...options, __security: { bearerAuth: true } });
29222
30564
  }
29223
30565
  createCharacter(body, options) {
29224
- return this._client.post("/videos/characters", multipartFormRequestOptions2({ body, ...options }, this._client));
30566
+ return this._client.post("/videos/characters", multipartFormRequestOptions2({ body, ...options, __security: { bearerAuth: true } }, this._client));
29225
30567
  }
29226
30568
  downloadContent(videoID, query2 = {}, options) {
29227
30569
  return this._client.get(path2`/videos/${videoID}/content`, {
29228
30570
  query: query2,
29229
30571
  ...options,
29230
30572
  headers: buildHeaders2([{ Accept: "application/binary" }, options?.headers]),
30573
+ __security: { bearerAuth: true },
29231
30574
  __binaryResponse: true
29232
30575
  });
29233
30576
  }
29234
30577
  edit(body, options) {
29235
- return this._client.post("/videos/edits", multipartFormRequestOptions2({ body, ...options }, this._client));
30578
+ return this._client.post("/videos/edits", multipartFormRequestOptions2({ body, ...options, __security: { bearerAuth: true } }, this._client));
29236
30579
  }
29237
30580
  extend(body, options) {
29238
- return this._client.post("/videos/extensions", multipartFormRequestOptions2({ body, ...options }, this._client));
30581
+ return this._client.post("/videos/extensions", multipartFormRequestOptions2({ body, ...options, __security: { bearerAuth: true } }, this._client));
29239
30582
  }
29240
30583
  getCharacter(characterID, options) {
29241
- return this._client.get(path2`/videos/characters/${characterID}`, options);
30584
+ return this._client.get(path2`/videos/characters/${characterID}`, {
30585
+ ...options,
30586
+ __security: { bearerAuth: true }
30587
+ });
29242
30588
  }
29243
30589
  remix(videoID, body, options) {
29244
- return this._client.post(path2`/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
30590
+ return this._client.post(path2`/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
29245
30591
  }
29246
30592
  }
29247
30593
  // node_modules/openai/resources/webhooks/webhooks.mjs
@@ -29315,9 +30661,10 @@ var _OpenAI_instances;
29315
30661
  var _a3;
29316
30662
  var _OpenAI_encoder;
29317
30663
  var _OpenAI_baseURLOverridden;
30664
+ var WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER = "workload-identity-auth";
29318
30665
 
29319
30666
  class OpenAI {
29320
- constructor({ baseURL = readEnv2("OPENAI_BASE_URL"), apiKey = readEnv2("OPENAI_API_KEY"), organization = readEnv2("OPENAI_ORG_ID") ?? null, project = readEnv2("OPENAI_PROJECT_ID") ?? null, webhookSecret = readEnv2("OPENAI_WEBHOOK_SECRET") ?? null, ...opts } = {}) {
30667
+ constructor({ baseURL = readEnv2("OPENAI_BASE_URL"), apiKey = readEnv2("OPENAI_API_KEY") ?? null, adminAPIKey = readEnv2("OPENAI_ADMIN_KEY") ?? null, organization = readEnv2("OPENAI_ORG_ID") ?? null, project = readEnv2("OPENAI_PROJECT_ID") ?? null, webhookSecret = readEnv2("OPENAI_WEBHOOK_SECRET") ?? null, workloadIdentity, ...opts } = {}) {
29321
30668
  _OpenAI_instances.add(this);
29322
30669
  _OpenAI_encoder.set(this, undefined);
29323
30670
  this.completions = new Completions3(this);
@@ -29335,6 +30682,7 @@ class OpenAI {
29335
30682
  this.beta = new Beta2(this);
29336
30683
  this.batches = new Batches3(this);
29337
30684
  this.uploads = new Uploads(this);
30685
+ this.admin = new Admin(this);
29338
30686
  this.responses = new Responses(this);
29339
30687
  this.realtime = new Realtime2(this);
29340
30688
  this.conversations = new Conversations(this);
@@ -29342,17 +30690,22 @@ class OpenAI {
29342
30690
  this.containers = new Containers(this);
29343
30691
  this.skills = new Skills2(this);
29344
30692
  this.videos = new Videos(this);
29345
- if (apiKey === undefined) {
29346
- throw new OpenAIError("Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.");
29347
- }
29348
30693
  const options = {
29349
30694
  apiKey,
30695
+ adminAPIKey,
29350
30696
  organization,
29351
30697
  project,
29352
30698
  webhookSecret,
30699
+ workloadIdentity,
29353
30700
  ...opts,
29354
30701
  baseURL: baseURL || `https://api.openai.com/v1`
29355
30702
  };
30703
+ if (apiKey && workloadIdentity) {
30704
+ throw new OpenAIError("The `apiKey` and `workloadIdentity` options are mutually exclusive");
30705
+ }
30706
+ if (!apiKey && !adminAPIKey && !workloadIdentity) {
30707
+ throw new OpenAIError("Missing credentials. Please pass an `apiKey`, `workloadIdentity`, `adminAPIKey`, or set the `OPENAI_API_KEY` or `OPENAI_ADMIN_KEY` environment variable.");
30708
+ }
29356
30709
  if (!options.dangerouslyAllowBrowser && isRunningInBrowser2()) {
29357
30710
  throw new OpenAIError(`It looks like you're running in a browser-like environment.
29358
30711
 
@@ -29375,8 +30728,24 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
29375
30728
  this.maxRetries = options.maxRetries ?? 2;
29376
30729
  this.fetch = options.fetch ?? getDefaultFetch2();
29377
30730
  __classPrivateFieldSet2(this, _OpenAI_encoder, FallbackEncoder2, "f");
30731
+ const customHeadersEnv = readEnv2("OPENAI_CUSTOM_HEADERS");
30732
+ if (customHeadersEnv) {
30733
+ const parsed = {};
30734
+ for (const line of customHeadersEnv.split(`
30735
+ `)) {
30736
+ const colon = line.indexOf(":");
30737
+ if (colon >= 0) {
30738
+ parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
30739
+ }
30740
+ }
30741
+ options.defaultHeaders = buildHeaders2([parsed, options.defaultHeaders]);
30742
+ }
29378
30743
  this._options = options;
29379
- this.apiKey = typeof apiKey === "string" ? apiKey : "Missing Key";
30744
+ if (workloadIdentity) {
30745
+ this._workloadIdentityAuth = new WorkloadIdentityAuth(workloadIdentity, this.fetch);
30746
+ }
30747
+ this.apiKey = typeof apiKey === "string" ? apiKey : null;
30748
+ this.adminAPIKey = adminAPIKey;
29380
30749
  this.organization = organization;
29381
30750
  this.project = project;
29382
30751
  this.webhookSecret = webhookSecret;
@@ -29391,7 +30760,9 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
29391
30760
  logLevel: this.logLevel,
29392
30761
  fetch: this.fetch,
29393
30762
  fetchOptions: this.fetchOptions,
29394
- apiKey: this.apiKey,
30763
+ apiKey: this._options.apiKey,
30764
+ adminAPIKey: this.adminAPIKey,
30765
+ workloadIdentity: this._options.workloadIdentity,
29395
30766
  organization: this.organization,
29396
30767
  project: this.project,
29397
30768
  webhookSecret: this.webhookSecret,
@@ -29402,12 +30773,45 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
29402
30773
  defaultQuery() {
29403
30774
  return this._options.defaultQuery;
29404
30775
  }
29405
- validateHeaders({ values: values2, nulls }) {
29406
- return;
30776
+ validateHeaders({ values: values2, nulls }, schemes = {
30777
+ bearerAuth: true,
30778
+ adminAPIKeyAuth: true
30779
+ }) {
30780
+ if (values2.get("authorization") || values2.get("api-key")) {
30781
+ return;
30782
+ }
30783
+ if (nulls.has("authorization") || nulls.has("api-key")) {
30784
+ return;
30785
+ }
30786
+ if (this._workloadIdentityAuth && schemes.bearerAuth) {
30787
+ return;
30788
+ }
30789
+ throw new Error('Could not resolve authentication method. Expected either apiKey or adminAPIKey to be set. Or for one of the "Authorization" or "api-key" headers to be explicitly omitted');
29407
30790
  }
29408
- async authHeaders(opts) {
30791
+ async authHeaders(opts, schemes = {
30792
+ bearerAuth: true,
30793
+ adminAPIKeyAuth: true
30794
+ }) {
30795
+ return buildHeaders2([
30796
+ schemes.bearerAuth ? await this.bearerAuth(opts) : null,
30797
+ schemes.adminAPIKeyAuth ? await this.adminAPIKeyAuth(opts) : null
30798
+ ]);
30799
+ }
30800
+ async bearerAuth(opts) {
30801
+ if (this._workloadIdentityAuth) {
30802
+ return buildHeaders2([{ Authorization: `Bearer ${await this._workloadIdentityAuth.getToken()}` }]);
30803
+ }
30804
+ if (this.apiKey == null) {
30805
+ return;
30806
+ }
29409
30807
  return buildHeaders2([{ Authorization: `Bearer ${this.apiKey}` }]);
29410
30808
  }
30809
+ async adminAPIKeyAuth(opts) {
30810
+ if (this.adminAPIKey == null) {
30811
+ return;
30812
+ }
30813
+ return buildHeaders2([{ Authorization: `Bearer ${this.adminAPIKey}` }]);
30814
+ }
29411
30815
  stringifyQuery(query2) {
29412
30816
  return stringifyQuery2(query2);
29413
30817
  }
@@ -29452,7 +30856,10 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
29452
30856
  return url.toString();
29453
30857
  }
29454
30858
  async prepareOptions(options) {
29455
- await this._callApiKey();
30859
+ const security = options.__security ?? { bearerAuth: true };
30860
+ if (security.bearerAuth) {
30861
+ await this._callApiKey();
30862
+ }
29456
30863
  }
29457
30864
  async prepareRequest(request, { url, options }) {}
29458
30865
  get(path3, opts) {
@@ -29502,8 +30909,9 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
29502
30909
  if (options.signal?.aborted) {
29503
30910
  throw new APIUserAbortError2;
29504
30911
  }
30912
+ const security = options.__security ?? { bearerAuth: true };
29505
30913
  const controller = new AbortController;
29506
- const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError2);
30914
+ const response = await this.fetchWithAuth(url, req, timeout, controller, security).catch(castToError2);
29507
30915
  const headersTime = Date.now();
29508
30916
  if (response instanceof globalThis.Error) {
29509
30917
  const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
@@ -29528,6 +30936,9 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
29528
30936
  durationMs: headersTime - startTime,
29529
30937
  message: response.message
29530
30938
  }));
30939
+ if (response instanceof OAuthError || response instanceof SubjectTokenProviderError) {
30940
+ throw response;
30941
+ }
29531
30942
  if (isTimeout) {
29532
30943
  throw new APIConnectionTimeoutError2;
29533
30944
  }
@@ -29536,6 +30947,17 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
29536
30947
  const specialHeaders = [...response.headers.entries()].filter(([name]) => name === "x-request-id").map(([name, value]) => ", " + name + ": " + JSON.stringify(value)).join("");
29537
30948
  const responseInfo = `[${requestLogID}${retryLogStr}${specialHeaders}] ${req.method} ${url} ${response.ok ? "succeeded" : "failed"} with status ${response.status} in ${headersTime - startTime}ms`;
29538
30949
  if (!response.ok) {
30950
+ if (response.status === 401 && this._workloadIdentityAuth && security.bearerAuth && !options.__metadata?.["hasStreamingBody"] && !options.__metadata?.["workloadIdentityTokenRefreshed"]) {
30951
+ await CancelReadableStream2(response.body);
30952
+ this._workloadIdentityAuth.invalidateToken();
30953
+ return this.makeRequest({
30954
+ ...options,
30955
+ __metadata: {
30956
+ ...options.__metadata,
30957
+ workloadIdentityTokenRefreshed: true
30958
+ }
30959
+ }, retriesRemaining, retryOfRequestLogID ?? requestLogID);
30960
+ }
29539
30961
  const shouldRetry = await this.shouldRetry(response);
29540
30962
  if (retriesRemaining && shouldRetry) {
29541
30963
  const retryMessage2 = `retrying, ${retriesRemaining} attempts remaining`;
@@ -29583,6 +31005,21 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
29583
31005
  const request = this.makeRequest(options, null, undefined);
29584
31006
  return new PagePromise2(this, request, Page3);
29585
31007
  }
31008
+ async fetchWithAuth(url, init, timeout, controller, schemes = {
31009
+ bearerAuth: true,
31010
+ adminAPIKeyAuth: true
31011
+ }) {
31012
+ if (this._workloadIdentityAuth && schemes.bearerAuth) {
31013
+ const headers = init.headers;
31014
+ const authHeader = headers.get("Authorization");
31015
+ if (!authHeader || authHeader === `Bearer ${WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER}`) {
31016
+ const token = await this._workloadIdentityAuth.getToken();
31017
+ headers.set("Authorization", `Bearer ${token}`);
31018
+ }
31019
+ }
31020
+ const response = await this.fetchWithTimeout(url, init, timeout, controller);
31021
+ return response;
31022
+ }
29586
31023
  async fetchWithTimeout(url, init, ms, controller) {
29587
31024
  const { signal, method, ...options } = init || {};
29588
31025
  const abort = this._makeAbort(controller);
@@ -29661,7 +31098,13 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
29661
31098
  if ("timeout" in options)
29662
31099
  validatePositiveInteger2("timeout", options.timeout);
29663
31100
  options.timeout = options.timeout ?? this.timeout;
29664
- const { bodyHeaders, body } = this.buildBody({ options });
31101
+ const { bodyHeaders, body, isStreamingBody } = this.buildBody({ options });
31102
+ if (isStreamingBody) {
31103
+ inputOptions.__metadata = {
31104
+ ...inputOptions.__metadata,
31105
+ hasStreamingBody: true
31106
+ };
31107
+ }
29665
31108
  const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount });
29666
31109
  const req = {
29667
31110
  method,
@@ -29692,12 +31135,12 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
29692
31135
  "OpenAI-Organization": this.organization,
29693
31136
  "OpenAI-Project": this.project
29694
31137
  },
29695
- await this.authHeaders(options),
31138
+ await this.authHeaders(options, options.__security ?? { bearerAuth: true }),
29696
31139
  this._options.defaultHeaders,
29697
31140
  bodyHeaders,
29698
31141
  options.headers
29699
31142
  ]);
29700
- this.validateHeaders(headers);
31143
+ this.validateHeaders(headers, options.__security ?? { bearerAuth: true });
29701
31144
  return headers.values;
29702
31145
  }
29703
31146
  _makeAbort(controller) {
@@ -29705,20 +31148,27 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
29705
31148
  }
29706
31149
  buildBody({ options: { body, headers: rawHeaders } }) {
29707
31150
  if (!body) {
29708
- return { bodyHeaders: undefined, body: undefined };
31151
+ return { bodyHeaders: undefined, body: undefined, isStreamingBody: false };
29709
31152
  }
29710
31153
  const headers = buildHeaders2([rawHeaders]);
29711
- if (ArrayBuffer.isView(body) || body instanceof ArrayBuffer || body instanceof DataView || typeof body === "string" && headers.values.has("content-type") || globalThis.Blob && body instanceof globalThis.Blob || body instanceof FormData || body instanceof URLSearchParams || globalThis.ReadableStream && body instanceof globalThis.ReadableStream) {
29712
- return { bodyHeaders: undefined, body };
31154
+ const isReadableStream = typeof globalThis.ReadableStream !== "undefined" && body instanceof globalThis.ReadableStream;
31155
+ const isRetryableBody = !isReadableStream && (typeof body === "string" || body instanceof ArrayBuffer || ArrayBuffer.isView(body) || typeof globalThis.Blob !== "undefined" && body instanceof globalThis.Blob || body instanceof URLSearchParams || body instanceof FormData);
31156
+ if (ArrayBuffer.isView(body) || body instanceof ArrayBuffer || body instanceof DataView || typeof body === "string" && headers.values.has("content-type") || globalThis.Blob && body instanceof globalThis.Blob || body instanceof FormData || body instanceof URLSearchParams || isReadableStream) {
31157
+ return { bodyHeaders: undefined, body, isStreamingBody: !isRetryableBody };
29713
31158
  } else if (typeof body === "object" && ((Symbol.asyncIterator in body) || (Symbol.iterator in body) && ("next" in body) && typeof body.next === "function")) {
29714
- return { bodyHeaders: undefined, body: ReadableStreamFrom2(body) };
31159
+ return {
31160
+ bodyHeaders: undefined,
31161
+ body: ReadableStreamFrom2(body),
31162
+ isStreamingBody: true
31163
+ };
29715
31164
  } else if (typeof body === "object" && headers.values.get("content-type") === "application/x-www-form-urlencoded") {
29716
31165
  return {
29717
31166
  bodyHeaders: { "content-type": "application/x-www-form-urlencoded" },
29718
- body: this.stringifyQuery(body)
31167
+ body: this.stringifyQuery(body),
31168
+ isStreamingBody: false
29719
31169
  };
29720
31170
  } else {
29721
- return __classPrivateFieldGet2(this, _OpenAI_encoder, "f").call(this, { body, headers });
31171
+ return { ...__classPrivateFieldGet2(this, _OpenAI_encoder, "f").call(this, { body, headers }), isStreamingBody: false };
29722
31172
  }
29723
31173
  }
29724
31174
  }
@@ -29757,6 +31207,7 @@ OpenAI.Webhooks = Webhooks;
29757
31207
  OpenAI.Beta = Beta2;
29758
31208
  OpenAI.Batches = Batches3;
29759
31209
  OpenAI.Uploads = Uploads;
31210
+ OpenAI.Admin = Admin;
29760
31211
  OpenAI.Responses = Responses;
29761
31212
  OpenAI.Realtime = Realtime2;
29762
31213
  OpenAI.Conversations = Conversations;