@discomedia/utils 1.0.70 → 1.0.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index-frontend.cjs +2290 -188
- package/dist/index-frontend.cjs.map +1 -1
- package/dist/index-frontend.mjs +2289 -189
- package/dist/index-frontend.mjs.map +1 -1
- package/dist/index.cjs +2290 -188
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2289 -189
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +4 -4
- package/dist/test.js +2281 -194
- package/dist/test.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/llm-config.d.ts +18 -3
- package/dist/types/llm-config.d.ts.map +1 -1
- package/dist/types/llm-images.d.ts.map +1 -1
- package/dist/types/types/llm-types.d.ts +12 -3
- package/dist/types/types/llm-types.d.ts.map +1 -1
- package/dist/types-frontend/index.d.ts +1 -1
- package/dist/types-frontend/index.d.ts.map +1 -1
- package/dist/types-frontend/llm-config.d.ts +18 -3
- package/dist/types-frontend/llm-config.d.ts.map +1 -1
- package/dist/types-frontend/llm-images.d.ts.map +1 -1
- package/dist/types-frontend/types/llm-types.d.ts +12 -3
- package/dist/types-frontend/types/llm-types.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1164,6 +1164,25 @@ const OPENAI_MODELS = [
|
|
|
1164
1164
|
function isOpenAIModel(model) {
|
|
1165
1165
|
return OPENAI_MODELS.includes(model);
|
|
1166
1166
|
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Represents OpenAI image models.
|
|
1169
|
+
*/
|
|
1170
|
+
const OPENAI_IMAGE_MODELS = [
|
|
1171
|
+
'gpt-image-2',
|
|
1172
|
+
'gpt-image-2-2026-04-21',
|
|
1173
|
+
'gpt-image-1.5',
|
|
1174
|
+
'gpt-image-1',
|
|
1175
|
+
'gpt-image-1-mini',
|
|
1176
|
+
'chatgpt-image-latest',
|
|
1177
|
+
'dall-e-2',
|
|
1178
|
+
'dall-e-3',
|
|
1179
|
+
];
|
|
1180
|
+
/**
|
|
1181
|
+
* Type guard to check if a model is a supported OpenAI image model.
|
|
1182
|
+
*/
|
|
1183
|
+
function isOpenAIImageModel(model) {
|
|
1184
|
+
return OPENAI_IMAGE_MODELS.includes(model);
|
|
1185
|
+
}
|
|
1167
1186
|
/**
|
|
1168
1187
|
* Represents OpenRouter models
|
|
1169
1188
|
*/
|
|
@@ -1198,8 +1217,10 @@ function isOpenRouterModel(model) {
|
|
|
1198
1217
|
|
|
1199
1218
|
var Types = /*#__PURE__*/Object.freeze({
|
|
1200
1219
|
__proto__: null,
|
|
1220
|
+
OPENAI_IMAGE_MODELS: OPENAI_IMAGE_MODELS,
|
|
1201
1221
|
OPENAI_MODELS: OPENAI_MODELS,
|
|
1202
1222
|
OPENROUTER_MODELS: OPENROUTER_MODELS,
|
|
1223
|
+
isOpenAIImageModel: isOpenAIImageModel,
|
|
1203
1224
|
isOpenAIModel: isOpenAIModel,
|
|
1204
1225
|
isOpenRouterModel: isOpenRouterModel
|
|
1205
1226
|
});
|
|
@@ -1679,7 +1700,7 @@ const safeJSON = (text) => {
|
|
|
1679
1700
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
1680
1701
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
1681
1702
|
|
|
1682
|
-
const VERSION = '6.
|
|
1703
|
+
const VERSION = '6.37.0'; // x-release-please-version
|
|
1683
1704
|
|
|
1684
1705
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
1685
1706
|
const isRunningInBrowser = () => {
|
|
@@ -2499,6 +2520,8 @@ const formatRequestDetails = (details) => {
|
|
|
2499
2520
|
details.headers = Object.fromEntries((details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map(([name, value]) => [
|
|
2500
2521
|
name,
|
|
2501
2522
|
(name.toLowerCase() === 'authorization' ||
|
|
2523
|
+
name.toLowerCase() === 'api-key' ||
|
|
2524
|
+
name.toLowerCase() === 'x-api-key' ||
|
|
2502
2525
|
name.toLowerCase() === 'cookie' ||
|
|
2503
2526
|
name.toLowerCase() === 'set-cookie') ?
|
|
2504
2527
|
'***'
|
|
@@ -3059,6 +3082,36 @@ class ConversationCursorPage extends AbstractPage {
|
|
|
3059
3082
|
};
|
|
3060
3083
|
}
|
|
3061
3084
|
}
|
|
3085
|
+
class NextCursorPage extends AbstractPage {
|
|
3086
|
+
constructor(client, response, body, options) {
|
|
3087
|
+
super(client, response, body, options);
|
|
3088
|
+
this.data = body.data || [];
|
|
3089
|
+
this.has_more = body.has_more || false;
|
|
3090
|
+
this.next = body.next || null;
|
|
3091
|
+
}
|
|
3092
|
+
getPaginatedItems() {
|
|
3093
|
+
return this.data ?? [];
|
|
3094
|
+
}
|
|
3095
|
+
hasNextPage() {
|
|
3096
|
+
if (this.has_more === false) {
|
|
3097
|
+
return false;
|
|
3098
|
+
}
|
|
3099
|
+
return super.hasNextPage();
|
|
3100
|
+
}
|
|
3101
|
+
nextPageRequestOptions() {
|
|
3102
|
+
const cursor = this.next;
|
|
3103
|
+
if (!cursor) {
|
|
3104
|
+
return null;
|
|
3105
|
+
}
|
|
3106
|
+
return {
|
|
3107
|
+
...this.options,
|
|
3108
|
+
query: {
|
|
3109
|
+
...maybeObj(this.options.query),
|
|
3110
|
+
after: cursor,
|
|
3111
|
+
},
|
|
3112
|
+
};
|
|
3113
|
+
}
|
|
3114
|
+
}
|
|
3062
3115
|
|
|
3063
3116
|
const SUBJECT_TOKEN_TYPES = {
|
|
3064
3117
|
jwt: 'urn:ietf:params:oauth:token-type:jwt',
|
|
@@ -3461,7 +3514,7 @@ let Messages$1 = class Messages extends APIResource {
|
|
|
3461
3514
|
* ```
|
|
3462
3515
|
*/
|
|
3463
3516
|
list(completionID, query = {}, options) {
|
|
3464
|
-
return this._client.getAPIList(path `/chat/completions/${completionID}/messages`, (CursorPage), { query, ...options });
|
|
3517
|
+
return this._client.getAPIList(path `/chat/completions/${completionID}/messages`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
3465
3518
|
}
|
|
3466
3519
|
};
|
|
3467
3520
|
|
|
@@ -4807,123 +4860,1775 @@ class ChatCompletionStreamingRunner extends ChatCompletionStream {
|
|
|
4807
4860
|
runner._run(() => runner._fromReadableStream(stream));
|
|
4808
4861
|
return runner;
|
|
4809
4862
|
}
|
|
4810
|
-
static runTools(client, params, options) {
|
|
4811
|
-
const runner = new ChatCompletionStreamingRunner(
|
|
4812
|
-
// @ts-expect-error TODO these types are incompatible
|
|
4813
|
-
params);
|
|
4814
|
-
const opts = {
|
|
4863
|
+
static runTools(client, params, options) {
|
|
4864
|
+
const runner = new ChatCompletionStreamingRunner(
|
|
4865
|
+
// @ts-expect-error TODO these types are incompatible
|
|
4866
|
+
params);
|
|
4867
|
+
const opts = {
|
|
4868
|
+
...options,
|
|
4869
|
+
headers: { ...options?.headers, 'X-Stainless-Helper-Method': 'runTools' },
|
|
4870
|
+
};
|
|
4871
|
+
runner._run(() => runner._runTools(client, params, opts));
|
|
4872
|
+
return runner;
|
|
4873
|
+
}
|
|
4874
|
+
}
|
|
4875
|
+
|
|
4876
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4877
|
+
/**
|
|
4878
|
+
* Given a list of messages comprising a conversation, the model will return a response.
|
|
4879
|
+
*/
|
|
4880
|
+
let Completions$1 = class Completions extends APIResource {
|
|
4881
|
+
constructor() {
|
|
4882
|
+
super(...arguments);
|
|
4883
|
+
this.messages = new Messages$1(this._client);
|
|
4884
|
+
}
|
|
4885
|
+
create(body, options) {
|
|
4886
|
+
return this._client.post('/chat/completions', {
|
|
4887
|
+
body,
|
|
4888
|
+
...options,
|
|
4889
|
+
stream: body.stream ?? false,
|
|
4890
|
+
__security: { bearerAuth: true },
|
|
4891
|
+
});
|
|
4892
|
+
}
|
|
4893
|
+
/**
|
|
4894
|
+
* Get a stored chat completion. Only Chat Completions that have been created with
|
|
4895
|
+
* the `store` parameter set to `true` will be returned.
|
|
4896
|
+
*
|
|
4897
|
+
* @example
|
|
4898
|
+
* ```ts
|
|
4899
|
+
* const chatCompletion =
|
|
4900
|
+
* await client.chat.completions.retrieve('completion_id');
|
|
4901
|
+
* ```
|
|
4902
|
+
*/
|
|
4903
|
+
retrieve(completionID, options) {
|
|
4904
|
+
return this._client.get(path `/chat/completions/${completionID}`, {
|
|
4905
|
+
...options,
|
|
4906
|
+
__security: { bearerAuth: true },
|
|
4907
|
+
});
|
|
4908
|
+
}
|
|
4909
|
+
/**
|
|
4910
|
+
* Modify a stored chat completion. Only Chat Completions that have been created
|
|
4911
|
+
* with the `store` parameter set to `true` can be modified. Currently, the only
|
|
4912
|
+
* supported modification is to update the `metadata` field.
|
|
4913
|
+
*
|
|
4914
|
+
* @example
|
|
4915
|
+
* ```ts
|
|
4916
|
+
* const chatCompletion = await client.chat.completions.update(
|
|
4917
|
+
* 'completion_id',
|
|
4918
|
+
* { metadata: { foo: 'string' } },
|
|
4919
|
+
* );
|
|
4920
|
+
* ```
|
|
4921
|
+
*/
|
|
4922
|
+
update(completionID, body, options) {
|
|
4923
|
+
return this._client.post(path `/chat/completions/${completionID}`, {
|
|
4924
|
+
body,
|
|
4925
|
+
...options,
|
|
4926
|
+
__security: { bearerAuth: true },
|
|
4927
|
+
});
|
|
4928
|
+
}
|
|
4929
|
+
/**
|
|
4930
|
+
* List stored Chat Completions. Only Chat Completions that have been stored with
|
|
4931
|
+
* the `store` parameter set to `true` will be returned.
|
|
4932
|
+
*
|
|
4933
|
+
* @example
|
|
4934
|
+
* ```ts
|
|
4935
|
+
* // Automatically fetches more pages as needed.
|
|
4936
|
+
* for await (const chatCompletion of client.chat.completions.list()) {
|
|
4937
|
+
* // ...
|
|
4938
|
+
* }
|
|
4939
|
+
* ```
|
|
4940
|
+
*/
|
|
4941
|
+
list(query = {}, options) {
|
|
4942
|
+
return this._client.getAPIList('/chat/completions', (CursorPage), {
|
|
4943
|
+
query,
|
|
4944
|
+
...options,
|
|
4945
|
+
__security: { bearerAuth: true },
|
|
4946
|
+
});
|
|
4947
|
+
}
|
|
4948
|
+
/**
|
|
4949
|
+
* Delete a stored chat completion. Only Chat Completions that have been created
|
|
4950
|
+
* with the `store` parameter set to `true` can be deleted.
|
|
4951
|
+
*
|
|
4952
|
+
* @example
|
|
4953
|
+
* ```ts
|
|
4954
|
+
* const chatCompletionDeleted =
|
|
4955
|
+
* await client.chat.completions.delete('completion_id');
|
|
4956
|
+
* ```
|
|
4957
|
+
*/
|
|
4958
|
+
delete(completionID, options) {
|
|
4959
|
+
return this._client.delete(path `/chat/completions/${completionID}`, {
|
|
4960
|
+
...options,
|
|
4961
|
+
__security: { bearerAuth: true },
|
|
4962
|
+
});
|
|
4963
|
+
}
|
|
4964
|
+
parse(body, options) {
|
|
4965
|
+
validateInputTools(body.tools);
|
|
4966
|
+
return this._client.chat.completions
|
|
4967
|
+
.create(body, {
|
|
4968
|
+
...options,
|
|
4969
|
+
headers: {
|
|
4970
|
+
...options?.headers,
|
|
4971
|
+
'X-Stainless-Helper-Method': 'chat.completions.parse',
|
|
4972
|
+
},
|
|
4973
|
+
})
|
|
4974
|
+
._thenUnwrap((completion) => parseChatCompletion(completion, body));
|
|
4975
|
+
}
|
|
4976
|
+
runTools(body, options) {
|
|
4977
|
+
if (body.stream) {
|
|
4978
|
+
return ChatCompletionStreamingRunner.runTools(this._client, body, options);
|
|
4979
|
+
}
|
|
4980
|
+
return ChatCompletionRunner.runTools(this._client, body, options);
|
|
4981
|
+
}
|
|
4982
|
+
/**
|
|
4983
|
+
* Creates a chat completion stream
|
|
4984
|
+
*/
|
|
4985
|
+
stream(body, options) {
|
|
4986
|
+
return ChatCompletionStream.createChatCompletion(this._client, body, options);
|
|
4987
|
+
}
|
|
4988
|
+
};
|
|
4989
|
+
Completions$1.Messages = Messages$1;
|
|
4990
|
+
|
|
4991
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4992
|
+
class Chat extends APIResource {
|
|
4993
|
+
constructor() {
|
|
4994
|
+
super(...arguments);
|
|
4995
|
+
this.completions = new Completions$1(this._client);
|
|
4996
|
+
}
|
|
4997
|
+
}
|
|
4998
|
+
Chat.Completions = Completions$1;
|
|
4999
|
+
|
|
5000
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5001
|
+
class AdminAPIKeys extends APIResource {
|
|
5002
|
+
/**
|
|
5003
|
+
* Create an organization admin API key
|
|
5004
|
+
*
|
|
5005
|
+
* @example
|
|
5006
|
+
* ```ts
|
|
5007
|
+
* const adminAPIKey =
|
|
5008
|
+
* await client.admin.organization.adminAPIKeys.create({
|
|
5009
|
+
* name: 'New Admin Key',
|
|
5010
|
+
* });
|
|
5011
|
+
* ```
|
|
5012
|
+
*/
|
|
5013
|
+
create(body, options) {
|
|
5014
|
+
return this._client.post('/organization/admin_api_keys', {
|
|
5015
|
+
body,
|
|
5016
|
+
...options,
|
|
5017
|
+
__security: { adminAPIKeyAuth: true },
|
|
5018
|
+
});
|
|
5019
|
+
}
|
|
5020
|
+
/**
|
|
5021
|
+
* Retrieve a single organization API key
|
|
5022
|
+
*
|
|
5023
|
+
* @example
|
|
5024
|
+
* ```ts
|
|
5025
|
+
* const adminAPIKey =
|
|
5026
|
+
* await client.admin.organization.adminAPIKeys.retrieve(
|
|
5027
|
+
* 'key_id',
|
|
5028
|
+
* );
|
|
5029
|
+
* ```
|
|
5030
|
+
*/
|
|
5031
|
+
retrieve(keyID, options) {
|
|
5032
|
+
return this._client.get(path `/organization/admin_api_keys/${keyID}`, {
|
|
5033
|
+
...options,
|
|
5034
|
+
__security: { adminAPIKeyAuth: true },
|
|
5035
|
+
});
|
|
5036
|
+
}
|
|
5037
|
+
/**
|
|
5038
|
+
* List organization API keys
|
|
5039
|
+
*
|
|
5040
|
+
* @example
|
|
5041
|
+
* ```ts
|
|
5042
|
+
* // Automatically fetches more pages as needed.
|
|
5043
|
+
* for await (const adminAPIKey of client.admin.organization.adminAPIKeys.list()) {
|
|
5044
|
+
* // ...
|
|
5045
|
+
* }
|
|
5046
|
+
* ```
|
|
5047
|
+
*/
|
|
5048
|
+
list(query = {}, options) {
|
|
5049
|
+
return this._client.getAPIList('/organization/admin_api_keys', (CursorPage), {
|
|
5050
|
+
query,
|
|
5051
|
+
...options,
|
|
5052
|
+
__security: { adminAPIKeyAuth: true },
|
|
5053
|
+
});
|
|
5054
|
+
}
|
|
5055
|
+
/**
|
|
5056
|
+
* Delete an organization admin API key
|
|
5057
|
+
*
|
|
5058
|
+
* @example
|
|
5059
|
+
* ```ts
|
|
5060
|
+
* const adminAPIKey =
|
|
5061
|
+
* await client.admin.organization.adminAPIKeys.delete(
|
|
5062
|
+
* 'key_id',
|
|
5063
|
+
* );
|
|
5064
|
+
* ```
|
|
5065
|
+
*/
|
|
5066
|
+
delete(keyID, options) {
|
|
5067
|
+
return this._client.delete(path `/organization/admin_api_keys/${keyID}`, {
|
|
5068
|
+
...options,
|
|
5069
|
+
__security: { adminAPIKeyAuth: true },
|
|
5070
|
+
});
|
|
5071
|
+
}
|
|
5072
|
+
}
|
|
5073
|
+
|
|
5074
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5075
|
+
/**
|
|
5076
|
+
* List user actions and configuration changes within this organization.
|
|
5077
|
+
*/
|
|
5078
|
+
class AuditLogs extends APIResource {
|
|
5079
|
+
/**
|
|
5080
|
+
* List user actions and configuration changes within this organization.
|
|
5081
|
+
*
|
|
5082
|
+
* @example
|
|
5083
|
+
* ```ts
|
|
5084
|
+
* // Automatically fetches more pages as needed.
|
|
5085
|
+
* for await (const auditLogListResponse of client.admin.organization.auditLogs.list()) {
|
|
5086
|
+
* // ...
|
|
5087
|
+
* }
|
|
5088
|
+
* ```
|
|
5089
|
+
*/
|
|
5090
|
+
list(query = {}, options) {
|
|
5091
|
+
return this._client.getAPIList('/organization/audit_logs', (ConversationCursorPage), {
|
|
5092
|
+
query,
|
|
5093
|
+
...options,
|
|
5094
|
+
__security: { adminAPIKeyAuth: true },
|
|
5095
|
+
});
|
|
5096
|
+
}
|
|
5097
|
+
}
|
|
5098
|
+
|
|
5099
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5100
|
+
let Certificates$1 = class Certificates extends APIResource {
|
|
5101
|
+
/**
|
|
5102
|
+
* Upload a certificate to the organization. This does **not** automatically
|
|
5103
|
+
* activate the certificate.
|
|
5104
|
+
*
|
|
5105
|
+
* Organizations can upload up to 50 certificates.
|
|
5106
|
+
*
|
|
5107
|
+
* @example
|
|
5108
|
+
* ```ts
|
|
5109
|
+
* const certificate =
|
|
5110
|
+
* await client.admin.organization.certificates.create({
|
|
5111
|
+
* certificate: 'certificate',
|
|
5112
|
+
* });
|
|
5113
|
+
* ```
|
|
5114
|
+
*/
|
|
5115
|
+
create(body, options) {
|
|
5116
|
+
return this._client.post('/organization/certificates', {
|
|
5117
|
+
body,
|
|
5118
|
+
...options,
|
|
5119
|
+
__security: { adminAPIKeyAuth: true },
|
|
5120
|
+
});
|
|
5121
|
+
}
|
|
5122
|
+
/**
|
|
5123
|
+
* Get a certificate that has been uploaded to the organization.
|
|
5124
|
+
*
|
|
5125
|
+
* You can get a certificate regardless of whether it is active or not.
|
|
5126
|
+
*
|
|
5127
|
+
* @example
|
|
5128
|
+
* ```ts
|
|
5129
|
+
* const certificate =
|
|
5130
|
+
* await client.admin.organization.certificates.retrieve(
|
|
5131
|
+
* 'certificate_id',
|
|
5132
|
+
* );
|
|
5133
|
+
* ```
|
|
5134
|
+
*/
|
|
5135
|
+
retrieve(certificateID, query = {}, options) {
|
|
5136
|
+
return this._client.get(path `/organization/certificates/${certificateID}`, {
|
|
5137
|
+
query,
|
|
5138
|
+
...options,
|
|
5139
|
+
__security: { adminAPIKeyAuth: true },
|
|
5140
|
+
});
|
|
5141
|
+
}
|
|
5142
|
+
/**
|
|
5143
|
+
* Modify a certificate. Note that only the name can be modified.
|
|
5144
|
+
*
|
|
5145
|
+
* @example
|
|
5146
|
+
* ```ts
|
|
5147
|
+
* const certificate =
|
|
5148
|
+
* await client.admin.organization.certificates.update(
|
|
5149
|
+
* 'certificate_id',
|
|
5150
|
+
* );
|
|
5151
|
+
* ```
|
|
5152
|
+
*/
|
|
5153
|
+
update(certificateID, body, options) {
|
|
5154
|
+
return this._client.post(path `/organization/certificates/${certificateID}`, {
|
|
5155
|
+
body,
|
|
5156
|
+
...options,
|
|
5157
|
+
__security: { adminAPIKeyAuth: true },
|
|
5158
|
+
});
|
|
5159
|
+
}
|
|
5160
|
+
/**
|
|
5161
|
+
* List uploaded certificates for this organization.
|
|
5162
|
+
*
|
|
5163
|
+
* @example
|
|
5164
|
+
* ```ts
|
|
5165
|
+
* // Automatically fetches more pages as needed.
|
|
5166
|
+
* for await (const certificateListResponse of client.admin.organization.certificates.list()) {
|
|
5167
|
+
* // ...
|
|
5168
|
+
* }
|
|
5169
|
+
* ```
|
|
5170
|
+
*/
|
|
5171
|
+
list(query = {}, options) {
|
|
5172
|
+
return this._client.getAPIList('/organization/certificates', (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5173
|
+
}
|
|
5174
|
+
/**
|
|
5175
|
+
* Delete a certificate from the organization.
|
|
5176
|
+
*
|
|
5177
|
+
* The certificate must be inactive for the organization and all projects.
|
|
5178
|
+
*
|
|
5179
|
+
* @example
|
|
5180
|
+
* ```ts
|
|
5181
|
+
* const certificate =
|
|
5182
|
+
* await client.admin.organization.certificates.delete(
|
|
5183
|
+
* 'certificate_id',
|
|
5184
|
+
* );
|
|
5185
|
+
* ```
|
|
5186
|
+
*/
|
|
5187
|
+
delete(certificateID, options) {
|
|
5188
|
+
return this._client.delete(path `/organization/certificates/${certificateID}`, {
|
|
5189
|
+
...options,
|
|
5190
|
+
__security: { adminAPIKeyAuth: true },
|
|
5191
|
+
});
|
|
5192
|
+
}
|
|
5193
|
+
/**
|
|
5194
|
+
* Activate certificates at the organization level.
|
|
5195
|
+
*
|
|
5196
|
+
* You can atomically and idempotently activate up to 10 certificates at a time.
|
|
5197
|
+
*
|
|
5198
|
+
* @example
|
|
5199
|
+
* ```ts
|
|
5200
|
+
* // Automatically fetches more pages as needed.
|
|
5201
|
+
* for await (const certificateActivateResponse of client.admin.organization.certificates.activate(
|
|
5202
|
+
* { certificate_ids: ['cert_abc'] },
|
|
5203
|
+
* )) {
|
|
5204
|
+
* // ...
|
|
5205
|
+
* }
|
|
5206
|
+
* ```
|
|
5207
|
+
*/
|
|
5208
|
+
activate(body, options) {
|
|
5209
|
+
return this._client.getAPIList('/organization/certificates/activate', (Page), {
|
|
5210
|
+
body,
|
|
5211
|
+
method: 'post',
|
|
5212
|
+
...options,
|
|
5213
|
+
__security: { adminAPIKeyAuth: true },
|
|
5214
|
+
});
|
|
5215
|
+
}
|
|
5216
|
+
/**
|
|
5217
|
+
* Deactivate certificates at the organization level.
|
|
5218
|
+
*
|
|
5219
|
+
* You can atomically and idempotently deactivate up to 10 certificates at a time.
|
|
5220
|
+
*
|
|
5221
|
+
* @example
|
|
5222
|
+
* ```ts
|
|
5223
|
+
* // Automatically fetches more pages as needed.
|
|
5224
|
+
* for await (const certificateDeactivateResponse of client.admin.organization.certificates.deactivate(
|
|
5225
|
+
* { certificate_ids: ['cert_abc'] },
|
|
5226
|
+
* )) {
|
|
5227
|
+
* // ...
|
|
5228
|
+
* }
|
|
5229
|
+
* ```
|
|
5230
|
+
*/
|
|
5231
|
+
deactivate(body, options) {
|
|
5232
|
+
return this._client.getAPIList('/organization/certificates/deactivate', (Page), { body, method: 'post', ...options, __security: { adminAPIKeyAuth: true } });
|
|
5233
|
+
}
|
|
5234
|
+
};
|
|
5235
|
+
|
|
5236
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5237
|
+
class Invites extends APIResource {
|
|
5238
|
+
/**
|
|
5239
|
+
* Create an invite for a user to the organization. The invite must be accepted by
|
|
5240
|
+
* the user before they have access to the organization.
|
|
5241
|
+
*
|
|
5242
|
+
* @example
|
|
5243
|
+
* ```ts
|
|
5244
|
+
* const invite =
|
|
5245
|
+
* await client.admin.organization.invites.create({
|
|
5246
|
+
* email: 'email',
|
|
5247
|
+
* role: 'reader',
|
|
5248
|
+
* });
|
|
5249
|
+
* ```
|
|
5250
|
+
*/
|
|
5251
|
+
create(body, options) {
|
|
5252
|
+
return this._client.post('/organization/invites', {
|
|
5253
|
+
body,
|
|
5254
|
+
...options,
|
|
5255
|
+
__security: { adminAPIKeyAuth: true },
|
|
5256
|
+
});
|
|
5257
|
+
}
|
|
5258
|
+
/**
|
|
5259
|
+
* Retrieves an invite.
|
|
5260
|
+
*
|
|
5261
|
+
* @example
|
|
5262
|
+
* ```ts
|
|
5263
|
+
* const invite =
|
|
5264
|
+
* await client.admin.organization.invites.retrieve(
|
|
5265
|
+
* 'invite_id',
|
|
5266
|
+
* );
|
|
5267
|
+
* ```
|
|
5268
|
+
*/
|
|
5269
|
+
retrieve(inviteID, options) {
|
|
5270
|
+
return this._client.get(path `/organization/invites/${inviteID}`, {
|
|
5271
|
+
...options,
|
|
5272
|
+
__security: { adminAPIKeyAuth: true },
|
|
5273
|
+
});
|
|
5274
|
+
}
|
|
5275
|
+
/**
|
|
5276
|
+
* Returns a list of invites in the organization.
|
|
5277
|
+
*
|
|
5278
|
+
* @example
|
|
5279
|
+
* ```ts
|
|
5280
|
+
* // Automatically fetches more pages as needed.
|
|
5281
|
+
* for await (const invite of client.admin.organization.invites.list()) {
|
|
5282
|
+
* // ...
|
|
5283
|
+
* }
|
|
5284
|
+
* ```
|
|
5285
|
+
*/
|
|
5286
|
+
list(query = {}, options) {
|
|
5287
|
+
return this._client.getAPIList('/organization/invites', (ConversationCursorPage), {
|
|
5288
|
+
query,
|
|
5289
|
+
...options,
|
|
5290
|
+
__security: { adminAPIKeyAuth: true },
|
|
5291
|
+
});
|
|
5292
|
+
}
|
|
5293
|
+
/**
|
|
5294
|
+
* Delete an invite. If the invite has already been accepted, it cannot be deleted.
|
|
5295
|
+
*
|
|
5296
|
+
* @example
|
|
5297
|
+
* ```ts
|
|
5298
|
+
* const invite =
|
|
5299
|
+
* await client.admin.organization.invites.delete(
|
|
5300
|
+
* 'invite_id',
|
|
5301
|
+
* );
|
|
5302
|
+
* ```
|
|
5303
|
+
*/
|
|
5304
|
+
delete(inviteID, options) {
|
|
5305
|
+
return this._client.delete(path `/organization/invites/${inviteID}`, {
|
|
5306
|
+
...options,
|
|
5307
|
+
__security: { adminAPIKeyAuth: true },
|
|
5308
|
+
});
|
|
5309
|
+
}
|
|
5310
|
+
}
|
|
5311
|
+
|
|
5312
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5313
|
+
let Roles$5 = class Roles extends APIResource {
|
|
5314
|
+
/**
|
|
5315
|
+
* Creates a custom role for the organization.
|
|
5316
|
+
*
|
|
5317
|
+
* @example
|
|
5318
|
+
* ```ts
|
|
5319
|
+
* const role = await client.admin.organization.roles.create({
|
|
5320
|
+
* permissions: ['string'],
|
|
5321
|
+
* role_name: 'role_name',
|
|
5322
|
+
* });
|
|
5323
|
+
* ```
|
|
5324
|
+
*/
|
|
5325
|
+
create(body, options) {
|
|
5326
|
+
return this._client.post('/organization/roles', {
|
|
5327
|
+
body,
|
|
5328
|
+
...options,
|
|
5329
|
+
__security: { adminAPIKeyAuth: true },
|
|
5330
|
+
});
|
|
5331
|
+
}
|
|
5332
|
+
/**
|
|
5333
|
+
* Updates an existing organization role.
|
|
5334
|
+
*
|
|
5335
|
+
* @example
|
|
5336
|
+
* ```ts
|
|
5337
|
+
* const role = await client.admin.organization.roles.update(
|
|
5338
|
+
* 'role_id',
|
|
5339
|
+
* );
|
|
5340
|
+
* ```
|
|
5341
|
+
*/
|
|
5342
|
+
update(roleID, body, options) {
|
|
5343
|
+
return this._client.post(path `/organization/roles/${roleID}`, {
|
|
5344
|
+
body,
|
|
5345
|
+
...options,
|
|
5346
|
+
__security: { adminAPIKeyAuth: true },
|
|
5347
|
+
});
|
|
5348
|
+
}
|
|
5349
|
+
/**
|
|
5350
|
+
* Lists the roles configured for the organization.
|
|
5351
|
+
*
|
|
5352
|
+
* @example
|
|
5353
|
+
* ```ts
|
|
5354
|
+
* // Automatically fetches more pages as needed.
|
|
5355
|
+
* for await (const role of client.admin.organization.roles.list()) {
|
|
5356
|
+
* // ...
|
|
5357
|
+
* }
|
|
5358
|
+
* ```
|
|
5359
|
+
*/
|
|
5360
|
+
list(query = {}, options) {
|
|
5361
|
+
return this._client.getAPIList('/organization/roles', (NextCursorPage), {
|
|
5362
|
+
query,
|
|
5363
|
+
...options,
|
|
5364
|
+
__security: { adminAPIKeyAuth: true },
|
|
5365
|
+
});
|
|
5366
|
+
}
|
|
5367
|
+
/**
|
|
5368
|
+
* Deletes a custom role from the organization.
|
|
5369
|
+
*
|
|
5370
|
+
* @example
|
|
5371
|
+
* ```ts
|
|
5372
|
+
* const role = await client.admin.organization.roles.delete(
|
|
5373
|
+
* 'role_id',
|
|
5374
|
+
* );
|
|
5375
|
+
* ```
|
|
5376
|
+
*/
|
|
5377
|
+
delete(roleID, options) {
|
|
5378
|
+
return this._client.delete(path `/organization/roles/${roleID}`, {
|
|
5379
|
+
...options,
|
|
5380
|
+
__security: { adminAPIKeyAuth: true },
|
|
5381
|
+
});
|
|
5382
|
+
}
|
|
5383
|
+
};
|
|
5384
|
+
|
|
5385
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5386
|
+
class Usage extends APIResource {
|
|
5387
|
+
/**
|
|
5388
|
+
* Get audio speeches usage details for the organization.
|
|
5389
|
+
*
|
|
5390
|
+
* @example
|
|
5391
|
+
* ```ts
|
|
5392
|
+
* const response =
|
|
5393
|
+
* await client.admin.organization.usage.audioSpeeches({
|
|
5394
|
+
* start_time: 0,
|
|
5395
|
+
* });
|
|
5396
|
+
* ```
|
|
5397
|
+
*/
|
|
5398
|
+
audioSpeeches(query, options) {
|
|
5399
|
+
return this._client.get('/organization/usage/audio_speeches', {
|
|
5400
|
+
query,
|
|
5401
|
+
...options,
|
|
5402
|
+
__security: { adminAPIKeyAuth: true },
|
|
5403
|
+
});
|
|
5404
|
+
}
|
|
5405
|
+
/**
|
|
5406
|
+
* Get audio transcriptions usage details for the organization.
|
|
5407
|
+
*
|
|
5408
|
+
* @example
|
|
5409
|
+
* ```ts
|
|
5410
|
+
* const response =
|
|
5411
|
+
* await client.admin.organization.usage.audioTranscriptions(
|
|
5412
|
+
* { start_time: 0 },
|
|
5413
|
+
* );
|
|
5414
|
+
* ```
|
|
5415
|
+
*/
|
|
5416
|
+
audioTranscriptions(query, options) {
|
|
5417
|
+
return this._client.get('/organization/usage/audio_transcriptions', {
|
|
5418
|
+
query,
|
|
5419
|
+
...options,
|
|
5420
|
+
__security: { adminAPIKeyAuth: true },
|
|
5421
|
+
});
|
|
5422
|
+
}
|
|
5423
|
+
/**
|
|
5424
|
+
* Get code interpreter sessions usage details for the organization.
|
|
5425
|
+
*
|
|
5426
|
+
* @example
|
|
5427
|
+
* ```ts
|
|
5428
|
+
* const response =
|
|
5429
|
+
* await client.admin.organization.usage.codeInterpreterSessions(
|
|
5430
|
+
* { start_time: 0 },
|
|
5431
|
+
* );
|
|
5432
|
+
* ```
|
|
5433
|
+
*/
|
|
5434
|
+
codeInterpreterSessions(query, options) {
|
|
5435
|
+
return this._client.get('/organization/usage/code_interpreter_sessions', {
|
|
5436
|
+
query,
|
|
5437
|
+
...options,
|
|
5438
|
+
__security: { adminAPIKeyAuth: true },
|
|
5439
|
+
});
|
|
5440
|
+
}
|
|
5441
|
+
/**
|
|
5442
|
+
* Get completions usage details for the organization.
|
|
5443
|
+
*
|
|
5444
|
+
* @example
|
|
5445
|
+
* ```ts
|
|
5446
|
+
* const response =
|
|
5447
|
+
* await client.admin.organization.usage.completions({
|
|
5448
|
+
* start_time: 0,
|
|
5449
|
+
* });
|
|
5450
|
+
* ```
|
|
5451
|
+
*/
|
|
5452
|
+
completions(query, options) {
|
|
5453
|
+
return this._client.get('/organization/usage/completions', {
|
|
5454
|
+
query,
|
|
5455
|
+
...options,
|
|
5456
|
+
__security: { adminAPIKeyAuth: true },
|
|
5457
|
+
});
|
|
5458
|
+
}
|
|
5459
|
+
/**
|
|
5460
|
+
* Get costs details for the organization.
|
|
5461
|
+
*
|
|
5462
|
+
* @example
|
|
5463
|
+
* ```ts
|
|
5464
|
+
* const response =
|
|
5465
|
+
* await client.admin.organization.usage.costs({
|
|
5466
|
+
* start_time: 0,
|
|
5467
|
+
* });
|
|
5468
|
+
* ```
|
|
5469
|
+
*/
|
|
5470
|
+
costs(query, options) {
|
|
5471
|
+
return this._client.get('/organization/costs', {
|
|
5472
|
+
query,
|
|
5473
|
+
...options,
|
|
5474
|
+
__security: { adminAPIKeyAuth: true },
|
|
5475
|
+
});
|
|
5476
|
+
}
|
|
5477
|
+
/**
|
|
5478
|
+
* Get embeddings usage details for the organization.
|
|
5479
|
+
*
|
|
5480
|
+
* @example
|
|
5481
|
+
* ```ts
|
|
5482
|
+
* const response =
|
|
5483
|
+
* await client.admin.organization.usage.embeddings({
|
|
5484
|
+
* start_time: 0,
|
|
5485
|
+
* });
|
|
5486
|
+
* ```
|
|
5487
|
+
*/
|
|
5488
|
+
embeddings(query, options) {
|
|
5489
|
+
return this._client.get('/organization/usage/embeddings', {
|
|
5490
|
+
query,
|
|
5491
|
+
...options,
|
|
5492
|
+
__security: { adminAPIKeyAuth: true },
|
|
5493
|
+
});
|
|
5494
|
+
}
|
|
5495
|
+
/**
|
|
5496
|
+
* Get images usage details for the organization.
|
|
5497
|
+
*
|
|
5498
|
+
* @example
|
|
5499
|
+
* ```ts
|
|
5500
|
+
* const response =
|
|
5501
|
+
* await client.admin.organization.usage.images({
|
|
5502
|
+
* start_time: 0,
|
|
5503
|
+
* });
|
|
5504
|
+
* ```
|
|
5505
|
+
*/
|
|
5506
|
+
images(query, options) {
|
|
5507
|
+
return this._client.get('/organization/usage/images', {
|
|
5508
|
+
query,
|
|
5509
|
+
...options,
|
|
5510
|
+
__security: { adminAPIKeyAuth: true },
|
|
5511
|
+
});
|
|
5512
|
+
}
|
|
5513
|
+
/**
|
|
5514
|
+
* Get moderations usage details for the organization.
|
|
5515
|
+
*
|
|
5516
|
+
* @example
|
|
5517
|
+
* ```ts
|
|
5518
|
+
* const response =
|
|
5519
|
+
* await client.admin.organization.usage.moderations({
|
|
5520
|
+
* start_time: 0,
|
|
5521
|
+
* });
|
|
5522
|
+
* ```
|
|
5523
|
+
*/
|
|
5524
|
+
moderations(query, options) {
|
|
5525
|
+
return this._client.get('/organization/usage/moderations', {
|
|
5526
|
+
query,
|
|
5527
|
+
...options,
|
|
5528
|
+
__security: { adminAPIKeyAuth: true },
|
|
5529
|
+
});
|
|
5530
|
+
}
|
|
5531
|
+
/**
|
|
5532
|
+
* Get vector stores usage details for the organization.
|
|
5533
|
+
*
|
|
5534
|
+
* @example
|
|
5535
|
+
* ```ts
|
|
5536
|
+
* const response =
|
|
5537
|
+
* await client.admin.organization.usage.vectorStores({
|
|
5538
|
+
* start_time: 0,
|
|
5539
|
+
* });
|
|
5540
|
+
* ```
|
|
5541
|
+
*/
|
|
5542
|
+
vectorStores(query, options) {
|
|
5543
|
+
return this._client.get('/organization/usage/vector_stores', {
|
|
5544
|
+
query,
|
|
5545
|
+
...options,
|
|
5546
|
+
__security: { adminAPIKeyAuth: true },
|
|
5547
|
+
});
|
|
5548
|
+
}
|
|
5549
|
+
}
|
|
5550
|
+
|
|
5551
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5552
|
+
let Roles$4 = class Roles extends APIResource {
|
|
5553
|
+
/**
|
|
5554
|
+
* Assigns an organization role to a group within the organization.
|
|
5555
|
+
*
|
|
5556
|
+
* @example
|
|
5557
|
+
* ```ts
|
|
5558
|
+
* const role =
|
|
5559
|
+
* await client.admin.organization.groups.roles.create(
|
|
5560
|
+
* 'group_id',
|
|
5561
|
+
* { role_id: 'role_id' },
|
|
5562
|
+
* );
|
|
5563
|
+
* ```
|
|
5564
|
+
*/
|
|
5565
|
+
create(groupID, body, options) {
|
|
5566
|
+
return this._client.post(path `/organization/groups/${groupID}/roles`, {
|
|
5567
|
+
body,
|
|
5568
|
+
...options,
|
|
5569
|
+
__security: { adminAPIKeyAuth: true },
|
|
5570
|
+
});
|
|
5571
|
+
}
|
|
5572
|
+
/**
|
|
5573
|
+
* Lists the organization roles assigned to a group within the organization.
|
|
5574
|
+
*
|
|
5575
|
+
* @example
|
|
5576
|
+
* ```ts
|
|
5577
|
+
* // Automatically fetches more pages as needed.
|
|
5578
|
+
* for await (const roleListResponse of client.admin.organization.groups.roles.list(
|
|
5579
|
+
* 'group_id',
|
|
5580
|
+
* )) {
|
|
5581
|
+
* // ...
|
|
5582
|
+
* }
|
|
5583
|
+
* ```
|
|
5584
|
+
*/
|
|
5585
|
+
list(groupID, query = {}, options) {
|
|
5586
|
+
return this._client.getAPIList(path `/organization/groups/${groupID}/roles`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5587
|
+
}
|
|
5588
|
+
/**
|
|
5589
|
+
* Unassigns an organization role from a group within the organization.
|
|
5590
|
+
*
|
|
5591
|
+
* @example
|
|
5592
|
+
* ```ts
|
|
5593
|
+
* const role =
|
|
5594
|
+
* await client.admin.organization.groups.roles.delete(
|
|
5595
|
+
* 'role_id',
|
|
5596
|
+
* { group_id: 'group_id' },
|
|
5597
|
+
* );
|
|
5598
|
+
* ```
|
|
5599
|
+
*/
|
|
5600
|
+
delete(roleID, params, options) {
|
|
5601
|
+
const { group_id } = params;
|
|
5602
|
+
return this._client.delete(path `/organization/groups/${group_id}/roles/${roleID}`, {
|
|
5603
|
+
...options,
|
|
5604
|
+
__security: { adminAPIKeyAuth: true },
|
|
5605
|
+
});
|
|
5606
|
+
}
|
|
5607
|
+
};
|
|
5608
|
+
|
|
5609
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5610
|
+
let Users$2 = class Users extends APIResource {
|
|
5611
|
+
/**
|
|
5612
|
+
* Adds a user to a group.
|
|
5613
|
+
*
|
|
5614
|
+
* @example
|
|
5615
|
+
* ```ts
|
|
5616
|
+
* const user =
|
|
5617
|
+
* await client.admin.organization.groups.users.create(
|
|
5618
|
+
* 'group_id',
|
|
5619
|
+
* { user_id: 'user_id' },
|
|
5620
|
+
* );
|
|
5621
|
+
* ```
|
|
5622
|
+
*/
|
|
5623
|
+
create(groupID, body, options) {
|
|
5624
|
+
return this._client.post(path `/organization/groups/${groupID}/users`, {
|
|
5625
|
+
body,
|
|
5626
|
+
...options,
|
|
5627
|
+
__security: { adminAPIKeyAuth: true },
|
|
5628
|
+
});
|
|
5629
|
+
}
|
|
5630
|
+
/**
|
|
5631
|
+
* Lists the users assigned to a group.
|
|
5632
|
+
*
|
|
5633
|
+
* @example
|
|
5634
|
+
* ```ts
|
|
5635
|
+
* // Automatically fetches more pages as needed.
|
|
5636
|
+
* for await (const organizationGroupUser of client.admin.organization.groups.users.list(
|
|
5637
|
+
* 'group_id',
|
|
5638
|
+
* )) {
|
|
5639
|
+
* // ...
|
|
5640
|
+
* }
|
|
5641
|
+
* ```
|
|
5642
|
+
*/
|
|
5643
|
+
list(groupID, query = {}, options) {
|
|
5644
|
+
return this._client.getAPIList(path `/organization/groups/${groupID}/users`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5645
|
+
}
|
|
5646
|
+
/**
|
|
5647
|
+
* Removes a user from a group.
|
|
5648
|
+
*
|
|
5649
|
+
* @example
|
|
5650
|
+
* ```ts
|
|
5651
|
+
* const user =
|
|
5652
|
+
* await client.admin.organization.groups.users.delete(
|
|
5653
|
+
* 'user_id',
|
|
5654
|
+
* { group_id: 'group_id' },
|
|
5655
|
+
* );
|
|
5656
|
+
* ```
|
|
5657
|
+
*/
|
|
5658
|
+
delete(userID, params, options) {
|
|
5659
|
+
const { group_id } = params;
|
|
5660
|
+
return this._client.delete(path `/organization/groups/${group_id}/users/${userID}`, {
|
|
5661
|
+
...options,
|
|
5662
|
+
__security: { adminAPIKeyAuth: true },
|
|
5663
|
+
});
|
|
5664
|
+
}
|
|
5665
|
+
};
|
|
5666
|
+
|
|
5667
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5668
|
+
let Groups$1 = class Groups extends APIResource {
|
|
5669
|
+
constructor() {
|
|
5670
|
+
super(...arguments);
|
|
5671
|
+
this.users = new Users$2(this._client);
|
|
5672
|
+
this.roles = new Roles$4(this._client);
|
|
5673
|
+
}
|
|
5674
|
+
/**
|
|
5675
|
+
* Creates a new group in the organization.
|
|
5676
|
+
*
|
|
5677
|
+
* @example
|
|
5678
|
+
* ```ts
|
|
5679
|
+
* const group = await client.admin.organization.groups.create(
|
|
5680
|
+
* { name: 'x' },
|
|
5681
|
+
* );
|
|
5682
|
+
* ```
|
|
5683
|
+
*/
|
|
5684
|
+
create(body, options) {
|
|
5685
|
+
return this._client.post('/organization/groups', {
|
|
5686
|
+
body,
|
|
5687
|
+
...options,
|
|
5688
|
+
__security: { adminAPIKeyAuth: true },
|
|
5689
|
+
});
|
|
5690
|
+
}
|
|
5691
|
+
/**
|
|
5692
|
+
* Updates a group's information.
|
|
5693
|
+
*
|
|
5694
|
+
* @example
|
|
5695
|
+
* ```ts
|
|
5696
|
+
* const group = await client.admin.organization.groups.update(
|
|
5697
|
+
* 'group_id',
|
|
5698
|
+
* { name: 'x' },
|
|
5699
|
+
* );
|
|
5700
|
+
* ```
|
|
5701
|
+
*/
|
|
5702
|
+
update(groupID, body, options) {
|
|
5703
|
+
return this._client.post(path `/organization/groups/${groupID}`, {
|
|
5704
|
+
body,
|
|
5705
|
+
...options,
|
|
5706
|
+
__security: { adminAPIKeyAuth: true },
|
|
5707
|
+
});
|
|
5708
|
+
}
|
|
5709
|
+
/**
|
|
5710
|
+
* Lists all groups in the organization.
|
|
5711
|
+
*
|
|
5712
|
+
* @example
|
|
5713
|
+
* ```ts
|
|
5714
|
+
* // Automatically fetches more pages as needed.
|
|
5715
|
+
* for await (const group of client.admin.organization.groups.list()) {
|
|
5716
|
+
* // ...
|
|
5717
|
+
* }
|
|
5718
|
+
* ```
|
|
5719
|
+
*/
|
|
5720
|
+
list(query = {}, options) {
|
|
5721
|
+
return this._client.getAPIList('/organization/groups', (NextCursorPage), {
|
|
5722
|
+
query,
|
|
5723
|
+
...options,
|
|
5724
|
+
__security: { adminAPIKeyAuth: true },
|
|
5725
|
+
});
|
|
5726
|
+
}
|
|
5727
|
+
/**
|
|
5728
|
+
* Deletes a group from the organization.
|
|
5729
|
+
*
|
|
5730
|
+
* @example
|
|
5731
|
+
* ```ts
|
|
5732
|
+
* const group = await client.admin.organization.groups.delete(
|
|
5733
|
+
* 'group_id',
|
|
5734
|
+
* );
|
|
5735
|
+
* ```
|
|
5736
|
+
*/
|
|
5737
|
+
delete(groupID, options) {
|
|
5738
|
+
return this._client.delete(path `/organization/groups/${groupID}`, {
|
|
5739
|
+
...options,
|
|
5740
|
+
__security: { adminAPIKeyAuth: true },
|
|
5741
|
+
});
|
|
5742
|
+
}
|
|
5743
|
+
};
|
|
5744
|
+
Groups$1.Users = Users$2;
|
|
5745
|
+
Groups$1.Roles = Roles$4;
|
|
5746
|
+
|
|
5747
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5748
|
+
class APIKeys extends APIResource {
|
|
5749
|
+
/**
|
|
5750
|
+
* Retrieves an API key in the project.
|
|
5751
|
+
*
|
|
5752
|
+
* @example
|
|
5753
|
+
* ```ts
|
|
5754
|
+
* const projectAPIKey =
|
|
5755
|
+
* await client.admin.organization.projects.apiKeys.retrieve(
|
|
5756
|
+
* 'api_key_id',
|
|
5757
|
+
* { project_id: 'project_id' },
|
|
5758
|
+
* );
|
|
5759
|
+
* ```
|
|
5760
|
+
*/
|
|
5761
|
+
retrieve(apiKeyID, params, options) {
|
|
5762
|
+
const { project_id } = params;
|
|
5763
|
+
return this._client.get(path `/organization/projects/${project_id}/api_keys/${apiKeyID}`, {
|
|
5764
|
+
...options,
|
|
5765
|
+
__security: { adminAPIKeyAuth: true },
|
|
5766
|
+
});
|
|
5767
|
+
}
|
|
5768
|
+
/**
|
|
5769
|
+
* Returns a list of API keys in the project.
|
|
5770
|
+
*
|
|
5771
|
+
* @example
|
|
5772
|
+
* ```ts
|
|
5773
|
+
* // Automatically fetches more pages as needed.
|
|
5774
|
+
* for await (const projectAPIKey of client.admin.organization.projects.apiKeys.list(
|
|
5775
|
+
* 'project_id',
|
|
5776
|
+
* )) {
|
|
5777
|
+
* // ...
|
|
5778
|
+
* }
|
|
5779
|
+
* ```
|
|
5780
|
+
*/
|
|
5781
|
+
list(projectID, query = {}, options) {
|
|
5782
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/api_keys`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5783
|
+
}
|
|
5784
|
+
/**
|
|
5785
|
+
* Deletes an API key from the project.
|
|
5786
|
+
*
|
|
5787
|
+
* Returns confirmation of the key deletion, or an error if the key belonged to a
|
|
5788
|
+
* service account.
|
|
5789
|
+
*
|
|
5790
|
+
* @example
|
|
5791
|
+
* ```ts
|
|
5792
|
+
* const apiKey =
|
|
5793
|
+
* await client.admin.organization.projects.apiKeys.delete(
|
|
5794
|
+
* 'api_key_id',
|
|
5795
|
+
* { project_id: 'project_id' },
|
|
5796
|
+
* );
|
|
5797
|
+
* ```
|
|
5798
|
+
*/
|
|
5799
|
+
delete(apiKeyID, params, options) {
|
|
5800
|
+
const { project_id } = params;
|
|
5801
|
+
return this._client.delete(path `/organization/projects/${project_id}/api_keys/${apiKeyID}`, {
|
|
5802
|
+
...options,
|
|
5803
|
+
__security: { adminAPIKeyAuth: true },
|
|
5804
|
+
});
|
|
5805
|
+
}
|
|
5806
|
+
}
|
|
5807
|
+
|
|
5808
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5809
|
+
class Certificates extends APIResource {
|
|
5810
|
+
/**
|
|
5811
|
+
* List certificates for this project.
|
|
5812
|
+
*
|
|
5813
|
+
* @example
|
|
5814
|
+
* ```ts
|
|
5815
|
+
* // Automatically fetches more pages as needed.
|
|
5816
|
+
* for await (const certificateListResponse of client.admin.organization.projects.certificates.list(
|
|
5817
|
+
* 'project_id',
|
|
5818
|
+
* )) {
|
|
5819
|
+
* // ...
|
|
5820
|
+
* }
|
|
5821
|
+
* ```
|
|
5822
|
+
*/
|
|
5823
|
+
list(projectID, query = {}, options) {
|
|
5824
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/certificates`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5825
|
+
}
|
|
5826
|
+
/**
|
|
5827
|
+
* Activate certificates at the project level.
|
|
5828
|
+
*
|
|
5829
|
+
* You can atomically and idempotently activate up to 10 certificates at a time.
|
|
5830
|
+
*
|
|
5831
|
+
* @example
|
|
5832
|
+
* ```ts
|
|
5833
|
+
* // Automatically fetches more pages as needed.
|
|
5834
|
+
* for await (const certificateActivateResponse of client.admin.organization.projects.certificates.activate(
|
|
5835
|
+
* 'project_id',
|
|
5836
|
+
* { certificate_ids: ['cert_abc'] },
|
|
5837
|
+
* )) {
|
|
5838
|
+
* // ...
|
|
5839
|
+
* }
|
|
5840
|
+
* ```
|
|
5841
|
+
*/
|
|
5842
|
+
activate(projectID, body, options) {
|
|
5843
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/certificates/activate`, (Page), { body, method: 'post', ...options, __security: { adminAPIKeyAuth: true } });
|
|
5844
|
+
}
|
|
5845
|
+
/**
|
|
5846
|
+
* Deactivate certificates at the project level. You can atomically and
|
|
5847
|
+
* idempotently deactivate up to 10 certificates at a time.
|
|
5848
|
+
*
|
|
5849
|
+
* @example
|
|
5850
|
+
* ```ts
|
|
5851
|
+
* // Automatically fetches more pages as needed.
|
|
5852
|
+
* for await (const certificateDeactivateResponse of client.admin.organization.projects.certificates.deactivate(
|
|
5853
|
+
* 'project_id',
|
|
5854
|
+
* { certificate_ids: ['cert_abc'] },
|
|
5855
|
+
* )) {
|
|
5856
|
+
* // ...
|
|
5857
|
+
* }
|
|
5858
|
+
* ```
|
|
5859
|
+
*/
|
|
5860
|
+
deactivate(projectID, body, options) {
|
|
5861
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/certificates/deactivate`, (Page), { body, method: 'post', ...options, __security: { adminAPIKeyAuth: true } });
|
|
5862
|
+
}
|
|
5863
|
+
}
|
|
5864
|
+
|
|
5865
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5866
|
+
class RateLimits extends APIResource {
|
|
5867
|
+
/**
|
|
5868
|
+
* Returns the rate limits per model for a project.
|
|
5869
|
+
*
|
|
5870
|
+
* @example
|
|
5871
|
+
* ```ts
|
|
5872
|
+
* // Automatically fetches more pages as needed.
|
|
5873
|
+
* for await (const projectRateLimit of client.admin.organization.projects.rateLimits.listRateLimits(
|
|
5874
|
+
* 'project_id',
|
|
5875
|
+
* )) {
|
|
5876
|
+
* // ...
|
|
5877
|
+
* }
|
|
5878
|
+
* ```
|
|
5879
|
+
*/
|
|
5880
|
+
listRateLimits(projectID, query = {}, options) {
|
|
5881
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/rate_limits`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5882
|
+
}
|
|
5883
|
+
/**
|
|
5884
|
+
* Updates a project rate limit.
|
|
5885
|
+
*
|
|
5886
|
+
* @example
|
|
5887
|
+
* ```ts
|
|
5888
|
+
* const projectRateLimit =
|
|
5889
|
+
* await client.admin.organization.projects.rateLimits.updateRateLimit(
|
|
5890
|
+
* 'rate_limit_id',
|
|
5891
|
+
* { project_id: 'project_id' },
|
|
5892
|
+
* );
|
|
5893
|
+
* ```
|
|
5894
|
+
*/
|
|
5895
|
+
updateRateLimit(rateLimitID, params, options) {
|
|
5896
|
+
const { project_id, ...body } = params;
|
|
5897
|
+
return this._client.post(path `/organization/projects/${project_id}/rate_limits/${rateLimitID}`, {
|
|
5898
|
+
body,
|
|
5899
|
+
...options,
|
|
5900
|
+
__security: { adminAPIKeyAuth: true },
|
|
5901
|
+
});
|
|
5902
|
+
}
|
|
5903
|
+
}
|
|
5904
|
+
|
|
5905
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5906
|
+
let Roles$3 = class Roles extends APIResource {
|
|
5907
|
+
/**
|
|
5908
|
+
* Creates a custom role for a project.
|
|
5909
|
+
*
|
|
5910
|
+
* @example
|
|
5911
|
+
* ```ts
|
|
5912
|
+
* const role =
|
|
5913
|
+
* await client.admin.organization.projects.roles.create(
|
|
5914
|
+
* 'project_id',
|
|
5915
|
+
* { permissions: ['string'], role_name: 'role_name' },
|
|
5916
|
+
* );
|
|
5917
|
+
* ```
|
|
5918
|
+
*/
|
|
5919
|
+
create(projectID, body, options) {
|
|
5920
|
+
return this._client.post(path `/projects/${projectID}/roles`, {
|
|
5921
|
+
body,
|
|
5922
|
+
...options,
|
|
5923
|
+
__security: { adminAPIKeyAuth: true },
|
|
5924
|
+
});
|
|
5925
|
+
}
|
|
5926
|
+
/**
|
|
5927
|
+
* Updates an existing project role.
|
|
5928
|
+
*
|
|
5929
|
+
* @example
|
|
5930
|
+
* ```ts
|
|
5931
|
+
* const role =
|
|
5932
|
+
* await client.admin.organization.projects.roles.update(
|
|
5933
|
+
* 'role_id',
|
|
5934
|
+
* { project_id: 'project_id' },
|
|
5935
|
+
* );
|
|
5936
|
+
* ```
|
|
5937
|
+
*/
|
|
5938
|
+
update(roleID, params, options) {
|
|
5939
|
+
const { project_id, ...body } = params;
|
|
5940
|
+
return this._client.post(path `/projects/${project_id}/roles/${roleID}`, {
|
|
5941
|
+
body,
|
|
5942
|
+
...options,
|
|
5943
|
+
__security: { adminAPIKeyAuth: true },
|
|
5944
|
+
});
|
|
5945
|
+
}
|
|
5946
|
+
/**
|
|
5947
|
+
* Lists the roles configured for a project.
|
|
5948
|
+
*
|
|
5949
|
+
* @example
|
|
5950
|
+
* ```ts
|
|
5951
|
+
* // Automatically fetches more pages as needed.
|
|
5952
|
+
* for await (const role of client.admin.organization.projects.roles.list(
|
|
5953
|
+
* 'project_id',
|
|
5954
|
+
* )) {
|
|
5955
|
+
* // ...
|
|
5956
|
+
* }
|
|
5957
|
+
* ```
|
|
5958
|
+
*/
|
|
5959
|
+
list(projectID, query = {}, options) {
|
|
5960
|
+
return this._client.getAPIList(path `/projects/${projectID}/roles`, (NextCursorPage), {
|
|
5961
|
+
query,
|
|
5962
|
+
...options,
|
|
5963
|
+
__security: { adminAPIKeyAuth: true },
|
|
5964
|
+
});
|
|
5965
|
+
}
|
|
5966
|
+
/**
|
|
5967
|
+
* Deletes a custom role from a project.
|
|
5968
|
+
*
|
|
5969
|
+
* @example
|
|
5970
|
+
* ```ts
|
|
5971
|
+
* const role =
|
|
5972
|
+
* await client.admin.organization.projects.roles.delete(
|
|
5973
|
+
* 'role_id',
|
|
5974
|
+
* { project_id: 'project_id' },
|
|
5975
|
+
* );
|
|
5976
|
+
* ```
|
|
5977
|
+
*/
|
|
5978
|
+
delete(roleID, params, options) {
|
|
5979
|
+
const { project_id } = params;
|
|
5980
|
+
return this._client.delete(path `/projects/${project_id}/roles/${roleID}`, {
|
|
5981
|
+
...options,
|
|
5982
|
+
__security: { adminAPIKeyAuth: true },
|
|
5983
|
+
});
|
|
5984
|
+
}
|
|
5985
|
+
};
|
|
5986
|
+
|
|
5987
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5988
|
+
class ServiceAccounts extends APIResource {
|
|
5989
|
+
/**
|
|
5990
|
+
* Creates a new service account in the project. This also returns an unredacted
|
|
5991
|
+
* API key for the service account.
|
|
5992
|
+
*
|
|
5993
|
+
* @example
|
|
5994
|
+
* ```ts
|
|
5995
|
+
* const serviceAccount =
|
|
5996
|
+
* await client.admin.organization.projects.serviceAccounts.create(
|
|
5997
|
+
* 'project_id',
|
|
5998
|
+
* { name: 'name' },
|
|
5999
|
+
* );
|
|
6000
|
+
* ```
|
|
6001
|
+
*/
|
|
6002
|
+
create(projectID, body, options) {
|
|
6003
|
+
return this._client.post(path `/organization/projects/${projectID}/service_accounts`, {
|
|
6004
|
+
body,
|
|
6005
|
+
...options,
|
|
6006
|
+
__security: { adminAPIKeyAuth: true },
|
|
6007
|
+
});
|
|
6008
|
+
}
|
|
6009
|
+
/**
|
|
6010
|
+
* Retrieves a service account in the project.
|
|
6011
|
+
*
|
|
6012
|
+
* @example
|
|
6013
|
+
* ```ts
|
|
6014
|
+
* const projectServiceAccount =
|
|
6015
|
+
* await client.admin.organization.projects.serviceAccounts.retrieve(
|
|
6016
|
+
* 'service_account_id',
|
|
6017
|
+
* { project_id: 'project_id' },
|
|
6018
|
+
* );
|
|
6019
|
+
* ```
|
|
6020
|
+
*/
|
|
6021
|
+
retrieve(serviceAccountID, params, options) {
|
|
6022
|
+
const { project_id } = params;
|
|
6023
|
+
return this._client.get(path `/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, {
|
|
6024
|
+
...options,
|
|
6025
|
+
__security: { adminAPIKeyAuth: true },
|
|
6026
|
+
});
|
|
6027
|
+
}
|
|
6028
|
+
/**
|
|
6029
|
+
* Returns a list of service accounts in the project.
|
|
6030
|
+
*
|
|
6031
|
+
* @example
|
|
6032
|
+
* ```ts
|
|
6033
|
+
* // Automatically fetches more pages as needed.
|
|
6034
|
+
* for await (const projectServiceAccount of client.admin.organization.projects.serviceAccounts.list(
|
|
6035
|
+
* 'project_id',
|
|
6036
|
+
* )) {
|
|
6037
|
+
* // ...
|
|
6038
|
+
* }
|
|
6039
|
+
* ```
|
|
6040
|
+
*/
|
|
6041
|
+
list(projectID, query = {}, options) {
|
|
6042
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/service_accounts`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
6043
|
+
}
|
|
6044
|
+
/**
|
|
6045
|
+
* Deletes a service account from the project.
|
|
6046
|
+
*
|
|
6047
|
+
* Returns confirmation of service account deletion, or an error if the project is
|
|
6048
|
+
* archived (archived projects have no service accounts).
|
|
6049
|
+
*
|
|
6050
|
+
* @example
|
|
6051
|
+
* ```ts
|
|
6052
|
+
* const serviceAccount =
|
|
6053
|
+
* await client.admin.organization.projects.serviceAccounts.delete(
|
|
6054
|
+
* 'service_account_id',
|
|
6055
|
+
* { project_id: 'project_id' },
|
|
6056
|
+
* );
|
|
6057
|
+
* ```
|
|
6058
|
+
*/
|
|
6059
|
+
delete(serviceAccountID, params, options) {
|
|
6060
|
+
const { project_id } = params;
|
|
6061
|
+
return this._client.delete(path `/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, { ...options, __security: { adminAPIKeyAuth: true } });
|
|
6062
|
+
}
|
|
6063
|
+
}
|
|
6064
|
+
|
|
6065
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6066
|
+
let Roles$2 = class Roles extends APIResource {
|
|
6067
|
+
/**
|
|
6068
|
+
* Assigns a project role to a group within a project.
|
|
6069
|
+
*
|
|
6070
|
+
* @example
|
|
6071
|
+
* ```ts
|
|
6072
|
+
* const role =
|
|
6073
|
+
* await client.admin.organization.projects.groups.roles.create(
|
|
6074
|
+
* 'group_id',
|
|
6075
|
+
* { project_id: 'project_id', role_id: 'role_id' },
|
|
6076
|
+
* );
|
|
6077
|
+
* ```
|
|
6078
|
+
*/
|
|
6079
|
+
create(groupID, params, options) {
|
|
6080
|
+
const { project_id, ...body } = params;
|
|
6081
|
+
return this._client.post(path `/projects/${project_id}/groups/${groupID}/roles`, {
|
|
6082
|
+
body,
|
|
6083
|
+
...options,
|
|
6084
|
+
__security: { adminAPIKeyAuth: true },
|
|
6085
|
+
});
|
|
6086
|
+
}
|
|
6087
|
+
/**
|
|
6088
|
+
* Lists the project roles assigned to a group within a project.
|
|
6089
|
+
*
|
|
6090
|
+
* @example
|
|
6091
|
+
* ```ts
|
|
6092
|
+
* // Automatically fetches more pages as needed.
|
|
6093
|
+
* for await (const roleListResponse of client.admin.organization.projects.groups.roles.list(
|
|
6094
|
+
* 'group_id',
|
|
6095
|
+
* { project_id: 'project_id' },
|
|
6096
|
+
* )) {
|
|
6097
|
+
* // ...
|
|
6098
|
+
* }
|
|
6099
|
+
* ```
|
|
6100
|
+
*/
|
|
6101
|
+
list(groupID, params, options) {
|
|
6102
|
+
const { project_id, ...query } = params;
|
|
6103
|
+
return this._client.getAPIList(path `/projects/${project_id}/groups/${groupID}/roles`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
6104
|
+
}
|
|
6105
|
+
/**
|
|
6106
|
+
* Unassigns a project role from a group within a project.
|
|
6107
|
+
*
|
|
6108
|
+
* @example
|
|
6109
|
+
* ```ts
|
|
6110
|
+
* const role =
|
|
6111
|
+
* await client.admin.organization.projects.groups.roles.delete(
|
|
6112
|
+
* 'role_id',
|
|
6113
|
+
* { project_id: 'project_id', group_id: 'group_id' },
|
|
6114
|
+
* );
|
|
6115
|
+
* ```
|
|
6116
|
+
*/
|
|
6117
|
+
delete(roleID, params, options) {
|
|
6118
|
+
const { project_id, group_id } = params;
|
|
6119
|
+
return this._client.delete(path `/projects/${project_id}/groups/${group_id}/roles/${roleID}`, {
|
|
6120
|
+
...options,
|
|
6121
|
+
__security: { adminAPIKeyAuth: true },
|
|
6122
|
+
});
|
|
6123
|
+
}
|
|
6124
|
+
};
|
|
6125
|
+
|
|
6126
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6127
|
+
class Groups extends APIResource {
|
|
6128
|
+
constructor() {
|
|
6129
|
+
super(...arguments);
|
|
6130
|
+
this.roles = new Roles$2(this._client);
|
|
6131
|
+
}
|
|
6132
|
+
/**
|
|
6133
|
+
* Grants a group access to a project.
|
|
6134
|
+
*
|
|
6135
|
+
* @example
|
|
6136
|
+
* ```ts
|
|
6137
|
+
* const projectGroup =
|
|
6138
|
+
* await client.admin.organization.projects.groups.create(
|
|
6139
|
+
* 'project_id',
|
|
6140
|
+
* { group_id: 'group_id', role: 'role' },
|
|
6141
|
+
* );
|
|
6142
|
+
* ```
|
|
6143
|
+
*/
|
|
6144
|
+
create(projectID, body, options) {
|
|
6145
|
+
return this._client.post(path `/organization/projects/${projectID}/groups`, {
|
|
6146
|
+
body,
|
|
6147
|
+
...options,
|
|
6148
|
+
__security: { adminAPIKeyAuth: true },
|
|
6149
|
+
});
|
|
6150
|
+
}
|
|
6151
|
+
/**
|
|
6152
|
+
* Lists the groups that have access to a project.
|
|
6153
|
+
*
|
|
6154
|
+
* @example
|
|
6155
|
+
* ```ts
|
|
6156
|
+
* // Automatically fetches more pages as needed.
|
|
6157
|
+
* for await (const projectGroup of client.admin.organization.projects.groups.list(
|
|
6158
|
+
* 'project_id',
|
|
6159
|
+
* )) {
|
|
6160
|
+
* // ...
|
|
6161
|
+
* }
|
|
6162
|
+
* ```
|
|
6163
|
+
*/
|
|
6164
|
+
list(projectID, query = {}, options) {
|
|
6165
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/groups`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
6166
|
+
}
|
|
6167
|
+
/**
|
|
6168
|
+
* Revokes a group's access to a project.
|
|
6169
|
+
*
|
|
6170
|
+
* @example
|
|
6171
|
+
* ```ts
|
|
6172
|
+
* const group =
|
|
6173
|
+
* await client.admin.organization.projects.groups.delete(
|
|
6174
|
+
* 'group_id',
|
|
6175
|
+
* { project_id: 'project_id' },
|
|
6176
|
+
* );
|
|
6177
|
+
* ```
|
|
6178
|
+
*/
|
|
6179
|
+
delete(groupID, params, options) {
|
|
6180
|
+
const { project_id } = params;
|
|
6181
|
+
return this._client.delete(path `/organization/projects/${project_id}/groups/${groupID}`, {
|
|
6182
|
+
...options,
|
|
6183
|
+
__security: { adminAPIKeyAuth: true },
|
|
6184
|
+
});
|
|
6185
|
+
}
|
|
6186
|
+
}
|
|
6187
|
+
Groups.Roles = Roles$2;
|
|
6188
|
+
|
|
6189
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6190
|
+
let Roles$1 = class Roles extends APIResource {
|
|
6191
|
+
/**
|
|
6192
|
+
* Assigns a project role to a user within a project.
|
|
6193
|
+
*
|
|
6194
|
+
* @example
|
|
6195
|
+
* ```ts
|
|
6196
|
+
* const role =
|
|
6197
|
+
* await client.admin.organization.projects.users.roles.create(
|
|
6198
|
+
* 'user_id',
|
|
6199
|
+
* { project_id: 'project_id', role_id: 'role_id' },
|
|
6200
|
+
* );
|
|
6201
|
+
* ```
|
|
6202
|
+
*/
|
|
6203
|
+
create(userID, params, options) {
|
|
6204
|
+
const { project_id, ...body } = params;
|
|
6205
|
+
return this._client.post(path `/projects/${project_id}/users/${userID}/roles`, {
|
|
6206
|
+
body,
|
|
6207
|
+
...options,
|
|
6208
|
+
__security: { adminAPIKeyAuth: true },
|
|
6209
|
+
});
|
|
6210
|
+
}
|
|
6211
|
+
/**
|
|
6212
|
+
* Lists the project roles assigned to a user within a project.
|
|
6213
|
+
*
|
|
6214
|
+
* @example
|
|
6215
|
+
* ```ts
|
|
6216
|
+
* // Automatically fetches more pages as needed.
|
|
6217
|
+
* for await (const roleListResponse of client.admin.organization.projects.users.roles.list(
|
|
6218
|
+
* 'user_id',
|
|
6219
|
+
* { project_id: 'project_id' },
|
|
6220
|
+
* )) {
|
|
6221
|
+
* // ...
|
|
6222
|
+
* }
|
|
6223
|
+
* ```
|
|
6224
|
+
*/
|
|
6225
|
+
list(userID, params, options) {
|
|
6226
|
+
const { project_id, ...query } = params;
|
|
6227
|
+
return this._client.getAPIList(path `/projects/${project_id}/users/${userID}/roles`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
6228
|
+
}
|
|
6229
|
+
/**
|
|
6230
|
+
* Unassigns a project role from a user within a project.
|
|
6231
|
+
*
|
|
6232
|
+
* @example
|
|
6233
|
+
* ```ts
|
|
6234
|
+
* const role =
|
|
6235
|
+
* await client.admin.organization.projects.users.roles.delete(
|
|
6236
|
+
* 'role_id',
|
|
6237
|
+
* { project_id: 'project_id', user_id: 'user_id' },
|
|
6238
|
+
* );
|
|
6239
|
+
* ```
|
|
6240
|
+
*/
|
|
6241
|
+
delete(roleID, params, options) {
|
|
6242
|
+
const { project_id, user_id } = params;
|
|
6243
|
+
return this._client.delete(path `/projects/${project_id}/users/${user_id}/roles/${roleID}`, {
|
|
6244
|
+
...options,
|
|
6245
|
+
__security: { adminAPIKeyAuth: true },
|
|
6246
|
+
});
|
|
6247
|
+
}
|
|
6248
|
+
};
|
|
6249
|
+
|
|
6250
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6251
|
+
let Users$1 = class Users extends APIResource {
|
|
6252
|
+
constructor() {
|
|
6253
|
+
super(...arguments);
|
|
6254
|
+
this.roles = new Roles$1(this._client);
|
|
6255
|
+
}
|
|
6256
|
+
/**
|
|
6257
|
+
* Adds a user to the project. Users must already be members of the organization to
|
|
6258
|
+
* be added to a project.
|
|
6259
|
+
*
|
|
6260
|
+
* @example
|
|
6261
|
+
* ```ts
|
|
6262
|
+
* const projectUser =
|
|
6263
|
+
* await client.admin.organization.projects.users.create(
|
|
6264
|
+
* 'project_id',
|
|
6265
|
+
* { role: 'role' },
|
|
6266
|
+
* );
|
|
6267
|
+
* ```
|
|
6268
|
+
*/
|
|
6269
|
+
create(projectID, body, options) {
|
|
6270
|
+
return this._client.post(path `/organization/projects/${projectID}/users`, {
|
|
6271
|
+
body,
|
|
6272
|
+
...options,
|
|
6273
|
+
__security: { adminAPIKeyAuth: true },
|
|
6274
|
+
});
|
|
6275
|
+
}
|
|
6276
|
+
/**
|
|
6277
|
+
* Retrieves a user in the project.
|
|
6278
|
+
*
|
|
6279
|
+
* @example
|
|
6280
|
+
* ```ts
|
|
6281
|
+
* const projectUser =
|
|
6282
|
+
* await client.admin.organization.projects.users.retrieve(
|
|
6283
|
+
* 'user_id',
|
|
6284
|
+
* { project_id: 'project_id' },
|
|
6285
|
+
* );
|
|
6286
|
+
* ```
|
|
6287
|
+
*/
|
|
6288
|
+
retrieve(userID, params, options) {
|
|
6289
|
+
const { project_id } = params;
|
|
6290
|
+
return this._client.get(path `/organization/projects/${project_id}/users/${userID}`, {
|
|
6291
|
+
...options,
|
|
6292
|
+
__security: { adminAPIKeyAuth: true },
|
|
6293
|
+
});
|
|
6294
|
+
}
|
|
6295
|
+
/**
|
|
6296
|
+
* Modifies a user's role in the project.
|
|
6297
|
+
*
|
|
6298
|
+
* @example
|
|
6299
|
+
* ```ts
|
|
6300
|
+
* const projectUser =
|
|
6301
|
+
* await client.admin.organization.projects.users.update(
|
|
6302
|
+
* 'user_id',
|
|
6303
|
+
* { project_id: 'project_id' },
|
|
6304
|
+
* );
|
|
6305
|
+
* ```
|
|
6306
|
+
*/
|
|
6307
|
+
update(userID, params, options) {
|
|
6308
|
+
const { project_id, ...body } = params;
|
|
6309
|
+
return this._client.post(path `/organization/projects/${project_id}/users/${userID}`, {
|
|
6310
|
+
body,
|
|
6311
|
+
...options,
|
|
6312
|
+
__security: { adminAPIKeyAuth: true },
|
|
6313
|
+
});
|
|
6314
|
+
}
|
|
6315
|
+
/**
|
|
6316
|
+
* Returns a list of users in the project.
|
|
6317
|
+
*
|
|
6318
|
+
* @example
|
|
6319
|
+
* ```ts
|
|
6320
|
+
* // Automatically fetches more pages as needed.
|
|
6321
|
+
* for await (const projectUser of client.admin.organization.projects.users.list(
|
|
6322
|
+
* 'project_id',
|
|
6323
|
+
* )) {
|
|
6324
|
+
* // ...
|
|
6325
|
+
* }
|
|
6326
|
+
* ```
|
|
6327
|
+
*/
|
|
6328
|
+
list(projectID, query = {}, options) {
|
|
6329
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/users`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
6330
|
+
}
|
|
6331
|
+
/**
|
|
6332
|
+
* Deletes a user from the project.
|
|
6333
|
+
*
|
|
6334
|
+
* Returns confirmation of project user deletion, or an error if the project is
|
|
6335
|
+
* archived (archived projects have no users).
|
|
6336
|
+
*
|
|
6337
|
+
* @example
|
|
6338
|
+
* ```ts
|
|
6339
|
+
* const user =
|
|
6340
|
+
* await client.admin.organization.projects.users.delete(
|
|
6341
|
+
* 'user_id',
|
|
6342
|
+
* { project_id: 'project_id' },
|
|
6343
|
+
* );
|
|
6344
|
+
* ```
|
|
6345
|
+
*/
|
|
6346
|
+
delete(userID, params, options) {
|
|
6347
|
+
const { project_id } = params;
|
|
6348
|
+
return this._client.delete(path `/organization/projects/${project_id}/users/${userID}`, {
|
|
6349
|
+
...options,
|
|
6350
|
+
__security: { adminAPIKeyAuth: true },
|
|
6351
|
+
});
|
|
6352
|
+
}
|
|
6353
|
+
};
|
|
6354
|
+
Users$1.Roles = Roles$1;
|
|
6355
|
+
|
|
6356
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6357
|
+
class Projects extends APIResource {
|
|
6358
|
+
constructor() {
|
|
6359
|
+
super(...arguments);
|
|
6360
|
+
this.users = new Users$1(this._client);
|
|
6361
|
+
this.serviceAccounts = new ServiceAccounts(this._client);
|
|
6362
|
+
this.apiKeys = new APIKeys(this._client);
|
|
6363
|
+
this.rateLimits = new RateLimits(this._client);
|
|
6364
|
+
this.groups = new Groups(this._client);
|
|
6365
|
+
this.roles = new Roles$3(this._client);
|
|
6366
|
+
this.certificates = new Certificates(this._client);
|
|
6367
|
+
}
|
|
6368
|
+
/**
|
|
6369
|
+
* Create a new project in the organization. Projects can be created and archived,
|
|
6370
|
+
* but cannot be deleted.
|
|
6371
|
+
*
|
|
6372
|
+
* @example
|
|
6373
|
+
* ```ts
|
|
6374
|
+
* const project =
|
|
6375
|
+
* await client.admin.organization.projects.create({
|
|
6376
|
+
* name: 'name',
|
|
6377
|
+
* });
|
|
6378
|
+
* ```
|
|
6379
|
+
*/
|
|
6380
|
+
create(body, options) {
|
|
6381
|
+
return this._client.post('/organization/projects', {
|
|
6382
|
+
body,
|
|
6383
|
+
...options,
|
|
6384
|
+
__security: { adminAPIKeyAuth: true },
|
|
6385
|
+
});
|
|
6386
|
+
}
|
|
6387
|
+
/**
|
|
6388
|
+
* Retrieves a project.
|
|
6389
|
+
*
|
|
6390
|
+
* @example
|
|
6391
|
+
* ```ts
|
|
6392
|
+
* const project =
|
|
6393
|
+
* await client.admin.organization.projects.retrieve(
|
|
6394
|
+
* 'project_id',
|
|
6395
|
+
* );
|
|
6396
|
+
* ```
|
|
6397
|
+
*/
|
|
6398
|
+
retrieve(projectID, options) {
|
|
6399
|
+
return this._client.get(path `/organization/projects/${projectID}`, {
|
|
6400
|
+
...options,
|
|
6401
|
+
__security: { adminAPIKeyAuth: true },
|
|
6402
|
+
});
|
|
6403
|
+
}
|
|
6404
|
+
/**
|
|
6405
|
+
* Modifies a project in the organization.
|
|
6406
|
+
*
|
|
6407
|
+
* @example
|
|
6408
|
+
* ```ts
|
|
6409
|
+
* const project =
|
|
6410
|
+
* await client.admin.organization.projects.update(
|
|
6411
|
+
* 'project_id',
|
|
6412
|
+
* );
|
|
6413
|
+
* ```
|
|
6414
|
+
*/
|
|
6415
|
+
update(projectID, body, options) {
|
|
6416
|
+
return this._client.post(path `/organization/projects/${projectID}`, {
|
|
6417
|
+
body,
|
|
6418
|
+
...options,
|
|
6419
|
+
__security: { adminAPIKeyAuth: true },
|
|
6420
|
+
});
|
|
6421
|
+
}
|
|
6422
|
+
/**
|
|
6423
|
+
* Returns a list of projects.
|
|
6424
|
+
*
|
|
6425
|
+
* @example
|
|
6426
|
+
* ```ts
|
|
6427
|
+
* // Automatically fetches more pages as needed.
|
|
6428
|
+
* for await (const project of client.admin.organization.projects.list()) {
|
|
6429
|
+
* // ...
|
|
6430
|
+
* }
|
|
6431
|
+
* ```
|
|
6432
|
+
*/
|
|
6433
|
+
list(query = {}, options) {
|
|
6434
|
+
return this._client.getAPIList('/organization/projects', (ConversationCursorPage), {
|
|
6435
|
+
query,
|
|
6436
|
+
...options,
|
|
6437
|
+
__security: { adminAPIKeyAuth: true },
|
|
6438
|
+
});
|
|
6439
|
+
}
|
|
6440
|
+
/**
|
|
6441
|
+
* Archives a project in the organization. Archived projects cannot be used or
|
|
6442
|
+
* updated.
|
|
6443
|
+
*
|
|
6444
|
+
* @example
|
|
6445
|
+
* ```ts
|
|
6446
|
+
* const project =
|
|
6447
|
+
* await client.admin.organization.projects.archive(
|
|
6448
|
+
* 'project_id',
|
|
6449
|
+
* );
|
|
6450
|
+
* ```
|
|
6451
|
+
*/
|
|
6452
|
+
archive(projectID, options) {
|
|
6453
|
+
return this._client.post(path `/organization/projects/${projectID}/archive`, {
|
|
6454
|
+
...options,
|
|
6455
|
+
__security: { adminAPIKeyAuth: true },
|
|
6456
|
+
});
|
|
6457
|
+
}
|
|
6458
|
+
}
|
|
6459
|
+
Projects.Users = Users$1;
|
|
6460
|
+
Projects.ServiceAccounts = ServiceAccounts;
|
|
6461
|
+
Projects.APIKeys = APIKeys;
|
|
6462
|
+
Projects.RateLimits = RateLimits;
|
|
6463
|
+
Projects.Groups = Groups;
|
|
6464
|
+
Projects.Roles = Roles$3;
|
|
6465
|
+
Projects.Certificates = Certificates;
|
|
6466
|
+
|
|
6467
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6468
|
+
class Roles extends APIResource {
|
|
6469
|
+
/**
|
|
6470
|
+
* Assigns an organization role to a user within the organization.
|
|
6471
|
+
*
|
|
6472
|
+
* @example
|
|
6473
|
+
* ```ts
|
|
6474
|
+
* const role =
|
|
6475
|
+
* await client.admin.organization.users.roles.create(
|
|
6476
|
+
* 'user_id',
|
|
6477
|
+
* { role_id: 'role_id' },
|
|
6478
|
+
* );
|
|
6479
|
+
* ```
|
|
6480
|
+
*/
|
|
6481
|
+
create(userID, body, options) {
|
|
6482
|
+
return this._client.post(path `/organization/users/${userID}/roles`, {
|
|
6483
|
+
body,
|
|
6484
|
+
...options,
|
|
6485
|
+
__security: { adminAPIKeyAuth: true },
|
|
6486
|
+
});
|
|
6487
|
+
}
|
|
6488
|
+
/**
|
|
6489
|
+
* Lists the organization roles assigned to a user within the organization.
|
|
6490
|
+
*
|
|
6491
|
+
* @example
|
|
6492
|
+
* ```ts
|
|
6493
|
+
* // Automatically fetches more pages as needed.
|
|
6494
|
+
* for await (const roleListResponse of client.admin.organization.users.roles.list(
|
|
6495
|
+
* 'user_id',
|
|
6496
|
+
* )) {
|
|
6497
|
+
* // ...
|
|
6498
|
+
* }
|
|
6499
|
+
* ```
|
|
6500
|
+
*/
|
|
6501
|
+
list(userID, query = {}, options) {
|
|
6502
|
+
return this._client.getAPIList(path `/organization/users/${userID}/roles`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
6503
|
+
}
|
|
6504
|
+
/**
|
|
6505
|
+
* Unassigns an organization role from a user within the organization.
|
|
6506
|
+
*
|
|
6507
|
+
* @example
|
|
6508
|
+
* ```ts
|
|
6509
|
+
* const role =
|
|
6510
|
+
* await client.admin.organization.users.roles.delete(
|
|
6511
|
+
* 'role_id',
|
|
6512
|
+
* { user_id: 'user_id' },
|
|
6513
|
+
* );
|
|
6514
|
+
* ```
|
|
6515
|
+
*/
|
|
6516
|
+
delete(roleID, params, options) {
|
|
6517
|
+
const { user_id } = params;
|
|
6518
|
+
return this._client.delete(path `/organization/users/${user_id}/roles/${roleID}`, {
|
|
4815
6519
|
...options,
|
|
4816
|
-
|
|
4817
|
-
};
|
|
4818
|
-
runner._run(() => runner._runTools(client, params, opts));
|
|
4819
|
-
return runner;
|
|
6520
|
+
__security: { adminAPIKeyAuth: true },
|
|
6521
|
+
});
|
|
4820
6522
|
}
|
|
4821
6523
|
}
|
|
4822
6524
|
|
|
4823
6525
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4824
|
-
|
|
4825
|
-
* Given a list of messages comprising a conversation, the model will return a response.
|
|
4826
|
-
*/
|
|
4827
|
-
let Completions$1 = class Completions extends APIResource {
|
|
6526
|
+
class Users extends APIResource {
|
|
4828
6527
|
constructor() {
|
|
4829
6528
|
super(...arguments);
|
|
4830
|
-
this.
|
|
4831
|
-
}
|
|
4832
|
-
create(body, options) {
|
|
4833
|
-
return this._client.post('/chat/completions', { body, ...options, stream: body.stream ?? false });
|
|
6529
|
+
this.roles = new Roles(this._client);
|
|
4834
6530
|
}
|
|
4835
6531
|
/**
|
|
4836
|
-
*
|
|
4837
|
-
* the `store` parameter set to `true` will be returned.
|
|
6532
|
+
* Retrieves a user by their identifier.
|
|
4838
6533
|
*
|
|
4839
6534
|
* @example
|
|
4840
6535
|
* ```ts
|
|
4841
|
-
* const
|
|
4842
|
-
* await client.
|
|
6536
|
+
* const organizationUser =
|
|
6537
|
+
* await client.admin.organization.users.retrieve('user_id');
|
|
4843
6538
|
* ```
|
|
4844
6539
|
*/
|
|
4845
|
-
retrieve(
|
|
4846
|
-
return this._client.get(path `/
|
|
6540
|
+
retrieve(userID, options) {
|
|
6541
|
+
return this._client.get(path `/organization/users/${userID}`, {
|
|
6542
|
+
...options,
|
|
6543
|
+
__security: { adminAPIKeyAuth: true },
|
|
6544
|
+
});
|
|
4847
6545
|
}
|
|
4848
6546
|
/**
|
|
4849
|
-
*
|
|
4850
|
-
* with the `store` parameter set to `true` can be modified. Currently, the only
|
|
4851
|
-
* supported modification is to update the `metadata` field.
|
|
6547
|
+
* Modifies a user's role in the organization.
|
|
4852
6548
|
*
|
|
4853
6549
|
* @example
|
|
4854
6550
|
* ```ts
|
|
4855
|
-
* const
|
|
4856
|
-
* '
|
|
4857
|
-
* { metadata: { foo: 'string' } },
|
|
4858
|
-
* );
|
|
6551
|
+
* const organizationUser =
|
|
6552
|
+
* await client.admin.organization.users.update('user_id');
|
|
4859
6553
|
* ```
|
|
4860
6554
|
*/
|
|
4861
|
-
update(
|
|
4862
|
-
return this._client.post(path `/
|
|
6555
|
+
update(userID, body, options) {
|
|
6556
|
+
return this._client.post(path `/organization/users/${userID}`, {
|
|
6557
|
+
body,
|
|
6558
|
+
...options,
|
|
6559
|
+
__security: { adminAPIKeyAuth: true },
|
|
6560
|
+
});
|
|
4863
6561
|
}
|
|
4864
6562
|
/**
|
|
4865
|
-
*
|
|
4866
|
-
* the `store` parameter set to `true` will be returned.
|
|
6563
|
+
* Lists all of the users in the organization.
|
|
4867
6564
|
*
|
|
4868
6565
|
* @example
|
|
4869
6566
|
* ```ts
|
|
4870
6567
|
* // Automatically fetches more pages as needed.
|
|
4871
|
-
* for await (const
|
|
6568
|
+
* for await (const organizationUser of client.admin.organization.users.list()) {
|
|
4872
6569
|
* // ...
|
|
4873
6570
|
* }
|
|
4874
6571
|
* ```
|
|
4875
6572
|
*/
|
|
4876
6573
|
list(query = {}, options) {
|
|
4877
|
-
return this._client.getAPIList('/
|
|
6574
|
+
return this._client.getAPIList('/organization/users', (ConversationCursorPage), {
|
|
6575
|
+
query,
|
|
6576
|
+
...options,
|
|
6577
|
+
__security: { adminAPIKeyAuth: true },
|
|
6578
|
+
});
|
|
4878
6579
|
}
|
|
4879
6580
|
/**
|
|
4880
|
-
*
|
|
4881
|
-
* with the `store` parameter set to `true` can be deleted.
|
|
6581
|
+
* Deletes a user from the organization.
|
|
4882
6582
|
*
|
|
4883
6583
|
* @example
|
|
4884
6584
|
* ```ts
|
|
4885
|
-
* const
|
|
4886
|
-
*
|
|
6585
|
+
* const user = await client.admin.organization.users.delete(
|
|
6586
|
+
* 'user_id',
|
|
6587
|
+
* );
|
|
4887
6588
|
* ```
|
|
4888
6589
|
*/
|
|
4889
|
-
delete(
|
|
4890
|
-
return this._client.delete(path `/
|
|
4891
|
-
}
|
|
4892
|
-
parse(body, options) {
|
|
4893
|
-
validateInputTools(body.tools);
|
|
4894
|
-
return this._client.chat.completions
|
|
4895
|
-
.create(body, {
|
|
6590
|
+
delete(userID, options) {
|
|
6591
|
+
return this._client.delete(path `/organization/users/${userID}`, {
|
|
4896
6592
|
...options,
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
'X-Stainless-Helper-Method': 'chat.completions.parse',
|
|
4900
|
-
},
|
|
4901
|
-
})
|
|
4902
|
-
._thenUnwrap((completion) => parseChatCompletion(completion, body));
|
|
4903
|
-
}
|
|
4904
|
-
runTools(body, options) {
|
|
4905
|
-
if (body.stream) {
|
|
4906
|
-
return ChatCompletionStreamingRunner.runTools(this._client, body, options);
|
|
4907
|
-
}
|
|
4908
|
-
return ChatCompletionRunner.runTools(this._client, body, options);
|
|
4909
|
-
}
|
|
4910
|
-
/**
|
|
4911
|
-
* Creates a chat completion stream
|
|
4912
|
-
*/
|
|
4913
|
-
stream(body, options) {
|
|
4914
|
-
return ChatCompletionStream.createChatCompletion(this._client, body, options);
|
|
6593
|
+
__security: { adminAPIKeyAuth: true },
|
|
6594
|
+
});
|
|
4915
6595
|
}
|
|
4916
|
-
}
|
|
4917
|
-
|
|
6596
|
+
}
|
|
6597
|
+
Users.Roles = Roles;
|
|
4918
6598
|
|
|
4919
6599
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4920
|
-
class
|
|
6600
|
+
class Organization extends APIResource {
|
|
4921
6601
|
constructor() {
|
|
4922
6602
|
super(...arguments);
|
|
4923
|
-
this.
|
|
6603
|
+
this.auditLogs = new AuditLogs(this._client);
|
|
6604
|
+
this.adminAPIKeys = new AdminAPIKeys(this._client);
|
|
6605
|
+
this.usage = new Usage(this._client);
|
|
6606
|
+
this.invites = new Invites(this._client);
|
|
6607
|
+
this.users = new Users(this._client);
|
|
6608
|
+
this.groups = new Groups$1(this._client);
|
|
6609
|
+
this.roles = new Roles$5(this._client);
|
|
6610
|
+
this.certificates = new Certificates$1(this._client);
|
|
6611
|
+
this.projects = new Projects(this._client);
|
|
6612
|
+
}
|
|
6613
|
+
}
|
|
6614
|
+
Organization.AuditLogs = AuditLogs;
|
|
6615
|
+
Organization.AdminAPIKeys = AdminAPIKeys;
|
|
6616
|
+
Organization.Usage = Usage;
|
|
6617
|
+
Organization.Invites = Invites;
|
|
6618
|
+
Organization.Users = Users;
|
|
6619
|
+
Organization.Groups = Groups$1;
|
|
6620
|
+
Organization.Roles = Roles$5;
|
|
6621
|
+
Organization.Certificates = Certificates$1;
|
|
6622
|
+
Organization.Projects = Projects;
|
|
6623
|
+
|
|
6624
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6625
|
+
class Admin extends APIResource {
|
|
6626
|
+
constructor() {
|
|
6627
|
+
super(...arguments);
|
|
6628
|
+
this.organization = new Organization(this._client);
|
|
4924
6629
|
}
|
|
4925
6630
|
}
|
|
4926
|
-
|
|
6631
|
+
Admin.Organization = Organization;
|
|
4927
6632
|
|
|
4928
6633
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4929
6634
|
const brand_privateNullableHeaders = /* @__PURE__ */ Symbol('brand.privateNullableHeaders');
|
|
@@ -5020,6 +6725,7 @@ class Speech extends APIResource {
|
|
|
5020
6725
|
body,
|
|
5021
6726
|
...options,
|
|
5022
6727
|
headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]),
|
|
6728
|
+
__security: { bearerAuth: true },
|
|
5023
6729
|
__binaryResponse: true,
|
|
5024
6730
|
});
|
|
5025
6731
|
}
|
|
@@ -5036,6 +6742,7 @@ class Transcriptions extends APIResource {
|
|
|
5036
6742
|
...options,
|
|
5037
6743
|
stream: body.stream ?? false,
|
|
5038
6744
|
__metadata: { model: body.model },
|
|
6745
|
+
__security: { bearerAuth: true },
|
|
5039
6746
|
}, this._client));
|
|
5040
6747
|
}
|
|
5041
6748
|
}
|
|
@@ -5046,7 +6753,7 @@ class Transcriptions extends APIResource {
|
|
|
5046
6753
|
*/
|
|
5047
6754
|
class Translations extends APIResource {
|
|
5048
6755
|
create(body, options) {
|
|
5049
|
-
return this._client.post('/audio/translations', multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }, this._client));
|
|
6756
|
+
return this._client.post('/audio/translations', multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model }, __security: { bearerAuth: true } }, this._client));
|
|
5050
6757
|
}
|
|
5051
6758
|
}
|
|
5052
6759
|
|
|
@@ -5072,19 +6779,23 @@ class Batches extends APIResource {
|
|
|
5072
6779
|
* Creates and executes a batch from an uploaded file of requests
|
|
5073
6780
|
*/
|
|
5074
6781
|
create(body, options) {
|
|
5075
|
-
return this._client.post('/batches', { body, ...options });
|
|
6782
|
+
return this._client.post('/batches', { body, ...options, __security: { bearerAuth: true } });
|
|
5076
6783
|
}
|
|
5077
6784
|
/**
|
|
5078
6785
|
* Retrieves a batch.
|
|
5079
6786
|
*/
|
|
5080
6787
|
retrieve(batchID, options) {
|
|
5081
|
-
return this._client.get(path `/batches/${batchID}`, options);
|
|
6788
|
+
return this._client.get(path `/batches/${batchID}`, { ...options, __security: { bearerAuth: true } });
|
|
5082
6789
|
}
|
|
5083
6790
|
/**
|
|
5084
6791
|
* List your organization's batches.
|
|
5085
6792
|
*/
|
|
5086
6793
|
list(query = {}, options) {
|
|
5087
|
-
return this._client.getAPIList('/batches', (CursorPage), {
|
|
6794
|
+
return this._client.getAPIList('/batches', (CursorPage), {
|
|
6795
|
+
query,
|
|
6796
|
+
...options,
|
|
6797
|
+
__security: { bearerAuth: true },
|
|
6798
|
+
});
|
|
5088
6799
|
}
|
|
5089
6800
|
/**
|
|
5090
6801
|
* Cancels an in-progress batch. The batch will be in status `cancelling` for up to
|
|
@@ -5092,7 +6803,10 @@ class Batches extends APIResource {
|
|
|
5092
6803
|
* (if any) available in the output file.
|
|
5093
6804
|
*/
|
|
5094
6805
|
cancel(batchID, options) {
|
|
5095
|
-
return this._client.post(path `/batches/${batchID}/cancel`,
|
|
6806
|
+
return this._client.post(path `/batches/${batchID}/cancel`, {
|
|
6807
|
+
...options,
|
|
6808
|
+
__security: { bearerAuth: true },
|
|
6809
|
+
});
|
|
5096
6810
|
}
|
|
5097
6811
|
}
|
|
5098
6812
|
|
|
@@ -5111,6 +6825,7 @@ class Assistants extends APIResource {
|
|
|
5111
6825
|
body,
|
|
5112
6826
|
...options,
|
|
5113
6827
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6828
|
+
__security: { bearerAuth: true },
|
|
5114
6829
|
});
|
|
5115
6830
|
}
|
|
5116
6831
|
/**
|
|
@@ -5122,6 +6837,7 @@ class Assistants extends APIResource {
|
|
|
5122
6837
|
return this._client.get(path `/assistants/${assistantID}`, {
|
|
5123
6838
|
...options,
|
|
5124
6839
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6840
|
+
__security: { bearerAuth: true },
|
|
5125
6841
|
});
|
|
5126
6842
|
}
|
|
5127
6843
|
/**
|
|
@@ -5134,6 +6850,7 @@ class Assistants extends APIResource {
|
|
|
5134
6850
|
body,
|
|
5135
6851
|
...options,
|
|
5136
6852
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6853
|
+
__security: { bearerAuth: true },
|
|
5137
6854
|
});
|
|
5138
6855
|
}
|
|
5139
6856
|
/**
|
|
@@ -5146,6 +6863,7 @@ class Assistants extends APIResource {
|
|
|
5146
6863
|
query,
|
|
5147
6864
|
...options,
|
|
5148
6865
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6866
|
+
__security: { bearerAuth: true },
|
|
5149
6867
|
});
|
|
5150
6868
|
}
|
|
5151
6869
|
/**
|
|
@@ -5157,6 +6875,7 @@ class Assistants extends APIResource {
|
|
|
5157
6875
|
return this._client.delete(path `/assistants/${assistantID}`, {
|
|
5158
6876
|
...options,
|
|
5159
6877
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6878
|
+
__security: { bearerAuth: true },
|
|
5160
6879
|
});
|
|
5161
6880
|
}
|
|
5162
6881
|
}
|
|
@@ -5183,6 +6902,7 @@ let Sessions$1 = class Sessions extends APIResource {
|
|
|
5183
6902
|
body,
|
|
5184
6903
|
...options,
|
|
5185
6904
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6905
|
+
__security: { bearerAuth: true },
|
|
5186
6906
|
});
|
|
5187
6907
|
}
|
|
5188
6908
|
};
|
|
@@ -5209,6 +6929,7 @@ class TranscriptionSessions extends APIResource {
|
|
|
5209
6929
|
body,
|
|
5210
6930
|
...options,
|
|
5211
6931
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6932
|
+
__security: { bearerAuth: true },
|
|
5212
6933
|
});
|
|
5213
6934
|
}
|
|
5214
6935
|
}
|
|
@@ -5246,6 +6967,7 @@ class Sessions extends APIResource {
|
|
|
5246
6967
|
body,
|
|
5247
6968
|
...options,
|
|
5248
6969
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
6970
|
+
__security: { bearerAuth: true },
|
|
5249
6971
|
});
|
|
5250
6972
|
}
|
|
5251
6973
|
/**
|
|
@@ -5263,6 +6985,7 @@ class Sessions extends APIResource {
|
|
|
5263
6985
|
return this._client.post(path `/chatkit/sessions/${sessionID}/cancel`, {
|
|
5264
6986
|
...options,
|
|
5265
6987
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
6988
|
+
__security: { bearerAuth: true },
|
|
5266
6989
|
});
|
|
5267
6990
|
}
|
|
5268
6991
|
}
|
|
@@ -5282,6 +7005,7 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
5282
7005
|
return this._client.get(path `/chatkit/threads/${threadID}`, {
|
|
5283
7006
|
...options,
|
|
5284
7007
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
7008
|
+
__security: { bearerAuth: true },
|
|
5285
7009
|
});
|
|
5286
7010
|
}
|
|
5287
7011
|
/**
|
|
@@ -5300,6 +7024,7 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
5300
7024
|
query,
|
|
5301
7025
|
...options,
|
|
5302
7026
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
7027
|
+
__security: { bearerAuth: true },
|
|
5303
7028
|
});
|
|
5304
7029
|
}
|
|
5305
7030
|
/**
|
|
@@ -5316,6 +7041,7 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
5316
7041
|
return this._client.delete(path `/chatkit/threads/${threadID}`, {
|
|
5317
7042
|
...options,
|
|
5318
7043
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
7044
|
+
__security: { bearerAuth: true },
|
|
5319
7045
|
});
|
|
5320
7046
|
}
|
|
5321
7047
|
/**
|
|
@@ -5332,7 +7058,12 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
5332
7058
|
* ```
|
|
5333
7059
|
*/
|
|
5334
7060
|
listItems(threadID, query = {}, options) {
|
|
5335
|
-
return this._client.getAPIList(path `/chatkit/threads/${threadID}/items`, (ConversationCursorPage), {
|
|
7061
|
+
return this._client.getAPIList(path `/chatkit/threads/${threadID}/items`, (ConversationCursorPage), {
|
|
7062
|
+
query,
|
|
7063
|
+
...options,
|
|
7064
|
+
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
7065
|
+
__security: { bearerAuth: true },
|
|
7066
|
+
});
|
|
5336
7067
|
}
|
|
5337
7068
|
};
|
|
5338
7069
|
|
|
@@ -5364,6 +7095,7 @@ class Messages extends APIResource {
|
|
|
5364
7095
|
body,
|
|
5365
7096
|
...options,
|
|
5366
7097
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7098
|
+
__security: { bearerAuth: true },
|
|
5367
7099
|
});
|
|
5368
7100
|
}
|
|
5369
7101
|
/**
|
|
@@ -5376,6 +7108,7 @@ class Messages extends APIResource {
|
|
|
5376
7108
|
return this._client.get(path `/threads/${thread_id}/messages/${messageID}`, {
|
|
5377
7109
|
...options,
|
|
5378
7110
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7111
|
+
__security: { bearerAuth: true },
|
|
5379
7112
|
});
|
|
5380
7113
|
}
|
|
5381
7114
|
/**
|
|
@@ -5389,6 +7122,7 @@ class Messages extends APIResource {
|
|
|
5389
7122
|
body,
|
|
5390
7123
|
...options,
|
|
5391
7124
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7125
|
+
__security: { bearerAuth: true },
|
|
5392
7126
|
});
|
|
5393
7127
|
}
|
|
5394
7128
|
/**
|
|
@@ -5401,6 +7135,7 @@ class Messages extends APIResource {
|
|
|
5401
7135
|
query,
|
|
5402
7136
|
...options,
|
|
5403
7137
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7138
|
+
__security: { bearerAuth: true },
|
|
5404
7139
|
});
|
|
5405
7140
|
}
|
|
5406
7141
|
/**
|
|
@@ -5413,6 +7148,7 @@ class Messages extends APIResource {
|
|
|
5413
7148
|
return this._client.delete(path `/threads/${thread_id}/messages/${messageID}`, {
|
|
5414
7149
|
...options,
|
|
5415
7150
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7151
|
+
__security: { bearerAuth: true },
|
|
5416
7152
|
});
|
|
5417
7153
|
}
|
|
5418
7154
|
}
|
|
@@ -5435,6 +7171,7 @@ class Steps extends APIResource {
|
|
|
5435
7171
|
query,
|
|
5436
7172
|
...options,
|
|
5437
7173
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7174
|
+
__security: { bearerAuth: true },
|
|
5438
7175
|
});
|
|
5439
7176
|
}
|
|
5440
7177
|
/**
|
|
@@ -5448,6 +7185,7 @@ class Steps extends APIResource {
|
|
|
5448
7185
|
query,
|
|
5449
7186
|
...options,
|
|
5450
7187
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7188
|
+
__security: { bearerAuth: true },
|
|
5451
7189
|
});
|
|
5452
7190
|
}
|
|
5453
7191
|
}
|
|
@@ -6051,6 +7789,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
6051
7789
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6052
7790
|
stream: params.stream ?? false,
|
|
6053
7791
|
__synthesizeEventData: true,
|
|
7792
|
+
__security: { bearerAuth: true },
|
|
6054
7793
|
});
|
|
6055
7794
|
}
|
|
6056
7795
|
/**
|
|
@@ -6063,6 +7802,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
6063
7802
|
return this._client.get(path `/threads/${thread_id}/runs/${runID}`, {
|
|
6064
7803
|
...options,
|
|
6065
7804
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7805
|
+
__security: { bearerAuth: true },
|
|
6066
7806
|
});
|
|
6067
7807
|
}
|
|
6068
7808
|
/**
|
|
@@ -6076,6 +7816,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
6076
7816
|
body,
|
|
6077
7817
|
...options,
|
|
6078
7818
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7819
|
+
__security: { bearerAuth: true },
|
|
6079
7820
|
});
|
|
6080
7821
|
}
|
|
6081
7822
|
/**
|
|
@@ -6088,6 +7829,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
6088
7829
|
query,
|
|
6089
7830
|
...options,
|
|
6090
7831
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7832
|
+
__security: { bearerAuth: true },
|
|
6091
7833
|
});
|
|
6092
7834
|
}
|
|
6093
7835
|
/**
|
|
@@ -6100,6 +7842,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
6100
7842
|
return this._client.post(path `/threads/${thread_id}/runs/${runID}/cancel`, {
|
|
6101
7843
|
...options,
|
|
6102
7844
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7845
|
+
__security: { bearerAuth: true },
|
|
6103
7846
|
});
|
|
6104
7847
|
}
|
|
6105
7848
|
/**
|
|
@@ -6182,6 +7925,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
6182
7925
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6183
7926
|
stream: params.stream ?? false,
|
|
6184
7927
|
__synthesizeEventData: true,
|
|
7928
|
+
__security: { bearerAuth: true },
|
|
6185
7929
|
});
|
|
6186
7930
|
}
|
|
6187
7931
|
/**
|
|
@@ -6226,6 +7970,7 @@ class Threads extends APIResource {
|
|
|
6226
7970
|
body,
|
|
6227
7971
|
...options,
|
|
6228
7972
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7973
|
+
__security: { bearerAuth: true },
|
|
6229
7974
|
});
|
|
6230
7975
|
}
|
|
6231
7976
|
/**
|
|
@@ -6237,6 +7982,7 @@ class Threads extends APIResource {
|
|
|
6237
7982
|
return this._client.get(path `/threads/${threadID}`, {
|
|
6238
7983
|
...options,
|
|
6239
7984
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7985
|
+
__security: { bearerAuth: true },
|
|
6240
7986
|
});
|
|
6241
7987
|
}
|
|
6242
7988
|
/**
|
|
@@ -6249,6 +7995,7 @@ class Threads extends APIResource {
|
|
|
6249
7995
|
body,
|
|
6250
7996
|
...options,
|
|
6251
7997
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7998
|
+
__security: { bearerAuth: true },
|
|
6252
7999
|
});
|
|
6253
8000
|
}
|
|
6254
8001
|
/**
|
|
@@ -6260,6 +8007,7 @@ class Threads extends APIResource {
|
|
|
6260
8007
|
return this._client.delete(path `/threads/${threadID}`, {
|
|
6261
8008
|
...options,
|
|
6262
8009
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8010
|
+
__security: { bearerAuth: true },
|
|
6263
8011
|
});
|
|
6264
8012
|
}
|
|
6265
8013
|
createAndRun(body, options) {
|
|
@@ -6269,6 +8017,7 @@ class Threads extends APIResource {
|
|
|
6269
8017
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6270
8018
|
stream: body.stream ?? false,
|
|
6271
8019
|
__synthesizeEventData: true,
|
|
8020
|
+
__security: { bearerAuth: true },
|
|
6272
8021
|
});
|
|
6273
8022
|
}
|
|
6274
8023
|
/**
|
|
@@ -6311,7 +8060,12 @@ Beta.Threads = Threads;
|
|
|
6311
8060
|
*/
|
|
6312
8061
|
class Completions extends APIResource {
|
|
6313
8062
|
create(body, options) {
|
|
6314
|
-
return this._client.post('/completions', {
|
|
8063
|
+
return this._client.post('/completions', {
|
|
8064
|
+
body,
|
|
8065
|
+
...options,
|
|
8066
|
+
stream: body.stream ?? false,
|
|
8067
|
+
__security: { bearerAuth: true },
|
|
8068
|
+
});
|
|
6315
8069
|
}
|
|
6316
8070
|
}
|
|
6317
8071
|
|
|
@@ -6325,6 +8079,7 @@ let Content$2 = class Content extends APIResource {
|
|
|
6325
8079
|
return this._client.get(path `/containers/${container_id}/files/${fileID}/content`, {
|
|
6326
8080
|
...options,
|
|
6327
8081
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
8082
|
+
__security: { bearerAuth: true },
|
|
6328
8083
|
__binaryResponse: true,
|
|
6329
8084
|
});
|
|
6330
8085
|
}
|
|
@@ -6343,14 +8098,17 @@ let Files$2 = class Files extends APIResource {
|
|
|
6343
8098
|
* a JSON request with a file ID.
|
|
6344
8099
|
*/
|
|
6345
8100
|
create(containerID, body, options) {
|
|
6346
|
-
return this._client.post(path `/containers/${containerID}/files`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
8101
|
+
return this._client.post(path `/containers/${containerID}/files`, maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
6347
8102
|
}
|
|
6348
8103
|
/**
|
|
6349
8104
|
* Retrieve Container File
|
|
6350
8105
|
*/
|
|
6351
8106
|
retrieve(fileID, params, options) {
|
|
6352
8107
|
const { container_id } = params;
|
|
6353
|
-
return this._client.get(path `/containers/${container_id}/files/${fileID}`,
|
|
8108
|
+
return this._client.get(path `/containers/${container_id}/files/${fileID}`, {
|
|
8109
|
+
...options,
|
|
8110
|
+
__security: { bearerAuth: true },
|
|
8111
|
+
});
|
|
6354
8112
|
}
|
|
6355
8113
|
/**
|
|
6356
8114
|
* List Container files
|
|
@@ -6359,6 +8117,7 @@ let Files$2 = class Files extends APIResource {
|
|
|
6359
8117
|
return this._client.getAPIList(path `/containers/${containerID}/files`, (CursorPage), {
|
|
6360
8118
|
query,
|
|
6361
8119
|
...options,
|
|
8120
|
+
__security: { bearerAuth: true },
|
|
6362
8121
|
});
|
|
6363
8122
|
}
|
|
6364
8123
|
/**
|
|
@@ -6369,6 +8128,7 @@ let Files$2 = class Files extends APIResource {
|
|
|
6369
8128
|
return this._client.delete(path `/containers/${container_id}/files/${fileID}`, {
|
|
6370
8129
|
...options,
|
|
6371
8130
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
8131
|
+
__security: { bearerAuth: true },
|
|
6372
8132
|
});
|
|
6373
8133
|
}
|
|
6374
8134
|
};
|
|
@@ -6384,19 +8144,26 @@ class Containers extends APIResource {
|
|
|
6384
8144
|
* Create Container
|
|
6385
8145
|
*/
|
|
6386
8146
|
create(body, options) {
|
|
6387
|
-
return this._client.post('/containers', { body, ...options });
|
|
8147
|
+
return this._client.post('/containers', { body, ...options, __security: { bearerAuth: true } });
|
|
6388
8148
|
}
|
|
6389
8149
|
/**
|
|
6390
8150
|
* Retrieve Container
|
|
6391
8151
|
*/
|
|
6392
8152
|
retrieve(containerID, options) {
|
|
6393
|
-
return this._client.get(path `/containers/${containerID}`,
|
|
8153
|
+
return this._client.get(path `/containers/${containerID}`, {
|
|
8154
|
+
...options,
|
|
8155
|
+
__security: { bearerAuth: true },
|
|
8156
|
+
});
|
|
6394
8157
|
}
|
|
6395
8158
|
/**
|
|
6396
8159
|
* List Containers
|
|
6397
8160
|
*/
|
|
6398
8161
|
list(query = {}, options) {
|
|
6399
|
-
return this._client.getAPIList('/containers', (CursorPage), {
|
|
8162
|
+
return this._client.getAPIList('/containers', (CursorPage), {
|
|
8163
|
+
query,
|
|
8164
|
+
...options,
|
|
8165
|
+
__security: { bearerAuth: true },
|
|
8166
|
+
});
|
|
6400
8167
|
}
|
|
6401
8168
|
/**
|
|
6402
8169
|
* Delete Container
|
|
@@ -6405,6 +8172,7 @@ class Containers extends APIResource {
|
|
|
6405
8172
|
return this._client.delete(path `/containers/${containerID}`, {
|
|
6406
8173
|
...options,
|
|
6407
8174
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
8175
|
+
__security: { bearerAuth: true },
|
|
6408
8176
|
});
|
|
6409
8177
|
}
|
|
6410
8178
|
}
|
|
@@ -6424,6 +8192,7 @@ class Items extends APIResource {
|
|
|
6424
8192
|
query: { include },
|
|
6425
8193
|
body,
|
|
6426
8194
|
...options,
|
|
8195
|
+
__security: { bearerAuth: true },
|
|
6427
8196
|
});
|
|
6428
8197
|
}
|
|
6429
8198
|
/**
|
|
@@ -6431,20 +8200,27 @@ class Items extends APIResource {
|
|
|
6431
8200
|
*/
|
|
6432
8201
|
retrieve(itemID, params, options) {
|
|
6433
8202
|
const { conversation_id, ...query } = params;
|
|
6434
|
-
return this._client.get(path `/conversations/${conversation_id}/items/${itemID}`, {
|
|
8203
|
+
return this._client.get(path `/conversations/${conversation_id}/items/${itemID}`, {
|
|
8204
|
+
query,
|
|
8205
|
+
...options,
|
|
8206
|
+
__security: { bearerAuth: true },
|
|
8207
|
+
});
|
|
6435
8208
|
}
|
|
6436
8209
|
/**
|
|
6437
8210
|
* List all items for a conversation with the given ID.
|
|
6438
8211
|
*/
|
|
6439
8212
|
list(conversationID, query = {}, options) {
|
|
6440
|
-
return this._client.getAPIList(path `/conversations/${conversationID}/items`, (ConversationCursorPage), { query, ...options });
|
|
8213
|
+
return this._client.getAPIList(path `/conversations/${conversationID}/items`, (ConversationCursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
6441
8214
|
}
|
|
6442
8215
|
/**
|
|
6443
8216
|
* Delete an item from a conversation with the given IDs.
|
|
6444
8217
|
*/
|
|
6445
8218
|
delete(itemID, params, options) {
|
|
6446
8219
|
const { conversation_id } = params;
|
|
6447
|
-
return this._client.delete(path `/conversations/${conversation_id}/items/${itemID}`,
|
|
8220
|
+
return this._client.delete(path `/conversations/${conversation_id}/items/${itemID}`, {
|
|
8221
|
+
...options,
|
|
8222
|
+
__security: { bearerAuth: true },
|
|
8223
|
+
});
|
|
6448
8224
|
}
|
|
6449
8225
|
}
|
|
6450
8226
|
|
|
@@ -6461,25 +8237,35 @@ class Conversations extends APIResource {
|
|
|
6461
8237
|
* Create a conversation.
|
|
6462
8238
|
*/
|
|
6463
8239
|
create(body = {}, options) {
|
|
6464
|
-
return this._client.post('/conversations', { body, ...options });
|
|
8240
|
+
return this._client.post('/conversations', { body, ...options, __security: { bearerAuth: true } });
|
|
6465
8241
|
}
|
|
6466
8242
|
/**
|
|
6467
8243
|
* Get a conversation
|
|
6468
8244
|
*/
|
|
6469
8245
|
retrieve(conversationID, options) {
|
|
6470
|
-
return this._client.get(path `/conversations/${conversationID}`,
|
|
8246
|
+
return this._client.get(path `/conversations/${conversationID}`, {
|
|
8247
|
+
...options,
|
|
8248
|
+
__security: { bearerAuth: true },
|
|
8249
|
+
});
|
|
6471
8250
|
}
|
|
6472
8251
|
/**
|
|
6473
8252
|
* Update a conversation
|
|
6474
8253
|
*/
|
|
6475
8254
|
update(conversationID, body, options) {
|
|
6476
|
-
return this._client.post(path `/conversations/${conversationID}`, {
|
|
8255
|
+
return this._client.post(path `/conversations/${conversationID}`, {
|
|
8256
|
+
body,
|
|
8257
|
+
...options,
|
|
8258
|
+
__security: { bearerAuth: true },
|
|
8259
|
+
});
|
|
6477
8260
|
}
|
|
6478
8261
|
/**
|
|
6479
8262
|
* Delete a conversation. Items in the conversation will not be deleted.
|
|
6480
8263
|
*/
|
|
6481
8264
|
delete(conversationID, options) {
|
|
6482
|
-
return this._client.delete(path `/conversations/${conversationID}`,
|
|
8265
|
+
return this._client.delete(path `/conversations/${conversationID}`, {
|
|
8266
|
+
...options,
|
|
8267
|
+
__security: { bearerAuth: true },
|
|
8268
|
+
});
|
|
6483
8269
|
}
|
|
6484
8270
|
}
|
|
6485
8271
|
Conversations.Items = Items;
|
|
@@ -6515,6 +8301,7 @@ class Embeddings extends APIResource {
|
|
|
6515
8301
|
encoding_format: encoding_format,
|
|
6516
8302
|
},
|
|
6517
8303
|
...options,
|
|
8304
|
+
__security: { bearerAuth: true },
|
|
6518
8305
|
});
|
|
6519
8306
|
// if the user specified an encoding_format, return the response as-is
|
|
6520
8307
|
if (hasUserProvidedEncodingFormat) {
|
|
@@ -6547,14 +8334,17 @@ class OutputItems extends APIResource {
|
|
|
6547
8334
|
*/
|
|
6548
8335
|
retrieve(outputItemID, params, options) {
|
|
6549
8336
|
const { eval_id, run_id } = params;
|
|
6550
|
-
return this._client.get(path `/evals/${eval_id}/runs/${run_id}/output_items/${outputItemID}`,
|
|
8337
|
+
return this._client.get(path `/evals/${eval_id}/runs/${run_id}/output_items/${outputItemID}`, {
|
|
8338
|
+
...options,
|
|
8339
|
+
__security: { bearerAuth: true },
|
|
8340
|
+
});
|
|
6551
8341
|
}
|
|
6552
8342
|
/**
|
|
6553
8343
|
* Get a list of output items for an evaluation run.
|
|
6554
8344
|
*/
|
|
6555
8345
|
list(runID, params, options) {
|
|
6556
8346
|
const { eval_id, ...query } = params;
|
|
6557
|
-
return this._client.getAPIList(path `/evals/${eval_id}/runs/${runID}/output_items`, (CursorPage), { query, ...options });
|
|
8347
|
+
return this._client.getAPIList(path `/evals/${eval_id}/runs/${runID}/output_items`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
6558
8348
|
}
|
|
6559
8349
|
}
|
|
6560
8350
|
|
|
@@ -6573,14 +8363,21 @@ class Runs extends APIResource {
|
|
|
6573
8363
|
* schema specified in the config of the evaluation.
|
|
6574
8364
|
*/
|
|
6575
8365
|
create(evalID, body, options) {
|
|
6576
|
-
return this._client.post(path `/evals/${evalID}/runs`, {
|
|
8366
|
+
return this._client.post(path `/evals/${evalID}/runs`, {
|
|
8367
|
+
body,
|
|
8368
|
+
...options,
|
|
8369
|
+
__security: { bearerAuth: true },
|
|
8370
|
+
});
|
|
6577
8371
|
}
|
|
6578
8372
|
/**
|
|
6579
8373
|
* Get an evaluation run by ID.
|
|
6580
8374
|
*/
|
|
6581
8375
|
retrieve(runID, params, options) {
|
|
6582
8376
|
const { eval_id } = params;
|
|
6583
|
-
return this._client.get(path `/evals/${eval_id}/runs/${runID}`,
|
|
8377
|
+
return this._client.get(path `/evals/${eval_id}/runs/${runID}`, {
|
|
8378
|
+
...options,
|
|
8379
|
+
__security: { bearerAuth: true },
|
|
8380
|
+
});
|
|
6584
8381
|
}
|
|
6585
8382
|
/**
|
|
6586
8383
|
* Get a list of runs for an evaluation.
|
|
@@ -6589,6 +8386,7 @@ class Runs extends APIResource {
|
|
|
6589
8386
|
return this._client.getAPIList(path `/evals/${evalID}/runs`, (CursorPage), {
|
|
6590
8387
|
query,
|
|
6591
8388
|
...options,
|
|
8389
|
+
__security: { bearerAuth: true },
|
|
6592
8390
|
});
|
|
6593
8391
|
}
|
|
6594
8392
|
/**
|
|
@@ -6596,14 +8394,20 @@ class Runs extends APIResource {
|
|
|
6596
8394
|
*/
|
|
6597
8395
|
delete(runID, params, options) {
|
|
6598
8396
|
const { eval_id } = params;
|
|
6599
|
-
return this._client.delete(path `/evals/${eval_id}/runs/${runID}`,
|
|
8397
|
+
return this._client.delete(path `/evals/${eval_id}/runs/${runID}`, {
|
|
8398
|
+
...options,
|
|
8399
|
+
__security: { bearerAuth: true },
|
|
8400
|
+
});
|
|
6600
8401
|
}
|
|
6601
8402
|
/**
|
|
6602
8403
|
* Cancel an ongoing evaluation run.
|
|
6603
8404
|
*/
|
|
6604
8405
|
cancel(runID, params, options) {
|
|
6605
8406
|
const { eval_id } = params;
|
|
6606
|
-
return this._client.post(path `/evals/${eval_id}/runs/${runID}`,
|
|
8407
|
+
return this._client.post(path `/evals/${eval_id}/runs/${runID}`, {
|
|
8408
|
+
...options,
|
|
8409
|
+
__security: { bearerAuth: true },
|
|
8410
|
+
});
|
|
6607
8411
|
}
|
|
6608
8412
|
}
|
|
6609
8413
|
Runs.OutputItems = OutputItems;
|
|
@@ -6626,31 +8430,35 @@ class Evals extends APIResource {
|
|
|
6626
8430
|
* the [Evals guide](https://platform.openai.com/docs/guides/evals).
|
|
6627
8431
|
*/
|
|
6628
8432
|
create(body, options) {
|
|
6629
|
-
return this._client.post('/evals', { body, ...options });
|
|
8433
|
+
return this._client.post('/evals', { body, ...options, __security: { bearerAuth: true } });
|
|
6630
8434
|
}
|
|
6631
8435
|
/**
|
|
6632
8436
|
* Get an evaluation by ID.
|
|
6633
8437
|
*/
|
|
6634
8438
|
retrieve(evalID, options) {
|
|
6635
|
-
return this._client.get(path `/evals/${evalID}`, options);
|
|
8439
|
+
return this._client.get(path `/evals/${evalID}`, { ...options, __security: { bearerAuth: true } });
|
|
6636
8440
|
}
|
|
6637
8441
|
/**
|
|
6638
8442
|
* Update certain properties of an evaluation.
|
|
6639
8443
|
*/
|
|
6640
8444
|
update(evalID, body, options) {
|
|
6641
|
-
return this._client.post(path `/evals/${evalID}`, { body, ...options });
|
|
8445
|
+
return this._client.post(path `/evals/${evalID}`, { body, ...options, __security: { bearerAuth: true } });
|
|
6642
8446
|
}
|
|
6643
8447
|
/**
|
|
6644
8448
|
* List evaluations for a project.
|
|
6645
8449
|
*/
|
|
6646
8450
|
list(query = {}, options) {
|
|
6647
|
-
return this._client.getAPIList('/evals', (CursorPage), {
|
|
8451
|
+
return this._client.getAPIList('/evals', (CursorPage), {
|
|
8452
|
+
query,
|
|
8453
|
+
...options,
|
|
8454
|
+
__security: { bearerAuth: true },
|
|
8455
|
+
});
|
|
6648
8456
|
}
|
|
6649
8457
|
/**
|
|
6650
8458
|
* Delete an evaluation.
|
|
6651
8459
|
*/
|
|
6652
8460
|
delete(evalID, options) {
|
|
6653
|
-
return this._client.delete(path `/evals/${evalID}`, options);
|
|
8461
|
+
return this._client.delete(path `/evals/${evalID}`, { ...options, __security: { bearerAuth: true } });
|
|
6654
8462
|
}
|
|
6655
8463
|
}
|
|
6656
8464
|
Evals.Runs = Runs;
|
|
@@ -6663,7 +8471,8 @@ let Files$1 = class Files extends APIResource {
|
|
|
6663
8471
|
/**
|
|
6664
8472
|
* Upload a file that can be used across various endpoints. Individual files can be
|
|
6665
8473
|
* up to 512 MB, and each project can store up to 2.5 TB of files in total. There
|
|
6666
|
-
* is no organization-wide storage limit.
|
|
8474
|
+
* is no organization-wide storage limit. Uploads to this endpoint are rate-limited
|
|
8475
|
+
* to 1,000 requests per minute per authenticated user.
|
|
6667
8476
|
*
|
|
6668
8477
|
* - The Assistants API supports files up to 2 million tokens and of specific file
|
|
6669
8478
|
* types. See the
|
|
@@ -6678,30 +8487,40 @@ let Files$1 = class Files extends APIResource {
|
|
|
6678
8487
|
* - The Batch API only supports `.jsonl` files up to 200 MB in size. The input
|
|
6679
8488
|
* also has a specific required
|
|
6680
8489
|
* [format](https://platform.openai.com/docs/api-reference/batch/request-input).
|
|
8490
|
+
* - For Retrieval or `file_search` ingestion, upload files here first. If you need
|
|
8491
|
+
* to attach multiple uploaded files to the same vector store, use
|
|
8492
|
+
* [`/vector_stores/{vector_store_id}/file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch)
|
|
8493
|
+
* instead of attaching them one by one. Vector store attachment has separate
|
|
8494
|
+
* limits from file upload, including 2,000 attached files per minute per
|
|
8495
|
+
* organization.
|
|
6681
8496
|
*
|
|
6682
8497
|
* Please [contact us](https://help.openai.com/) if you need to increase these
|
|
6683
8498
|
* storage limits.
|
|
6684
8499
|
*/
|
|
6685
8500
|
create(body, options) {
|
|
6686
|
-
return this._client.post('/files', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
8501
|
+
return this._client.post('/files', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
6687
8502
|
}
|
|
6688
8503
|
/**
|
|
6689
8504
|
* Returns information about a specific file.
|
|
6690
8505
|
*/
|
|
6691
8506
|
retrieve(fileID, options) {
|
|
6692
|
-
return this._client.get(path `/files/${fileID}`, options);
|
|
8507
|
+
return this._client.get(path `/files/${fileID}`, { ...options, __security: { bearerAuth: true } });
|
|
6693
8508
|
}
|
|
6694
8509
|
/**
|
|
6695
8510
|
* Returns a list of files.
|
|
6696
8511
|
*/
|
|
6697
8512
|
list(query = {}, options) {
|
|
6698
|
-
return this._client.getAPIList('/files', (CursorPage), {
|
|
8513
|
+
return this._client.getAPIList('/files', (CursorPage), {
|
|
8514
|
+
query,
|
|
8515
|
+
...options,
|
|
8516
|
+
__security: { bearerAuth: true },
|
|
8517
|
+
});
|
|
6699
8518
|
}
|
|
6700
8519
|
/**
|
|
6701
8520
|
* Delete a file and remove it from all vector stores.
|
|
6702
8521
|
*/
|
|
6703
8522
|
delete(fileID, options) {
|
|
6704
|
-
return this._client.delete(path `/files/${fileID}`, options);
|
|
8523
|
+
return this._client.delete(path `/files/${fileID}`, { ...options, __security: { bearerAuth: true } });
|
|
6705
8524
|
}
|
|
6706
8525
|
/**
|
|
6707
8526
|
* Returns the contents of the specified file.
|
|
@@ -6710,6 +8529,7 @@ let Files$1 = class Files extends APIResource {
|
|
|
6710
8529
|
return this._client.get(path `/files/${fileID}/content`, {
|
|
6711
8530
|
...options,
|
|
6712
8531
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
8532
|
+
__security: { bearerAuth: true },
|
|
6713
8533
|
__binaryResponse: true,
|
|
6714
8534
|
});
|
|
6715
8535
|
}
|
|
@@ -6760,7 +8580,11 @@ let Graders$1 = class Graders extends APIResource {
|
|
|
6760
8580
|
* ```
|
|
6761
8581
|
*/
|
|
6762
8582
|
run(body, options) {
|
|
6763
|
-
return this._client.post('/fine_tuning/alpha/graders/run', {
|
|
8583
|
+
return this._client.post('/fine_tuning/alpha/graders/run', {
|
|
8584
|
+
body,
|
|
8585
|
+
...options,
|
|
8586
|
+
__security: { bearerAuth: true },
|
|
8587
|
+
});
|
|
6764
8588
|
}
|
|
6765
8589
|
/**
|
|
6766
8590
|
* Validate a grader.
|
|
@@ -6780,7 +8604,11 @@ let Graders$1 = class Graders extends APIResource {
|
|
|
6780
8604
|
* ```
|
|
6781
8605
|
*/
|
|
6782
8606
|
validate(body, options) {
|
|
6783
|
-
return this._client.post('/fine_tuning/alpha/graders/validate', {
|
|
8607
|
+
return this._client.post('/fine_tuning/alpha/graders/validate', {
|
|
8608
|
+
body,
|
|
8609
|
+
...options,
|
|
8610
|
+
__security: { bearerAuth: true },
|
|
8611
|
+
});
|
|
6784
8612
|
}
|
|
6785
8613
|
};
|
|
6786
8614
|
|
|
@@ -6816,7 +8644,7 @@ class Permissions extends APIResource {
|
|
|
6816
8644
|
* ```
|
|
6817
8645
|
*/
|
|
6818
8646
|
create(fineTunedModelCheckpoint, body, options) {
|
|
6819
|
-
return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (Page), { body, method: 'post', ...options });
|
|
8647
|
+
return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (Page), { body, method: 'post', ...options, __security: { adminAPIKeyAuth: true } });
|
|
6820
8648
|
}
|
|
6821
8649
|
/**
|
|
6822
8650
|
* **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
|
|
@@ -6830,6 +8658,7 @@ class Permissions extends APIResource {
|
|
|
6830
8658
|
return this._client.get(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, {
|
|
6831
8659
|
query,
|
|
6832
8660
|
...options,
|
|
8661
|
+
__security: { adminAPIKeyAuth: true },
|
|
6833
8662
|
});
|
|
6834
8663
|
}
|
|
6835
8664
|
/**
|
|
@@ -6849,7 +8678,7 @@ class Permissions extends APIResource {
|
|
|
6849
8678
|
* ```
|
|
6850
8679
|
*/
|
|
6851
8680
|
list(fineTunedModelCheckpoint, query = {}, options) {
|
|
6852
|
-
return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (ConversationCursorPage), { query, ...options });
|
|
8681
|
+
return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
6853
8682
|
}
|
|
6854
8683
|
/**
|
|
6855
8684
|
* **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
|
|
@@ -6871,7 +8700,7 @@ class Permissions extends APIResource {
|
|
|
6871
8700
|
*/
|
|
6872
8701
|
delete(permissionID, params, options) {
|
|
6873
8702
|
const { fine_tuned_model_checkpoint } = params;
|
|
6874
|
-
return this._client.delete(path `/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, options);
|
|
8703
|
+
return this._client.delete(path `/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, { ...options, __security: { adminAPIKeyAuth: true } });
|
|
6875
8704
|
}
|
|
6876
8705
|
}
|
|
6877
8706
|
|
|
@@ -6903,7 +8732,7 @@ class Checkpoints extends APIResource {
|
|
|
6903
8732
|
* ```
|
|
6904
8733
|
*/
|
|
6905
8734
|
list(fineTuningJobID, query = {}, options) {
|
|
6906
|
-
return this._client.getAPIList(path `/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, (CursorPage), { query, ...options });
|
|
8735
|
+
return this._client.getAPIList(path `/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
6907
8736
|
}
|
|
6908
8737
|
}
|
|
6909
8738
|
|
|
@@ -6934,7 +8763,7 @@ class Jobs extends APIResource {
|
|
|
6934
8763
|
* ```
|
|
6935
8764
|
*/
|
|
6936
8765
|
create(body, options) {
|
|
6937
|
-
return this._client.post('/fine_tuning/jobs', { body, ...options });
|
|
8766
|
+
return this._client.post('/fine_tuning/jobs', { body, ...options, __security: { bearerAuth: true } });
|
|
6938
8767
|
}
|
|
6939
8768
|
/**
|
|
6940
8769
|
* Get info about a fine-tuning job.
|
|
@@ -6949,7 +8778,10 @@ class Jobs extends APIResource {
|
|
|
6949
8778
|
* ```
|
|
6950
8779
|
*/
|
|
6951
8780
|
retrieve(fineTuningJobID, options) {
|
|
6952
|
-
return this._client.get(path `/fine_tuning/jobs/${fineTuningJobID}`,
|
|
8781
|
+
return this._client.get(path `/fine_tuning/jobs/${fineTuningJobID}`, {
|
|
8782
|
+
...options,
|
|
8783
|
+
__security: { bearerAuth: true },
|
|
8784
|
+
});
|
|
6953
8785
|
}
|
|
6954
8786
|
/**
|
|
6955
8787
|
* List your organization's fine-tuning jobs
|
|
@@ -6963,7 +8795,11 @@ class Jobs extends APIResource {
|
|
|
6963
8795
|
* ```
|
|
6964
8796
|
*/
|
|
6965
8797
|
list(query = {}, options) {
|
|
6966
|
-
return this._client.getAPIList('/fine_tuning/jobs', (CursorPage), {
|
|
8798
|
+
return this._client.getAPIList('/fine_tuning/jobs', (CursorPage), {
|
|
8799
|
+
query,
|
|
8800
|
+
...options,
|
|
8801
|
+
__security: { bearerAuth: true },
|
|
8802
|
+
});
|
|
6967
8803
|
}
|
|
6968
8804
|
/**
|
|
6969
8805
|
* Immediately cancel a fine-tune job.
|
|
@@ -6976,7 +8812,10 @@ class Jobs extends APIResource {
|
|
|
6976
8812
|
* ```
|
|
6977
8813
|
*/
|
|
6978
8814
|
cancel(fineTuningJobID, options) {
|
|
6979
|
-
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/cancel`,
|
|
8815
|
+
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/cancel`, {
|
|
8816
|
+
...options,
|
|
8817
|
+
__security: { bearerAuth: true },
|
|
8818
|
+
});
|
|
6980
8819
|
}
|
|
6981
8820
|
/**
|
|
6982
8821
|
* Get status updates for a fine-tuning job.
|
|
@@ -6992,7 +8831,7 @@ class Jobs extends APIResource {
|
|
|
6992
8831
|
* ```
|
|
6993
8832
|
*/
|
|
6994
8833
|
listEvents(fineTuningJobID, query = {}, options) {
|
|
6995
|
-
return this._client.getAPIList(path `/fine_tuning/jobs/${fineTuningJobID}/events`, (CursorPage), { query, ...options });
|
|
8834
|
+
return this._client.getAPIList(path `/fine_tuning/jobs/${fineTuningJobID}/events`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
6996
8835
|
}
|
|
6997
8836
|
/**
|
|
6998
8837
|
* Pause a fine-tune job.
|
|
@@ -7005,7 +8844,10 @@ class Jobs extends APIResource {
|
|
|
7005
8844
|
* ```
|
|
7006
8845
|
*/
|
|
7007
8846
|
pause(fineTuningJobID, options) {
|
|
7008
|
-
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/pause`,
|
|
8847
|
+
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/pause`, {
|
|
8848
|
+
...options,
|
|
8849
|
+
__security: { bearerAuth: true },
|
|
8850
|
+
});
|
|
7009
8851
|
}
|
|
7010
8852
|
/**
|
|
7011
8853
|
* Resume a fine-tune job.
|
|
@@ -7018,7 +8860,10 @@ class Jobs extends APIResource {
|
|
|
7018
8860
|
* ```
|
|
7019
8861
|
*/
|
|
7020
8862
|
resume(fineTuningJobID, options) {
|
|
7021
|
-
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/resume`,
|
|
8863
|
+
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/resume`, {
|
|
8864
|
+
...options,
|
|
8865
|
+
__security: { bearerAuth: true },
|
|
8866
|
+
});
|
|
7022
8867
|
}
|
|
7023
8868
|
}
|
|
7024
8869
|
Jobs.Checkpoints = Checkpoints;
|
|
@@ -7067,13 +8912,18 @@ class Images extends APIResource {
|
|
|
7067
8912
|
* ```
|
|
7068
8913
|
*/
|
|
7069
8914
|
createVariation(body, options) {
|
|
7070
|
-
return this._client.post('/images/variations', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
8915
|
+
return this._client.post('/images/variations', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
7071
8916
|
}
|
|
7072
8917
|
edit(body, options) {
|
|
7073
|
-
return this._client.post('/images/edits', multipartFormRequestOptions({ body, ...options, stream: body.stream ?? false }, this._client));
|
|
8918
|
+
return this._client.post('/images/edits', multipartFormRequestOptions({ body, ...options, stream: body.stream ?? false, __security: { bearerAuth: true } }, this._client));
|
|
7074
8919
|
}
|
|
7075
8920
|
generate(body, options) {
|
|
7076
|
-
return this._client.post('/images/generations', {
|
|
8921
|
+
return this._client.post('/images/generations', {
|
|
8922
|
+
body,
|
|
8923
|
+
...options,
|
|
8924
|
+
stream: body.stream ?? false,
|
|
8925
|
+
__security: { bearerAuth: true },
|
|
8926
|
+
});
|
|
7077
8927
|
}
|
|
7078
8928
|
}
|
|
7079
8929
|
|
|
@@ -7087,21 +8937,21 @@ class Models extends APIResource {
|
|
|
7087
8937
|
* the owner and permissioning.
|
|
7088
8938
|
*/
|
|
7089
8939
|
retrieve(model, options) {
|
|
7090
|
-
return this._client.get(path `/models/${model}`, options);
|
|
8940
|
+
return this._client.get(path `/models/${model}`, { ...options, __security: { bearerAuth: true } });
|
|
7091
8941
|
}
|
|
7092
8942
|
/**
|
|
7093
8943
|
* Lists the currently available models, and provides basic information about each
|
|
7094
8944
|
* one such as the owner and availability.
|
|
7095
8945
|
*/
|
|
7096
8946
|
list(options) {
|
|
7097
|
-
return this._client.getAPIList('/models', (Page), options);
|
|
8947
|
+
return this._client.getAPIList('/models', (Page), { ...options, __security: { bearerAuth: true } });
|
|
7098
8948
|
}
|
|
7099
8949
|
/**
|
|
7100
8950
|
* Delete a fine-tuned model. You must have the Owner role in your organization to
|
|
7101
8951
|
* delete a model.
|
|
7102
8952
|
*/
|
|
7103
8953
|
delete(model, options) {
|
|
7104
|
-
return this._client.delete(path `/models/${model}`, options);
|
|
8954
|
+
return this._client.delete(path `/models/${model}`, { ...options, __security: { bearerAuth: true } });
|
|
7105
8955
|
}
|
|
7106
8956
|
}
|
|
7107
8957
|
|
|
@@ -7115,7 +8965,7 @@ class Moderations extends APIResource {
|
|
|
7115
8965
|
* the [moderation guide](https://platform.openai.com/docs/guides/moderation).
|
|
7116
8966
|
*/
|
|
7117
8967
|
create(body, options) {
|
|
7118
|
-
return this._client.post('/moderations', { body, ...options });
|
|
8968
|
+
return this._client.post('/moderations', { body, ...options, __security: { bearerAuth: true } });
|
|
7119
8969
|
}
|
|
7120
8970
|
}
|
|
7121
8971
|
|
|
@@ -7137,6 +8987,7 @@ class Calls extends APIResource {
|
|
|
7137
8987
|
body,
|
|
7138
8988
|
...options,
|
|
7139
8989
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
8990
|
+
__security: { bearerAuth: true },
|
|
7140
8991
|
});
|
|
7141
8992
|
}
|
|
7142
8993
|
/**
|
|
@@ -7151,6 +9002,7 @@ class Calls extends APIResource {
|
|
|
7151
9002
|
return this._client.post(path `/realtime/calls/${callID}/hangup`, {
|
|
7152
9003
|
...options,
|
|
7153
9004
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
9005
|
+
__security: { bearerAuth: true },
|
|
7154
9006
|
});
|
|
7155
9007
|
}
|
|
7156
9008
|
/**
|
|
@@ -7168,6 +9020,7 @@ class Calls extends APIResource {
|
|
|
7168
9020
|
body,
|
|
7169
9021
|
...options,
|
|
7170
9022
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
9023
|
+
__security: { bearerAuth: true },
|
|
7171
9024
|
});
|
|
7172
9025
|
}
|
|
7173
9026
|
/**
|
|
@@ -7183,6 +9036,7 @@ class Calls extends APIResource {
|
|
|
7183
9036
|
body,
|
|
7184
9037
|
...options,
|
|
7185
9038
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
9039
|
+
__security: { bearerAuth: true },
|
|
7186
9040
|
});
|
|
7187
9041
|
}
|
|
7188
9042
|
}
|
|
@@ -7213,7 +9067,11 @@ class ClientSecrets extends APIResource {
|
|
|
7213
9067
|
* ```
|
|
7214
9068
|
*/
|
|
7215
9069
|
create(body, options) {
|
|
7216
|
-
return this._client.post('/realtime/client_secrets', {
|
|
9070
|
+
return this._client.post('/realtime/client_secrets', {
|
|
9071
|
+
body,
|
|
9072
|
+
...options,
|
|
9073
|
+
__security: { bearerAuth: true },
|
|
9074
|
+
});
|
|
7217
9075
|
}
|
|
7218
9076
|
}
|
|
7219
9077
|
|
|
@@ -7624,7 +9482,7 @@ class InputItems extends APIResource {
|
|
|
7624
9482
|
* ```
|
|
7625
9483
|
*/
|
|
7626
9484
|
list(responseID, query = {}, options) {
|
|
7627
|
-
return this._client.getAPIList(path `/responses/${responseID}/input_items`, (CursorPage), { query, ...options });
|
|
9485
|
+
return this._client.getAPIList(path `/responses/${responseID}/input_items`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
7628
9486
|
}
|
|
7629
9487
|
}
|
|
7630
9488
|
|
|
@@ -7642,7 +9500,11 @@ class InputTokens extends APIResource {
|
|
|
7642
9500
|
* ```
|
|
7643
9501
|
*/
|
|
7644
9502
|
count(body = {}, options) {
|
|
7645
|
-
return this._client.post('/responses/input_tokens', {
|
|
9503
|
+
return this._client.post('/responses/input_tokens', {
|
|
9504
|
+
body,
|
|
9505
|
+
...options,
|
|
9506
|
+
__security: { bearerAuth: true },
|
|
9507
|
+
});
|
|
7646
9508
|
}
|
|
7647
9509
|
}
|
|
7648
9510
|
|
|
@@ -7654,7 +9516,12 @@ class Responses extends APIResource {
|
|
|
7654
9516
|
this.inputTokens = new InputTokens(this._client);
|
|
7655
9517
|
}
|
|
7656
9518
|
create(body, options) {
|
|
7657
|
-
return this._client.post('/responses', {
|
|
9519
|
+
return this._client.post('/responses', {
|
|
9520
|
+
body,
|
|
9521
|
+
...options,
|
|
9522
|
+
stream: body.stream ?? false,
|
|
9523
|
+
__security: { bearerAuth: true },
|
|
9524
|
+
})._thenUnwrap((rsp) => {
|
|
7658
9525
|
if ('object' in rsp && rsp.object === 'response') {
|
|
7659
9526
|
addOutputText(rsp);
|
|
7660
9527
|
}
|
|
@@ -7666,6 +9533,7 @@ class Responses extends APIResource {
|
|
|
7666
9533
|
query,
|
|
7667
9534
|
...options,
|
|
7668
9535
|
stream: query?.stream ?? false,
|
|
9536
|
+
__security: { bearerAuth: true },
|
|
7669
9537
|
})._thenUnwrap((rsp) => {
|
|
7670
9538
|
if ('object' in rsp && rsp.object === 'response') {
|
|
7671
9539
|
addOutputText(rsp);
|
|
@@ -7687,6 +9555,7 @@ class Responses extends APIResource {
|
|
|
7687
9555
|
return this._client.delete(path `/responses/${responseID}`, {
|
|
7688
9556
|
...options,
|
|
7689
9557
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
9558
|
+
__security: { bearerAuth: true },
|
|
7690
9559
|
});
|
|
7691
9560
|
}
|
|
7692
9561
|
parse(body, options) {
|
|
@@ -7713,7 +9582,10 @@ class Responses extends APIResource {
|
|
|
7713
9582
|
* ```
|
|
7714
9583
|
*/
|
|
7715
9584
|
cancel(responseID, options) {
|
|
7716
|
-
return this._client.post(path `/responses/${responseID}/cancel`,
|
|
9585
|
+
return this._client.post(path `/responses/${responseID}/cancel`, {
|
|
9586
|
+
...options,
|
|
9587
|
+
__security: { bearerAuth: true },
|
|
9588
|
+
});
|
|
7717
9589
|
}
|
|
7718
9590
|
/**
|
|
7719
9591
|
* Compact a conversation. Returns a compacted response object.
|
|
@@ -7731,7 +9603,7 @@ class Responses extends APIResource {
|
|
|
7731
9603
|
* ```
|
|
7732
9604
|
*/
|
|
7733
9605
|
compact(body, options) {
|
|
7734
|
-
return this._client.post('/responses/compact', { body, ...options });
|
|
9606
|
+
return this._client.post('/responses/compact', { body, ...options, __security: { bearerAuth: true } });
|
|
7735
9607
|
}
|
|
7736
9608
|
}
|
|
7737
9609
|
Responses.InputItems = InputItems;
|
|
@@ -7746,6 +9618,7 @@ let Content$1 = class Content extends APIResource {
|
|
|
7746
9618
|
return this._client.get(path `/skills/${skillID}/content`, {
|
|
7747
9619
|
...options,
|
|
7748
9620
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
9621
|
+
__security: { bearerAuth: true },
|
|
7749
9622
|
__binaryResponse: true,
|
|
7750
9623
|
});
|
|
7751
9624
|
}
|
|
@@ -7761,6 +9634,7 @@ class Content extends APIResource {
|
|
|
7761
9634
|
return this._client.get(path `/skills/${skill_id}/versions/${version}/content`, {
|
|
7762
9635
|
...options,
|
|
7763
9636
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
9637
|
+
__security: { bearerAuth: true },
|
|
7764
9638
|
__binaryResponse: true,
|
|
7765
9639
|
});
|
|
7766
9640
|
}
|
|
@@ -7776,14 +9650,17 @@ class Versions extends APIResource {
|
|
|
7776
9650
|
* Create a new immutable skill version.
|
|
7777
9651
|
*/
|
|
7778
9652
|
create(skillID, body = {}, options) {
|
|
7779
|
-
return this._client.post(path `/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
9653
|
+
return this._client.post(path `/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
7780
9654
|
}
|
|
7781
9655
|
/**
|
|
7782
9656
|
* Get a specific skill version.
|
|
7783
9657
|
*/
|
|
7784
9658
|
retrieve(version, params, options) {
|
|
7785
9659
|
const { skill_id } = params;
|
|
7786
|
-
return this._client.get(path `/skills/${skill_id}/versions/${version}`,
|
|
9660
|
+
return this._client.get(path `/skills/${skill_id}/versions/${version}`, {
|
|
9661
|
+
...options,
|
|
9662
|
+
__security: { bearerAuth: true },
|
|
9663
|
+
});
|
|
7787
9664
|
}
|
|
7788
9665
|
/**
|
|
7789
9666
|
* List skill versions for a skill.
|
|
@@ -7792,6 +9669,7 @@ class Versions extends APIResource {
|
|
|
7792
9669
|
return this._client.getAPIList(path `/skills/${skillID}/versions`, (CursorPage), {
|
|
7793
9670
|
query,
|
|
7794
9671
|
...options,
|
|
9672
|
+
__security: { bearerAuth: true },
|
|
7795
9673
|
});
|
|
7796
9674
|
}
|
|
7797
9675
|
/**
|
|
@@ -7799,7 +9677,10 @@ class Versions extends APIResource {
|
|
|
7799
9677
|
*/
|
|
7800
9678
|
delete(version, params, options) {
|
|
7801
9679
|
const { skill_id } = params;
|
|
7802
|
-
return this._client.delete(path `/skills/${skill_id}/versions/${version}`,
|
|
9680
|
+
return this._client.delete(path `/skills/${skill_id}/versions/${version}`, {
|
|
9681
|
+
...options,
|
|
9682
|
+
__security: { bearerAuth: true },
|
|
9683
|
+
});
|
|
7803
9684
|
}
|
|
7804
9685
|
}
|
|
7805
9686
|
Versions.Content = Content;
|
|
@@ -7815,31 +9696,39 @@ class Skills extends APIResource {
|
|
|
7815
9696
|
* Create a new skill.
|
|
7816
9697
|
*/
|
|
7817
9698
|
create(body = {}, options) {
|
|
7818
|
-
return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
9699
|
+
return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
7819
9700
|
}
|
|
7820
9701
|
/**
|
|
7821
9702
|
* Get a skill by its ID.
|
|
7822
9703
|
*/
|
|
7823
9704
|
retrieve(skillID, options) {
|
|
7824
|
-
return this._client.get(path `/skills/${skillID}`, options);
|
|
9705
|
+
return this._client.get(path `/skills/${skillID}`, { ...options, __security: { bearerAuth: true } });
|
|
7825
9706
|
}
|
|
7826
9707
|
/**
|
|
7827
9708
|
* Update the default version pointer for a skill.
|
|
7828
9709
|
*/
|
|
7829
9710
|
update(skillID, body, options) {
|
|
7830
|
-
return this._client.post(path `/skills/${skillID}`, {
|
|
9711
|
+
return this._client.post(path `/skills/${skillID}`, {
|
|
9712
|
+
body,
|
|
9713
|
+
...options,
|
|
9714
|
+
__security: { bearerAuth: true },
|
|
9715
|
+
});
|
|
7831
9716
|
}
|
|
7832
9717
|
/**
|
|
7833
9718
|
* List all skills for the current project.
|
|
7834
9719
|
*/
|
|
7835
9720
|
list(query = {}, options) {
|
|
7836
|
-
return this._client.getAPIList('/skills', (CursorPage), {
|
|
9721
|
+
return this._client.getAPIList('/skills', (CursorPage), {
|
|
9722
|
+
query,
|
|
9723
|
+
...options,
|
|
9724
|
+
__security: { bearerAuth: true },
|
|
9725
|
+
});
|
|
7837
9726
|
}
|
|
7838
9727
|
/**
|
|
7839
9728
|
* Delete a skill by its ID.
|
|
7840
9729
|
*/
|
|
7841
9730
|
delete(skillID, options) {
|
|
7842
|
-
return this._client.delete(path `/skills/${skillID}`, options);
|
|
9731
|
+
return this._client.delete(path `/skills/${skillID}`, { ...options, __security: { bearerAuth: true } });
|
|
7843
9732
|
}
|
|
7844
9733
|
}
|
|
7845
9734
|
Skills.Content = Content$1;
|
|
@@ -7864,7 +9753,7 @@ class Parts extends APIResource {
|
|
|
7864
9753
|
* [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete).
|
|
7865
9754
|
*/
|
|
7866
9755
|
create(uploadID, body, options) {
|
|
7867
|
-
return this._client.post(path `/uploads/${uploadID}/parts`, multipartFormRequestOptions({ body, ...options }, this._client));
|
|
9756
|
+
return this._client.post(path `/uploads/${uploadID}/parts`, multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
7868
9757
|
}
|
|
7869
9758
|
}
|
|
7870
9759
|
|
|
@@ -7901,7 +9790,7 @@ class Uploads extends APIResource {
|
|
|
7901
9790
|
* Returns the Upload object with status `pending`.
|
|
7902
9791
|
*/
|
|
7903
9792
|
create(body, options) {
|
|
7904
|
-
return this._client.post('/uploads', { body, ...options });
|
|
9793
|
+
return this._client.post('/uploads', { body, ...options, __security: { bearerAuth: true } });
|
|
7905
9794
|
}
|
|
7906
9795
|
/**
|
|
7907
9796
|
* Cancels the Upload. No Parts may be added after an Upload is cancelled.
|
|
@@ -7909,7 +9798,10 @@ class Uploads extends APIResource {
|
|
|
7909
9798
|
* Returns the Upload object with status `cancelled`.
|
|
7910
9799
|
*/
|
|
7911
9800
|
cancel(uploadID, options) {
|
|
7912
|
-
return this._client.post(path `/uploads/${uploadID}/cancel`,
|
|
9801
|
+
return this._client.post(path `/uploads/${uploadID}/cancel`, {
|
|
9802
|
+
...options,
|
|
9803
|
+
__security: { bearerAuth: true },
|
|
9804
|
+
});
|
|
7913
9805
|
}
|
|
7914
9806
|
/**
|
|
7915
9807
|
* Completes the
|
|
@@ -7929,7 +9821,11 @@ class Uploads extends APIResource {
|
|
|
7929
9821
|
* object.
|
|
7930
9822
|
*/
|
|
7931
9823
|
complete(uploadID, body, options) {
|
|
7932
|
-
return this._client.post(path `/uploads/${uploadID}/complete`, {
|
|
9824
|
+
return this._client.post(path `/uploads/${uploadID}/complete`, {
|
|
9825
|
+
body,
|
|
9826
|
+
...options,
|
|
9827
|
+
__security: { bearerAuth: true },
|
|
9828
|
+
});
|
|
7933
9829
|
}
|
|
7934
9830
|
}
|
|
7935
9831
|
Uploads.Parts = Parts;
|
|
@@ -7966,6 +9862,7 @@ class FileBatches extends APIResource {
|
|
|
7966
9862
|
body,
|
|
7967
9863
|
...options,
|
|
7968
9864
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9865
|
+
__security: { bearerAuth: true },
|
|
7969
9866
|
});
|
|
7970
9867
|
}
|
|
7971
9868
|
/**
|
|
@@ -7976,6 +9873,7 @@ class FileBatches extends APIResource {
|
|
|
7976
9873
|
return this._client.get(path `/vector_stores/${vector_store_id}/file_batches/${batchID}`, {
|
|
7977
9874
|
...options,
|
|
7978
9875
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9876
|
+
__security: { bearerAuth: true },
|
|
7979
9877
|
});
|
|
7980
9878
|
}
|
|
7981
9879
|
/**
|
|
@@ -7987,6 +9885,7 @@ class FileBatches extends APIResource {
|
|
|
7987
9885
|
return this._client.post(path `/vector_stores/${vector_store_id}/file_batches/${batchID}/cancel`, {
|
|
7988
9886
|
...options,
|
|
7989
9887
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9888
|
+
__security: { bearerAuth: true },
|
|
7990
9889
|
});
|
|
7991
9890
|
}
|
|
7992
9891
|
/**
|
|
@@ -8001,7 +9900,12 @@ class FileBatches extends APIResource {
|
|
|
8001
9900
|
*/
|
|
8002
9901
|
listFiles(batchID, params, options) {
|
|
8003
9902
|
const { vector_store_id, ...query } = params;
|
|
8004
|
-
return this._client.getAPIList(path `/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, (CursorPage), {
|
|
9903
|
+
return this._client.getAPIList(path `/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, (CursorPage), {
|
|
9904
|
+
query,
|
|
9905
|
+
...options,
|
|
9906
|
+
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9907
|
+
__security: { bearerAuth: true },
|
|
9908
|
+
});
|
|
8005
9909
|
}
|
|
8006
9910
|
/**
|
|
8007
9911
|
* Wait for the given file batch to be processed.
|
|
@@ -8091,6 +9995,7 @@ class Files extends APIResource {
|
|
|
8091
9995
|
body,
|
|
8092
9996
|
...options,
|
|
8093
9997
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9998
|
+
__security: { bearerAuth: true },
|
|
8094
9999
|
});
|
|
8095
10000
|
}
|
|
8096
10001
|
/**
|
|
@@ -8101,6 +10006,7 @@ class Files extends APIResource {
|
|
|
8101
10006
|
return this._client.get(path `/vector_stores/${vector_store_id}/files/${fileID}`, {
|
|
8102
10007
|
...options,
|
|
8103
10008
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10009
|
+
__security: { bearerAuth: true },
|
|
8104
10010
|
});
|
|
8105
10011
|
}
|
|
8106
10012
|
/**
|
|
@@ -8112,6 +10018,7 @@ class Files extends APIResource {
|
|
|
8112
10018
|
body,
|
|
8113
10019
|
...options,
|
|
8114
10020
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10021
|
+
__security: { bearerAuth: true },
|
|
8115
10022
|
});
|
|
8116
10023
|
}
|
|
8117
10024
|
/**
|
|
@@ -8122,6 +10029,7 @@ class Files extends APIResource {
|
|
|
8122
10029
|
query,
|
|
8123
10030
|
...options,
|
|
8124
10031
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10032
|
+
__security: { bearerAuth: true },
|
|
8125
10033
|
});
|
|
8126
10034
|
}
|
|
8127
10035
|
/**
|
|
@@ -8135,6 +10043,7 @@ class Files extends APIResource {
|
|
|
8135
10043
|
return this._client.delete(path `/vector_stores/${vector_store_id}/files/${fileID}`, {
|
|
8136
10044
|
...options,
|
|
8137
10045
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10046
|
+
__security: { bearerAuth: true },
|
|
8138
10047
|
});
|
|
8139
10048
|
}
|
|
8140
10049
|
/**
|
|
@@ -8208,7 +10117,11 @@ class Files extends APIResource {
|
|
|
8208
10117
|
*/
|
|
8209
10118
|
content(fileID, params, options) {
|
|
8210
10119
|
const { vector_store_id } = params;
|
|
8211
|
-
return this._client.getAPIList(path `/vector_stores/${vector_store_id}/files/${fileID}/content`, (Page), {
|
|
10120
|
+
return this._client.getAPIList(path `/vector_stores/${vector_store_id}/files/${fileID}/content`, (Page), {
|
|
10121
|
+
...options,
|
|
10122
|
+
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10123
|
+
__security: { bearerAuth: true },
|
|
10124
|
+
});
|
|
8212
10125
|
}
|
|
8213
10126
|
}
|
|
8214
10127
|
|
|
@@ -8227,6 +10140,7 @@ class VectorStores extends APIResource {
|
|
|
8227
10140
|
body,
|
|
8228
10141
|
...options,
|
|
8229
10142
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10143
|
+
__security: { bearerAuth: true },
|
|
8230
10144
|
});
|
|
8231
10145
|
}
|
|
8232
10146
|
/**
|
|
@@ -8236,6 +10150,7 @@ class VectorStores extends APIResource {
|
|
|
8236
10150
|
return this._client.get(path `/vector_stores/${vectorStoreID}`, {
|
|
8237
10151
|
...options,
|
|
8238
10152
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10153
|
+
__security: { bearerAuth: true },
|
|
8239
10154
|
});
|
|
8240
10155
|
}
|
|
8241
10156
|
/**
|
|
@@ -8246,6 +10161,7 @@ class VectorStores extends APIResource {
|
|
|
8246
10161
|
body,
|
|
8247
10162
|
...options,
|
|
8248
10163
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10164
|
+
__security: { bearerAuth: true },
|
|
8249
10165
|
});
|
|
8250
10166
|
}
|
|
8251
10167
|
/**
|
|
@@ -8256,6 +10172,7 @@ class VectorStores extends APIResource {
|
|
|
8256
10172
|
query,
|
|
8257
10173
|
...options,
|
|
8258
10174
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10175
|
+
__security: { bearerAuth: true },
|
|
8259
10176
|
});
|
|
8260
10177
|
}
|
|
8261
10178
|
/**
|
|
@@ -8265,6 +10182,7 @@ class VectorStores extends APIResource {
|
|
|
8265
10182
|
return this._client.delete(path `/vector_stores/${vectorStoreID}`, {
|
|
8266
10183
|
...options,
|
|
8267
10184
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10185
|
+
__security: { bearerAuth: true },
|
|
8268
10186
|
});
|
|
8269
10187
|
}
|
|
8270
10188
|
/**
|
|
@@ -8277,6 +10195,7 @@ class VectorStores extends APIResource {
|
|
|
8277
10195
|
method: 'post',
|
|
8278
10196
|
...options,
|
|
8279
10197
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10198
|
+
__security: { bearerAuth: true },
|
|
8280
10199
|
});
|
|
8281
10200
|
}
|
|
8282
10201
|
}
|
|
@@ -8289,31 +10208,35 @@ class Videos extends APIResource {
|
|
|
8289
10208
|
* Create a new video generation job from a prompt and optional reference assets.
|
|
8290
10209
|
*/
|
|
8291
10210
|
create(body, options) {
|
|
8292
|
-
return this._client.post('/videos', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
10211
|
+
return this._client.post('/videos', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
8293
10212
|
}
|
|
8294
10213
|
/**
|
|
8295
10214
|
* Fetch the latest metadata for a generated video.
|
|
8296
10215
|
*/
|
|
8297
10216
|
retrieve(videoID, options) {
|
|
8298
|
-
return this._client.get(path `/videos/${videoID}`, options);
|
|
10217
|
+
return this._client.get(path `/videos/${videoID}`, { ...options, __security: { bearerAuth: true } });
|
|
8299
10218
|
}
|
|
8300
10219
|
/**
|
|
8301
10220
|
* List recently generated videos for the current project.
|
|
8302
10221
|
*/
|
|
8303
10222
|
list(query = {}, options) {
|
|
8304
|
-
return this._client.getAPIList('/videos', (ConversationCursorPage), {
|
|
10223
|
+
return this._client.getAPIList('/videos', (ConversationCursorPage), {
|
|
10224
|
+
query,
|
|
10225
|
+
...options,
|
|
10226
|
+
__security: { bearerAuth: true },
|
|
10227
|
+
});
|
|
8305
10228
|
}
|
|
8306
10229
|
/**
|
|
8307
10230
|
* Permanently delete a completed or failed video and its stored assets.
|
|
8308
10231
|
*/
|
|
8309
10232
|
delete(videoID, options) {
|
|
8310
|
-
return this._client.delete(path `/videos/${videoID}`, options);
|
|
10233
|
+
return this._client.delete(path `/videos/${videoID}`, { ...options, __security: { bearerAuth: true } });
|
|
8311
10234
|
}
|
|
8312
10235
|
/**
|
|
8313
10236
|
* Create a character from an uploaded video.
|
|
8314
10237
|
*/
|
|
8315
10238
|
createCharacter(body, options) {
|
|
8316
|
-
return this._client.post('/videos/characters', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
10239
|
+
return this._client.post('/videos/characters', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
8317
10240
|
}
|
|
8318
10241
|
/**
|
|
8319
10242
|
* Download the generated video bytes or a derived preview asset.
|
|
@@ -8325,6 +10248,7 @@ class Videos extends APIResource {
|
|
|
8325
10248
|
query,
|
|
8326
10249
|
...options,
|
|
8327
10250
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
10251
|
+
__security: { bearerAuth: true },
|
|
8328
10252
|
__binaryResponse: true,
|
|
8329
10253
|
});
|
|
8330
10254
|
}
|
|
@@ -8333,25 +10257,28 @@ class Videos extends APIResource {
|
|
|
8333
10257
|
* generated video.
|
|
8334
10258
|
*/
|
|
8335
10259
|
edit(body, options) {
|
|
8336
|
-
return this._client.post('/videos/edits', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
10260
|
+
return this._client.post('/videos/edits', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
8337
10261
|
}
|
|
8338
10262
|
/**
|
|
8339
10263
|
* Create an extension of a completed video.
|
|
8340
10264
|
*/
|
|
8341
10265
|
extend(body, options) {
|
|
8342
|
-
return this._client.post('/videos/extensions', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
10266
|
+
return this._client.post('/videos/extensions', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
8343
10267
|
}
|
|
8344
10268
|
/**
|
|
8345
10269
|
* Fetch a character.
|
|
8346
10270
|
*/
|
|
8347
10271
|
getCharacter(characterID, options) {
|
|
8348
|
-
return this._client.get(path `/videos/characters/${characterID}`,
|
|
10272
|
+
return this._client.get(path `/videos/characters/${characterID}`, {
|
|
10273
|
+
...options,
|
|
10274
|
+
__security: { bearerAuth: true },
|
|
10275
|
+
});
|
|
8349
10276
|
}
|
|
8350
10277
|
/**
|
|
8351
10278
|
* Create a remix of a completed video using a refreshed prompt.
|
|
8352
10279
|
*/
|
|
8353
10280
|
remix(videoID, body, options) {
|
|
8354
|
-
return this._client.post(path `/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
10281
|
+
return this._client.post(path `/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
8355
10282
|
}
|
|
8356
10283
|
}
|
|
8357
10284
|
|
|
@@ -8458,7 +10385,8 @@ class OpenAI {
|
|
|
8458
10385
|
/**
|
|
8459
10386
|
* API Client for interfacing with the OpenAI API.
|
|
8460
10387
|
*
|
|
8461
|
-
* @param {string | undefined} [opts.apiKey=process.env['OPENAI_API_KEY'] ??
|
|
10388
|
+
* @param {string | null | undefined} [opts.apiKey=process.env['OPENAI_API_KEY'] ?? null]
|
|
10389
|
+
* @param {string | null | undefined} [opts.adminAPIKey=process.env['OPENAI_ADMIN_KEY'] ?? null]
|
|
8462
10390
|
* @param {string | null | undefined} [opts.organization=process.env['OPENAI_ORG_ID'] ?? null]
|
|
8463
10391
|
* @param {string | null | undefined} [opts.project=process.env['OPENAI_PROJECT_ID'] ?? null]
|
|
8464
10392
|
* @param {string | null | undefined} [opts.webhookSecret=process.env['OPENAI_WEBHOOK_SECRET'] ?? null]
|
|
@@ -8471,7 +10399,7 @@ class OpenAI {
|
|
|
8471
10399
|
* @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
8472
10400
|
* @param {boolean} [opts.dangerouslyAllowBrowser=false] - By default, client-side use of this library is not allowed, as it risks exposing your secret API credentials to attackers.
|
|
8473
10401
|
*/
|
|
8474
|
-
constructor({ baseURL = readEnv('OPENAI_BASE_URL'), apiKey = readEnv('OPENAI_API_KEY'), organization = readEnv('OPENAI_ORG_ID') ?? null, project = readEnv('OPENAI_PROJECT_ID') ?? null, webhookSecret = readEnv('OPENAI_WEBHOOK_SECRET') ?? null, workloadIdentity, ...opts } = {}) {
|
|
10402
|
+
constructor({ baseURL = readEnv('OPENAI_BASE_URL'), apiKey = readEnv('OPENAI_API_KEY') ?? null, adminAPIKey = readEnv('OPENAI_ADMIN_KEY') ?? null, organization = readEnv('OPENAI_ORG_ID') ?? null, project = readEnv('OPENAI_PROJECT_ID') ?? null, webhookSecret = readEnv('OPENAI_WEBHOOK_SECRET') ?? null, workloadIdentity, ...opts } = {}) {
|
|
8475
10403
|
_OpenAI_instances.add(this);
|
|
8476
10404
|
_OpenAI_encoder.set(this, void 0);
|
|
8477
10405
|
/**
|
|
@@ -8513,6 +10441,7 @@ class OpenAI {
|
|
|
8513
10441
|
* Use Uploads to upload large files in multiple parts.
|
|
8514
10442
|
*/
|
|
8515
10443
|
this.uploads = new Uploads(this);
|
|
10444
|
+
this.admin = new Admin(this);
|
|
8516
10445
|
this.responses = new Responses(this);
|
|
8517
10446
|
this.realtime = new Realtime(this);
|
|
8518
10447
|
/**
|
|
@@ -8526,17 +10455,9 @@ class OpenAI {
|
|
|
8526
10455
|
this.containers = new Containers(this);
|
|
8527
10456
|
this.skills = new Skills(this);
|
|
8528
10457
|
this.videos = new Videos(this);
|
|
8529
|
-
if (workloadIdentity) {
|
|
8530
|
-
if (apiKey && apiKey !== WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER) {
|
|
8531
|
-
throw new OpenAIError('The `apiKey` and `workloadIdentity` arguments are mutually exclusive; only one can be passed at a time.');
|
|
8532
|
-
}
|
|
8533
|
-
apiKey = WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER;
|
|
8534
|
-
}
|
|
8535
|
-
else if (apiKey === undefined) {
|
|
8536
|
-
throw new OpenAIError('Missing credentials. Please pass an `apiKey`, `workloadIdentity`, or set the `OPENAI_API_KEY` environment variable.');
|
|
8537
|
-
}
|
|
8538
10458
|
const options = {
|
|
8539
10459
|
apiKey,
|
|
10460
|
+
adminAPIKey,
|
|
8540
10461
|
organization,
|
|
8541
10462
|
project,
|
|
8542
10463
|
webhookSecret,
|
|
@@ -8544,6 +10465,12 @@ class OpenAI {
|
|
|
8544
10465
|
...opts,
|
|
8545
10466
|
baseURL: baseURL || `https://api.openai.com/v1`,
|
|
8546
10467
|
};
|
|
10468
|
+
if (apiKey && workloadIdentity) {
|
|
10469
|
+
throw new OpenAIError('The `apiKey` and `workloadIdentity` options are mutually exclusive');
|
|
10470
|
+
}
|
|
10471
|
+
if (!apiKey && !adminAPIKey && !workloadIdentity) {
|
|
10472
|
+
throw new OpenAIError('Missing credentials. Please pass an `apiKey`, `workloadIdentity`, `adminAPIKey`, or set the `OPENAI_API_KEY` or `OPENAI_ADMIN_KEY` environment variable.');
|
|
10473
|
+
}
|
|
8547
10474
|
if (!options.dangerouslyAllowBrowser && isRunningInBrowser()) {
|
|
8548
10475
|
throw new OpenAIError("It looks like you're running in a browser-like environment.\n\nThis is disabled by default, as it risks exposing your secret API credentials to attackers.\nIf you understand the risks and have appropriate mitigations in place,\nyou can set the `dangerouslyAllowBrowser` option to `true`, e.g.,\n\nnew OpenAI({ apiKey, dangerouslyAllowBrowser: true });\n\nhttps://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety\n");
|
|
8549
10476
|
}
|
|
@@ -8561,11 +10488,23 @@ class OpenAI {
|
|
|
8561
10488
|
this.maxRetries = options.maxRetries ?? 2;
|
|
8562
10489
|
this.fetch = options.fetch ?? getDefaultFetch();
|
|
8563
10490
|
__classPrivateFieldSet(this, _OpenAI_encoder, FallbackEncoder);
|
|
10491
|
+
const customHeadersEnv = readEnv('OPENAI_CUSTOM_HEADERS');
|
|
10492
|
+
if (customHeadersEnv) {
|
|
10493
|
+
const parsed = {};
|
|
10494
|
+
for (const line of customHeadersEnv.split('\n')) {
|
|
10495
|
+
const colon = line.indexOf(':');
|
|
10496
|
+
if (colon >= 0) {
|
|
10497
|
+
parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
|
|
10498
|
+
}
|
|
10499
|
+
}
|
|
10500
|
+
options.defaultHeaders = buildHeaders([parsed, options.defaultHeaders]);
|
|
10501
|
+
}
|
|
8564
10502
|
this._options = options;
|
|
8565
10503
|
if (workloadIdentity) {
|
|
8566
10504
|
this._workloadIdentityAuth = new WorkloadIdentityAuth(workloadIdentity, this.fetch);
|
|
8567
10505
|
}
|
|
8568
|
-
this.apiKey = typeof apiKey === 'string' ? apiKey :
|
|
10506
|
+
this.apiKey = typeof apiKey === 'string' ? apiKey : null;
|
|
10507
|
+
this.adminAPIKey = adminAPIKey;
|
|
8569
10508
|
this.organization = organization;
|
|
8570
10509
|
this.project = project;
|
|
8571
10510
|
this.webhookSecret = webhookSecret;
|
|
@@ -8583,7 +10522,8 @@ class OpenAI {
|
|
|
8583
10522
|
logLevel: this.logLevel,
|
|
8584
10523
|
fetch: this.fetch,
|
|
8585
10524
|
fetchOptions: this.fetchOptions,
|
|
8586
|
-
apiKey: this.apiKey,
|
|
10525
|
+
apiKey: this._options.apiKey,
|
|
10526
|
+
adminAPIKey: this.adminAPIKey,
|
|
8587
10527
|
workloadIdentity: this._options.workloadIdentity,
|
|
8588
10528
|
organization: this.organization,
|
|
8589
10529
|
project: this.project,
|
|
@@ -8595,12 +10535,45 @@ class OpenAI {
|
|
|
8595
10535
|
defaultQuery() {
|
|
8596
10536
|
return this._options.defaultQuery;
|
|
8597
10537
|
}
|
|
8598
|
-
validateHeaders({ values, nulls }
|
|
8599
|
-
|
|
10538
|
+
validateHeaders({ values, nulls }, schemes = {
|
|
10539
|
+
bearerAuth: true,
|
|
10540
|
+
adminAPIKeyAuth: true,
|
|
10541
|
+
}) {
|
|
10542
|
+
if (values.get('authorization') || values.get('api-key')) {
|
|
10543
|
+
return;
|
|
10544
|
+
}
|
|
10545
|
+
if (nulls.has('authorization') || nulls.has('api-key')) {
|
|
10546
|
+
return;
|
|
10547
|
+
}
|
|
10548
|
+
if (this._workloadIdentityAuth && schemes.bearerAuth) {
|
|
10549
|
+
return;
|
|
10550
|
+
}
|
|
10551
|
+
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');
|
|
8600
10552
|
}
|
|
8601
|
-
async authHeaders(opts
|
|
10553
|
+
async authHeaders(opts, schemes = {
|
|
10554
|
+
bearerAuth: true,
|
|
10555
|
+
adminAPIKeyAuth: true,
|
|
10556
|
+
}) {
|
|
10557
|
+
return buildHeaders([
|
|
10558
|
+
schemes.bearerAuth ? await this.bearerAuth(opts) : null,
|
|
10559
|
+
schemes.adminAPIKeyAuth ? await this.adminAPIKeyAuth(opts) : null,
|
|
10560
|
+
]);
|
|
10561
|
+
}
|
|
10562
|
+
async bearerAuth(opts) {
|
|
10563
|
+
if (this._workloadIdentityAuth) {
|
|
10564
|
+
return buildHeaders([{ Authorization: `Bearer ${await this._workloadIdentityAuth.getToken()}` }]);
|
|
10565
|
+
}
|
|
10566
|
+
if (this.apiKey == null) {
|
|
10567
|
+
return undefined;
|
|
10568
|
+
}
|
|
8602
10569
|
return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]);
|
|
8603
10570
|
}
|
|
10571
|
+
async adminAPIKeyAuth(opts) {
|
|
10572
|
+
if (this.adminAPIKey == null) {
|
|
10573
|
+
return undefined;
|
|
10574
|
+
}
|
|
10575
|
+
return buildHeaders([{ Authorization: `Bearer ${this.adminAPIKey}` }]);
|
|
10576
|
+
}
|
|
8604
10577
|
stringifyQuery(query) {
|
|
8605
10578
|
return stringifyQuery(query);
|
|
8606
10579
|
}
|
|
@@ -8653,7 +10626,10 @@ class OpenAI {
|
|
|
8653
10626
|
* Used as a callback for mutating the given `FinalRequestOptions` object.
|
|
8654
10627
|
*/
|
|
8655
10628
|
async prepareOptions(options) {
|
|
8656
|
-
|
|
10629
|
+
const security = options.__security ?? { bearerAuth: true };
|
|
10630
|
+
if (security.bearerAuth) {
|
|
10631
|
+
await this._callApiKey();
|
|
10632
|
+
}
|
|
8657
10633
|
}
|
|
8658
10634
|
/**
|
|
8659
10635
|
* Used as a callback for mutating the given `RequestInit` object.
|
|
@@ -8710,8 +10686,9 @@ class OpenAI {
|
|
|
8710
10686
|
if (options.signal?.aborted) {
|
|
8711
10687
|
throw new APIUserAbortError();
|
|
8712
10688
|
}
|
|
10689
|
+
const security = options.__security ?? { bearerAuth: true };
|
|
8713
10690
|
const controller = new AbortController();
|
|
8714
|
-
const response = await this.fetchWithAuth(url, req, timeout, controller).catch(castToError);
|
|
10691
|
+
const response = await this.fetchWithAuth(url, req, timeout, controller, security).catch(castToError);
|
|
8715
10692
|
const headersTime = Date.now();
|
|
8716
10693
|
if (response instanceof globalThis.Error) {
|
|
8717
10694
|
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
@@ -8757,6 +10734,7 @@ class OpenAI {
|
|
|
8757
10734
|
if (!response.ok) {
|
|
8758
10735
|
if (response.status === 401 &&
|
|
8759
10736
|
this._workloadIdentityAuth &&
|
|
10737
|
+
security.bearerAuth &&
|
|
8760
10738
|
!options.__metadata?.['hasStreamingBody'] &&
|
|
8761
10739
|
!options.__metadata?.['workloadIdentityTokenRefreshed']) {
|
|
8762
10740
|
await CancelReadableStream(response.body);
|
|
@@ -8819,8 +10797,11 @@ class OpenAI {
|
|
|
8819
10797
|
const request = this.makeRequest(options, null, undefined);
|
|
8820
10798
|
return new PagePromise(this, request, Page);
|
|
8821
10799
|
}
|
|
8822
|
-
async fetchWithAuth(url, init, timeout, controller
|
|
8823
|
-
|
|
10800
|
+
async fetchWithAuth(url, init, timeout, controller, schemes = {
|
|
10801
|
+
bearerAuth: true,
|
|
10802
|
+
adminAPIKeyAuth: true,
|
|
10803
|
+
}) {
|
|
10804
|
+
if (this._workloadIdentityAuth && schemes.bearerAuth) {
|
|
8824
10805
|
const headers = init.headers;
|
|
8825
10806
|
const authHeader = headers.get('Authorization');
|
|
8826
10807
|
if (!authHeader || authHeader === `Bearer ${WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER}`) {
|
|
@@ -8965,12 +10946,12 @@ class OpenAI {
|
|
|
8965
10946
|
'OpenAI-Organization': this.organization,
|
|
8966
10947
|
'OpenAI-Project': this.project,
|
|
8967
10948
|
},
|
|
8968
|
-
await this.authHeaders(options),
|
|
10949
|
+
await this.authHeaders(options, options.__security ?? { bearerAuth: true }),
|
|
8969
10950
|
this._options.defaultHeaders,
|
|
8970
10951
|
bodyHeaders,
|
|
8971
10952
|
options.headers,
|
|
8972
10953
|
]);
|
|
8973
|
-
this.validateHeaders(headers);
|
|
10954
|
+
this.validateHeaders(headers, options.__security ?? { bearerAuth: true });
|
|
8974
10955
|
return headers.values;
|
|
8975
10956
|
}
|
|
8976
10957
|
_makeAbort(controller) {
|
|
@@ -9067,6 +11048,7 @@ OpenAI.Webhooks = Webhooks;
|
|
|
9067
11048
|
OpenAI.Beta = Beta;
|
|
9068
11049
|
OpenAI.Batches = Batches;
|
|
9069
11050
|
OpenAI.Uploads = Uploads;
|
|
11051
|
+
OpenAI.Admin = Admin;
|
|
9070
11052
|
OpenAI.Responses = Responses;
|
|
9071
11053
|
OpenAI.Realtime = Realtime;
|
|
9072
11054
|
OpenAI.Conversations = Conversations;
|
|
@@ -11626,7 +13608,6 @@ function zodTextFormat(zodObject, name, props) {
|
|
|
11626
13608
|
}, (content) => zodObject.parse(JSON.parse(content)));
|
|
11627
13609
|
}
|
|
11628
13610
|
|
|
11629
|
-
// llm-openai-config.ts
|
|
11630
13611
|
const DEFAULT_MODEL = 'gpt-5-mini';
|
|
11631
13612
|
const GPT_5_HIGH_CONTEXT_THRESHOLD_TOKENS = 272_000;
|
|
11632
13613
|
const GPT_5_HIGH_CONTEXT_INPUT_MULTIPLIER = 2;
|
|
@@ -11707,25 +13688,144 @@ const deepseekModelCosts = {
|
|
|
11707
13688
|
function shouldUseGPT5HighContextPricing(model, inputTokens) {
|
|
11708
13689
|
return (model === 'gpt-5.4' || model === 'gpt-5.5') && inputTokens > GPT_5_HIGH_CONTEXT_THRESHOLD_TOKENS;
|
|
11709
13690
|
}
|
|
11710
|
-
|
|
11711
|
-
const
|
|
11712
|
-
|
|
11713
|
-
'gpt-image-
|
|
13691
|
+
const DEFAULT_IMAGE_PRICING_QUALITY = 'high';
|
|
13692
|
+
const DEFAULT_IMAGE_PRICING_SIZE = '1024x1024';
|
|
13693
|
+
const PRICED_OPENAI_IMAGE_MODELS = [
|
|
13694
|
+
'gpt-image-2',
|
|
13695
|
+
'gpt-image-2-2026-04-21',
|
|
13696
|
+
'gpt-image-1.5',
|
|
13697
|
+
'gpt-image-1',
|
|
13698
|
+
'gpt-image-1-mini',
|
|
13699
|
+
];
|
|
13700
|
+
const OPENAI_IMAGE_PRICING_SIZES = ['1024x1024', '1024x1536', '1536x1024'];
|
|
13701
|
+
/**
|
|
13702
|
+
* Estimated image output costs in USD per image for common GPT Image sizes.
|
|
13703
|
+
* Last updated May 2026 from the OpenAI image generation guide. Text and image
|
|
13704
|
+
* input token costs for prompts and edit inputs are not included.
|
|
13705
|
+
*/
|
|
13706
|
+
const openAiImageCostByQualityAndSize = {
|
|
13707
|
+
'gpt-image-2': {
|
|
13708
|
+
low: {
|
|
13709
|
+
'1024x1024': 0.006,
|
|
13710
|
+
'1024x1536': 0.005,
|
|
13711
|
+
'1536x1024': 0.005,
|
|
13712
|
+
},
|
|
13713
|
+
medium: {
|
|
13714
|
+
'1024x1024': 0.053,
|
|
13715
|
+
'1024x1536': 0.041,
|
|
13716
|
+
'1536x1024': 0.041,
|
|
13717
|
+
},
|
|
13718
|
+
high: {
|
|
13719
|
+
'1024x1024': 0.211,
|
|
13720
|
+
'1024x1536': 0.165,
|
|
13721
|
+
'1536x1024': 0.165,
|
|
13722
|
+
},
|
|
13723
|
+
},
|
|
13724
|
+
'gpt-image-2-2026-04-21': {
|
|
13725
|
+
low: {
|
|
13726
|
+
'1024x1024': 0.006,
|
|
13727
|
+
'1024x1536': 0.005,
|
|
13728
|
+
'1536x1024': 0.005,
|
|
13729
|
+
},
|
|
13730
|
+
medium: {
|
|
13731
|
+
'1024x1024': 0.053,
|
|
13732
|
+
'1024x1536': 0.041,
|
|
13733
|
+
'1536x1024': 0.041,
|
|
13734
|
+
},
|
|
13735
|
+
high: {
|
|
13736
|
+
'1024x1024': 0.211,
|
|
13737
|
+
'1024x1536': 0.165,
|
|
13738
|
+
'1536x1024': 0.165,
|
|
13739
|
+
},
|
|
13740
|
+
},
|
|
13741
|
+
'gpt-image-1.5': {
|
|
13742
|
+
low: {
|
|
13743
|
+
'1024x1024': 0.009,
|
|
13744
|
+
'1024x1536': 0.013,
|
|
13745
|
+
'1536x1024': 0.013,
|
|
13746
|
+
},
|
|
13747
|
+
medium: {
|
|
13748
|
+
'1024x1024': 0.034,
|
|
13749
|
+
'1024x1536': 0.05,
|
|
13750
|
+
'1536x1024': 0.05,
|
|
13751
|
+
},
|
|
13752
|
+
high: {
|
|
13753
|
+
'1024x1024': 0.133,
|
|
13754
|
+
'1024x1536': 0.2,
|
|
13755
|
+
'1536x1024': 0.2,
|
|
13756
|
+
},
|
|
13757
|
+
},
|
|
13758
|
+
'gpt-image-1': {
|
|
13759
|
+
low: {
|
|
13760
|
+
'1024x1024': 0.011,
|
|
13761
|
+
'1024x1536': 0.016,
|
|
13762
|
+
'1536x1024': 0.016,
|
|
13763
|
+
},
|
|
13764
|
+
medium: {
|
|
13765
|
+
'1024x1024': 0.042,
|
|
13766
|
+
'1024x1536': 0.063,
|
|
13767
|
+
'1536x1024': 0.063,
|
|
13768
|
+
},
|
|
13769
|
+
high: {
|
|
13770
|
+
'1024x1024': 0.167,
|
|
13771
|
+
'1024x1536': 0.25,
|
|
13772
|
+
'1536x1024': 0.25,
|
|
13773
|
+
},
|
|
13774
|
+
},
|
|
13775
|
+
'gpt-image-1-mini': {
|
|
13776
|
+
low: {
|
|
13777
|
+
'1024x1024': 0.005,
|
|
13778
|
+
'1024x1536': 0.006,
|
|
13779
|
+
'1536x1024': 0.006,
|
|
13780
|
+
},
|
|
13781
|
+
medium: {
|
|
13782
|
+
'1024x1024': 0.011,
|
|
13783
|
+
'1024x1536': 0.015,
|
|
13784
|
+
'1536x1024': 0.015,
|
|
13785
|
+
},
|
|
13786
|
+
high: {
|
|
13787
|
+
'1024x1024': 0.036,
|
|
13788
|
+
'1024x1536': 0.052,
|
|
13789
|
+
'1536x1024': 0.052,
|
|
13790
|
+
},
|
|
13791
|
+
},
|
|
11714
13792
|
};
|
|
13793
|
+
function isPricedOpenAIImageModel(model) {
|
|
13794
|
+
return PRICED_OPENAI_IMAGE_MODELS.includes(model);
|
|
13795
|
+
}
|
|
13796
|
+
function isOpenAIImagePricingSize(size) {
|
|
13797
|
+
return OPENAI_IMAGE_PRICING_SIZES.includes(size);
|
|
13798
|
+
}
|
|
13799
|
+
function resolveImagePricingQuality(quality) {
|
|
13800
|
+
if (quality === 'low' || quality === 'medium' || quality === 'high') {
|
|
13801
|
+
return quality;
|
|
13802
|
+
}
|
|
13803
|
+
return DEFAULT_IMAGE_PRICING_QUALITY;
|
|
13804
|
+
}
|
|
13805
|
+
function resolveImagePricingSize(size) {
|
|
13806
|
+
if (typeof size === 'string' && isOpenAIImagePricingSize(size)) {
|
|
13807
|
+
return size;
|
|
13808
|
+
}
|
|
13809
|
+
return DEFAULT_IMAGE_PRICING_SIZE;
|
|
13810
|
+
}
|
|
11715
13811
|
/**
|
|
11716
13812
|
* Calculates the cost of generating images using OpenAI's Images API.
|
|
11717
13813
|
*
|
|
11718
13814
|
* @param model The image generation model name.
|
|
11719
13815
|
* @param imageCount The number of images generated.
|
|
13816
|
+
* @param quality The requested image quality.
|
|
13817
|
+
* @param size The requested image size.
|
|
11720
13818
|
* @returns The cost of generating the images in USD.
|
|
11721
13819
|
*/
|
|
11722
|
-
function calculateImageCost(model, imageCount) {
|
|
13820
|
+
function calculateImageCost(model, imageCount, quality, size) {
|
|
11723
13821
|
if (typeof model !== 'string' || typeof imageCount !== 'number' || imageCount <= 0) {
|
|
11724
13822
|
return 0;
|
|
11725
13823
|
}
|
|
11726
|
-
|
|
11727
|
-
if (!costPerImage)
|
|
13824
|
+
if (!isPricedOpenAIImageModel(model))
|
|
11728
13825
|
return 0;
|
|
13826
|
+
const pricingQuality = resolveImagePricingQuality(quality);
|
|
13827
|
+
const pricingSize = resolveImagePricingSize(size);
|
|
13828
|
+
const costPerImage = openAiImageCostByQualityAndSize[model][pricingQuality][pricingSize];
|
|
11729
13829
|
return imageCount * costPerImage;
|
|
11730
13830
|
}
|
|
11731
13831
|
/**
|
|
@@ -12424,7 +14524,7 @@ async function makeLLMCall(input, options = {}) {
|
|
|
12424
14524
|
return await makeResponsesAPICall(processedInput, responsesOptions);
|
|
12425
14525
|
}
|
|
12426
14526
|
|
|
12427
|
-
const DEFAULT_IMAGE_MODEL = 'gpt-image-
|
|
14527
|
+
const DEFAULT_IMAGE_MODEL = 'gpt-image-2';
|
|
12428
14528
|
const resolveImageModel = (model) => model ?? DEFAULT_IMAGE_MODEL;
|
|
12429
14529
|
const MULTIMODAL_VISION_MODELS = new Set(OPENAI_MODELS);
|
|
12430
14530
|
/**
|
|
@@ -12513,7 +14613,7 @@ async function makeImagesCall(prompt, options = {}) {
|
|
|
12513
14613
|
throw new Error('No images returned from OpenAI Images API');
|
|
12514
14614
|
}
|
|
12515
14615
|
// Calculate cost
|
|
12516
|
-
const cost = calculateImageCost(imageModel, count || 1);
|
|
14616
|
+
const cost = calculateImageCost(imageModel, count || 1, quality, size);
|
|
12517
14617
|
// Return the response with enhanced usage information
|
|
12518
14618
|
const enhancedResponse = {
|
|
12519
14619
|
...response,
|
|
@@ -21570,9 +23670,11 @@ const disco = {
|
|
|
21570
23670
|
|
|
21571
23671
|
exports.AlpacaMarketDataAPI = AlpacaMarketDataAPI;
|
|
21572
23672
|
exports.AlpacaTradingAPI = AlpacaTradingAPI;
|
|
23673
|
+
exports.OPENAI_IMAGE_MODELS = OPENAI_IMAGE_MODELS;
|
|
21573
23674
|
exports.OPENAI_MODELS = OPENAI_MODELS;
|
|
21574
23675
|
exports.OPENROUTER_MODELS = OPENROUTER_MODELS;
|
|
21575
23676
|
exports.disco = disco;
|
|
23677
|
+
exports.isOpenAIImageModel = isOpenAIImageModel;
|
|
21576
23678
|
exports.isOpenAIModel = isOpenAIModel;
|
|
21577
23679
|
exports.isOpenRouterModel = isOpenRouterModel;
|
|
21578
23680
|
exports.supportsTemperature = supportsTemperature;
|