@discomedia/utils 1.0.69 → 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 +2318 -211
- package/dist/index-frontend.cjs.map +1 -1
- package/dist/index-frontend.mjs +2316 -212
- package/dist/index-frontend.mjs.map +1 -1
- package/dist/index.cjs +2318 -211
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2316 -212
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +4 -4
- package/dist/test.js +2313 -212
- package/dist/test.js.map +1 -1
- package/dist/types/index-frontend.d.ts +1 -0
- package/dist/types/index-frontend.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- 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 +14 -4
- package/dist/types/types/llm-types.d.ts.map +1 -1
- package/dist/types-frontend/index-frontend.d.ts +1 -0
- package/dist/types-frontend/index-frontend.d.ts.map +1 -1
- package/dist/types-frontend/index.d.ts +1 -0
- 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 +14 -4
- package/dist/types-frontend/types/llm-types.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1164,38 +1164,63 @@ 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
|
+
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Represents OpenRouter models
|
|
1188
|
+
*/
|
|
1189
|
+
const OPENROUTER_MODELS = [
|
|
1190
|
+
'openai/gpt-5',
|
|
1191
|
+
'openai/gpt-5-mini',
|
|
1192
|
+
'openai/gpt-5.4-mini',
|
|
1193
|
+
'openai/gpt-5-nano',
|
|
1194
|
+
'openai/gpt-5.1',
|
|
1195
|
+
'openai/gpt-5.4',
|
|
1196
|
+
'openai/gpt-5.4-pro',
|
|
1197
|
+
'openai/gpt-5.5',
|
|
1198
|
+
'openai/gpt-5.5-pro',
|
|
1199
|
+
'openai/gpt-5.2',
|
|
1200
|
+
'openai/gpt-5.2-pro',
|
|
1201
|
+
'openai/gpt-5.1-codex',
|
|
1202
|
+
'openai/gpt-5.1-codex-max',
|
|
1203
|
+
'openai/gpt-oss-120b',
|
|
1204
|
+
'z.ai/glm-4.5',
|
|
1205
|
+
'z.ai/glm-4.5-air',
|
|
1206
|
+
'google/gemini-2.5-flash',
|
|
1207
|
+
'google/gemini-2.5-flash-lite',
|
|
1208
|
+
'deepseek/deepseek-r1-0528',
|
|
1209
|
+
'deepseek/deepseek-chat-v3-0324',
|
|
1210
|
+
];
|
|
1167
1211
|
/**
|
|
1168
1212
|
* Type guard to check if a model is an OpenRouter model
|
|
1169
1213
|
*/
|
|
1170
1214
|
function isOpenRouterModel(model) {
|
|
1171
|
-
|
|
1172
|
-
'openai/gpt-5',
|
|
1173
|
-
'openai/gpt-5-mini',
|
|
1174
|
-
'openai/gpt-5.4-mini',
|
|
1175
|
-
'openai/gpt-5-nano',
|
|
1176
|
-
'openai/gpt-5.1',
|
|
1177
|
-
'openai/gpt-5.4',
|
|
1178
|
-
'openai/gpt-5.4-pro',
|
|
1179
|
-
'openai/gpt-5.5',
|
|
1180
|
-
'openai/gpt-5.5-pro',
|
|
1181
|
-
'openai/gpt-5.2',
|
|
1182
|
-
'openai/gpt-5.2-pro',
|
|
1183
|
-
'openai/gpt-5.1-codex',
|
|
1184
|
-
'openai/gpt-5.1-codex-max',
|
|
1185
|
-
'openai/gpt-oss-120b',
|
|
1186
|
-
'z.ai/glm-4.5',
|
|
1187
|
-
'z.ai/glm-4.5-air',
|
|
1188
|
-
'google/gemini-2.5-flash',
|
|
1189
|
-
'google/gemini-2.5-flash-lite',
|
|
1190
|
-
'deepseek/deepseek-r1-0528',
|
|
1191
|
-
'deepseek/deepseek-chat-v3-0324',
|
|
1192
|
-
];
|
|
1193
|
-
return openRouterModels.includes(model);
|
|
1215
|
+
return OPENROUTER_MODELS.includes(model);
|
|
1194
1216
|
}
|
|
1195
1217
|
|
|
1196
1218
|
var Types = /*#__PURE__*/Object.freeze({
|
|
1197
1219
|
__proto__: null,
|
|
1220
|
+
OPENAI_IMAGE_MODELS: OPENAI_IMAGE_MODELS,
|
|
1198
1221
|
OPENAI_MODELS: OPENAI_MODELS,
|
|
1222
|
+
OPENROUTER_MODELS: OPENROUTER_MODELS,
|
|
1223
|
+
isOpenAIImageModel: isOpenAIImageModel,
|
|
1199
1224
|
isOpenAIModel: isOpenAIModel,
|
|
1200
1225
|
isOpenRouterModel: isOpenRouterModel
|
|
1201
1226
|
});
|
|
@@ -1675,7 +1700,7 @@ const safeJSON = (text) => {
|
|
|
1675
1700
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
1676
1701
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
1677
1702
|
|
|
1678
|
-
const VERSION = '6.
|
|
1703
|
+
const VERSION = '6.37.0'; // x-release-please-version
|
|
1679
1704
|
|
|
1680
1705
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
1681
1706
|
const isRunningInBrowser = () => {
|
|
@@ -2495,6 +2520,8 @@ const formatRequestDetails = (details) => {
|
|
|
2495
2520
|
details.headers = Object.fromEntries((details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map(([name, value]) => [
|
|
2496
2521
|
name,
|
|
2497
2522
|
(name.toLowerCase() === 'authorization' ||
|
|
2523
|
+
name.toLowerCase() === 'api-key' ||
|
|
2524
|
+
name.toLowerCase() === 'x-api-key' ||
|
|
2498
2525
|
name.toLowerCase() === 'cookie' ||
|
|
2499
2526
|
name.toLowerCase() === 'set-cookie') ?
|
|
2500
2527
|
'***'
|
|
@@ -3055,6 +3082,36 @@ class ConversationCursorPage extends AbstractPage {
|
|
|
3055
3082
|
};
|
|
3056
3083
|
}
|
|
3057
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
|
+
}
|
|
3058
3115
|
|
|
3059
3116
|
const SUBJECT_TOKEN_TYPES = {
|
|
3060
3117
|
jwt: 'urn:ietf:params:oauth:token-type:jwt',
|
|
@@ -3457,7 +3514,7 @@ let Messages$1 = class Messages extends APIResource {
|
|
|
3457
3514
|
* ```
|
|
3458
3515
|
*/
|
|
3459
3516
|
list(completionID, query = {}, options) {
|
|
3460
|
-
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 } });
|
|
3461
3518
|
}
|
|
3462
3519
|
};
|
|
3463
3520
|
|
|
@@ -4803,123 +4860,1775 @@ class ChatCompletionStreamingRunner extends ChatCompletionStream {
|
|
|
4803
4860
|
runner._run(() => runner._fromReadableStream(stream));
|
|
4804
4861
|
return runner;
|
|
4805
4862
|
}
|
|
4806
|
-
static runTools(client, params, options) {
|
|
4807
|
-
const runner = new ChatCompletionStreamingRunner(
|
|
4808
|
-
// @ts-expect-error TODO these types are incompatible
|
|
4809
|
-
params);
|
|
4810
|
-
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}`, {
|
|
4811
6519
|
...options,
|
|
4812
|
-
|
|
4813
|
-
};
|
|
4814
|
-
runner._run(() => runner._runTools(client, params, opts));
|
|
4815
|
-
return runner;
|
|
6520
|
+
__security: { adminAPIKeyAuth: true },
|
|
6521
|
+
});
|
|
4816
6522
|
}
|
|
4817
6523
|
}
|
|
4818
6524
|
|
|
4819
6525
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4820
|
-
|
|
4821
|
-
* Given a list of messages comprising a conversation, the model will return a response.
|
|
4822
|
-
*/
|
|
4823
|
-
let Completions$1 = class Completions extends APIResource {
|
|
6526
|
+
class Users extends APIResource {
|
|
4824
6527
|
constructor() {
|
|
4825
6528
|
super(...arguments);
|
|
4826
|
-
this.
|
|
4827
|
-
}
|
|
4828
|
-
create(body, options) {
|
|
4829
|
-
return this._client.post('/chat/completions', { body, ...options, stream: body.stream ?? false });
|
|
6529
|
+
this.roles = new Roles(this._client);
|
|
4830
6530
|
}
|
|
4831
6531
|
/**
|
|
4832
|
-
*
|
|
4833
|
-
* the `store` parameter set to `true` will be returned.
|
|
6532
|
+
* Retrieves a user by their identifier.
|
|
4834
6533
|
*
|
|
4835
6534
|
* @example
|
|
4836
6535
|
* ```ts
|
|
4837
|
-
* const
|
|
4838
|
-
* await client.
|
|
6536
|
+
* const organizationUser =
|
|
6537
|
+
* await client.admin.organization.users.retrieve('user_id');
|
|
4839
6538
|
* ```
|
|
4840
6539
|
*/
|
|
4841
|
-
retrieve(
|
|
4842
|
-
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
|
+
});
|
|
4843
6545
|
}
|
|
4844
6546
|
/**
|
|
4845
|
-
*
|
|
4846
|
-
* with the `store` parameter set to `true` can be modified. Currently, the only
|
|
4847
|
-
* supported modification is to update the `metadata` field.
|
|
6547
|
+
* Modifies a user's role in the organization.
|
|
4848
6548
|
*
|
|
4849
6549
|
* @example
|
|
4850
6550
|
* ```ts
|
|
4851
|
-
* const
|
|
4852
|
-
* '
|
|
4853
|
-
* { metadata: { foo: 'string' } },
|
|
4854
|
-
* );
|
|
6551
|
+
* const organizationUser =
|
|
6552
|
+
* await client.admin.organization.users.update('user_id');
|
|
4855
6553
|
* ```
|
|
4856
6554
|
*/
|
|
4857
|
-
update(
|
|
4858
|
-
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
|
+
});
|
|
4859
6561
|
}
|
|
4860
6562
|
/**
|
|
4861
|
-
*
|
|
4862
|
-
* the `store` parameter set to `true` will be returned.
|
|
6563
|
+
* Lists all of the users in the organization.
|
|
4863
6564
|
*
|
|
4864
6565
|
* @example
|
|
4865
6566
|
* ```ts
|
|
4866
6567
|
* // Automatically fetches more pages as needed.
|
|
4867
|
-
* for await (const
|
|
6568
|
+
* for await (const organizationUser of client.admin.organization.users.list()) {
|
|
4868
6569
|
* // ...
|
|
4869
6570
|
* }
|
|
4870
6571
|
* ```
|
|
4871
6572
|
*/
|
|
4872
6573
|
list(query = {}, options) {
|
|
4873
|
-
return this._client.getAPIList('/
|
|
6574
|
+
return this._client.getAPIList('/organization/users', (ConversationCursorPage), {
|
|
6575
|
+
query,
|
|
6576
|
+
...options,
|
|
6577
|
+
__security: { adminAPIKeyAuth: true },
|
|
6578
|
+
});
|
|
4874
6579
|
}
|
|
4875
6580
|
/**
|
|
4876
|
-
*
|
|
4877
|
-
* with the `store` parameter set to `true` can be deleted.
|
|
6581
|
+
* Deletes a user from the organization.
|
|
4878
6582
|
*
|
|
4879
6583
|
* @example
|
|
4880
6584
|
* ```ts
|
|
4881
|
-
* const
|
|
4882
|
-
*
|
|
6585
|
+
* const user = await client.admin.organization.users.delete(
|
|
6586
|
+
* 'user_id',
|
|
6587
|
+
* );
|
|
4883
6588
|
* ```
|
|
4884
6589
|
*/
|
|
4885
|
-
delete(
|
|
4886
|
-
return this._client.delete(path `/
|
|
4887
|
-
}
|
|
4888
|
-
parse(body, options) {
|
|
4889
|
-
validateInputTools(body.tools);
|
|
4890
|
-
return this._client.chat.completions
|
|
4891
|
-
.create(body, {
|
|
6590
|
+
delete(userID, options) {
|
|
6591
|
+
return this._client.delete(path `/organization/users/${userID}`, {
|
|
4892
6592
|
...options,
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
'X-Stainless-Helper-Method': 'chat.completions.parse',
|
|
4896
|
-
},
|
|
4897
|
-
})
|
|
4898
|
-
._thenUnwrap((completion) => parseChatCompletion(completion, body));
|
|
4899
|
-
}
|
|
4900
|
-
runTools(body, options) {
|
|
4901
|
-
if (body.stream) {
|
|
4902
|
-
return ChatCompletionStreamingRunner.runTools(this._client, body, options);
|
|
4903
|
-
}
|
|
4904
|
-
return ChatCompletionRunner.runTools(this._client, body, options);
|
|
4905
|
-
}
|
|
4906
|
-
/**
|
|
4907
|
-
* Creates a chat completion stream
|
|
4908
|
-
*/
|
|
4909
|
-
stream(body, options) {
|
|
4910
|
-
return ChatCompletionStream.createChatCompletion(this._client, body, options);
|
|
6593
|
+
__security: { adminAPIKeyAuth: true },
|
|
6594
|
+
});
|
|
4911
6595
|
}
|
|
4912
|
-
}
|
|
4913
|
-
|
|
6596
|
+
}
|
|
6597
|
+
Users.Roles = Roles;
|
|
4914
6598
|
|
|
4915
6599
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4916
|
-
class
|
|
6600
|
+
class Organization extends APIResource {
|
|
4917
6601
|
constructor() {
|
|
4918
6602
|
super(...arguments);
|
|
4919
|
-
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);
|
|
4920
6629
|
}
|
|
4921
6630
|
}
|
|
4922
|
-
|
|
6631
|
+
Admin.Organization = Organization;
|
|
4923
6632
|
|
|
4924
6633
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4925
6634
|
const brand_privateNullableHeaders = /* @__PURE__ */ Symbol('brand.privateNullableHeaders');
|
|
@@ -5016,6 +6725,7 @@ class Speech extends APIResource {
|
|
|
5016
6725
|
body,
|
|
5017
6726
|
...options,
|
|
5018
6727
|
headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]),
|
|
6728
|
+
__security: { bearerAuth: true },
|
|
5019
6729
|
__binaryResponse: true,
|
|
5020
6730
|
});
|
|
5021
6731
|
}
|
|
@@ -5032,6 +6742,7 @@ class Transcriptions extends APIResource {
|
|
|
5032
6742
|
...options,
|
|
5033
6743
|
stream: body.stream ?? false,
|
|
5034
6744
|
__metadata: { model: body.model },
|
|
6745
|
+
__security: { bearerAuth: true },
|
|
5035
6746
|
}, this._client));
|
|
5036
6747
|
}
|
|
5037
6748
|
}
|
|
@@ -5042,7 +6753,7 @@ class Transcriptions extends APIResource {
|
|
|
5042
6753
|
*/
|
|
5043
6754
|
class Translations extends APIResource {
|
|
5044
6755
|
create(body, options) {
|
|
5045
|
-
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));
|
|
5046
6757
|
}
|
|
5047
6758
|
}
|
|
5048
6759
|
|
|
@@ -5068,19 +6779,23 @@ class Batches extends APIResource {
|
|
|
5068
6779
|
* Creates and executes a batch from an uploaded file of requests
|
|
5069
6780
|
*/
|
|
5070
6781
|
create(body, options) {
|
|
5071
|
-
return this._client.post('/batches', { body, ...options });
|
|
6782
|
+
return this._client.post('/batches', { body, ...options, __security: { bearerAuth: true } });
|
|
5072
6783
|
}
|
|
5073
6784
|
/**
|
|
5074
6785
|
* Retrieves a batch.
|
|
5075
6786
|
*/
|
|
5076
6787
|
retrieve(batchID, options) {
|
|
5077
|
-
return this._client.get(path `/batches/${batchID}`, options);
|
|
6788
|
+
return this._client.get(path `/batches/${batchID}`, { ...options, __security: { bearerAuth: true } });
|
|
5078
6789
|
}
|
|
5079
6790
|
/**
|
|
5080
6791
|
* List your organization's batches.
|
|
5081
6792
|
*/
|
|
5082
6793
|
list(query = {}, options) {
|
|
5083
|
-
return this._client.getAPIList('/batches', (CursorPage), {
|
|
6794
|
+
return this._client.getAPIList('/batches', (CursorPage), {
|
|
6795
|
+
query,
|
|
6796
|
+
...options,
|
|
6797
|
+
__security: { bearerAuth: true },
|
|
6798
|
+
});
|
|
5084
6799
|
}
|
|
5085
6800
|
/**
|
|
5086
6801
|
* Cancels an in-progress batch. The batch will be in status `cancelling` for up to
|
|
@@ -5088,7 +6803,10 @@ class Batches extends APIResource {
|
|
|
5088
6803
|
* (if any) available in the output file.
|
|
5089
6804
|
*/
|
|
5090
6805
|
cancel(batchID, options) {
|
|
5091
|
-
return this._client.post(path `/batches/${batchID}/cancel`,
|
|
6806
|
+
return this._client.post(path `/batches/${batchID}/cancel`, {
|
|
6807
|
+
...options,
|
|
6808
|
+
__security: { bearerAuth: true },
|
|
6809
|
+
});
|
|
5092
6810
|
}
|
|
5093
6811
|
}
|
|
5094
6812
|
|
|
@@ -5107,6 +6825,7 @@ class Assistants extends APIResource {
|
|
|
5107
6825
|
body,
|
|
5108
6826
|
...options,
|
|
5109
6827
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6828
|
+
__security: { bearerAuth: true },
|
|
5110
6829
|
});
|
|
5111
6830
|
}
|
|
5112
6831
|
/**
|
|
@@ -5118,6 +6837,7 @@ class Assistants extends APIResource {
|
|
|
5118
6837
|
return this._client.get(path `/assistants/${assistantID}`, {
|
|
5119
6838
|
...options,
|
|
5120
6839
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6840
|
+
__security: { bearerAuth: true },
|
|
5121
6841
|
});
|
|
5122
6842
|
}
|
|
5123
6843
|
/**
|
|
@@ -5130,6 +6850,7 @@ class Assistants extends APIResource {
|
|
|
5130
6850
|
body,
|
|
5131
6851
|
...options,
|
|
5132
6852
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6853
|
+
__security: { bearerAuth: true },
|
|
5133
6854
|
});
|
|
5134
6855
|
}
|
|
5135
6856
|
/**
|
|
@@ -5142,6 +6863,7 @@ class Assistants extends APIResource {
|
|
|
5142
6863
|
query,
|
|
5143
6864
|
...options,
|
|
5144
6865
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6866
|
+
__security: { bearerAuth: true },
|
|
5145
6867
|
});
|
|
5146
6868
|
}
|
|
5147
6869
|
/**
|
|
@@ -5153,6 +6875,7 @@ class Assistants extends APIResource {
|
|
|
5153
6875
|
return this._client.delete(path `/assistants/${assistantID}`, {
|
|
5154
6876
|
...options,
|
|
5155
6877
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6878
|
+
__security: { bearerAuth: true },
|
|
5156
6879
|
});
|
|
5157
6880
|
}
|
|
5158
6881
|
}
|
|
@@ -5179,6 +6902,7 @@ let Sessions$1 = class Sessions extends APIResource {
|
|
|
5179
6902
|
body,
|
|
5180
6903
|
...options,
|
|
5181
6904
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6905
|
+
__security: { bearerAuth: true },
|
|
5182
6906
|
});
|
|
5183
6907
|
}
|
|
5184
6908
|
};
|
|
@@ -5205,6 +6929,7 @@ class TranscriptionSessions extends APIResource {
|
|
|
5205
6929
|
body,
|
|
5206
6930
|
...options,
|
|
5207
6931
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6932
|
+
__security: { bearerAuth: true },
|
|
5208
6933
|
});
|
|
5209
6934
|
}
|
|
5210
6935
|
}
|
|
@@ -5242,6 +6967,7 @@ class Sessions extends APIResource {
|
|
|
5242
6967
|
body,
|
|
5243
6968
|
...options,
|
|
5244
6969
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
6970
|
+
__security: { bearerAuth: true },
|
|
5245
6971
|
});
|
|
5246
6972
|
}
|
|
5247
6973
|
/**
|
|
@@ -5259,6 +6985,7 @@ class Sessions extends APIResource {
|
|
|
5259
6985
|
return this._client.post(path `/chatkit/sessions/${sessionID}/cancel`, {
|
|
5260
6986
|
...options,
|
|
5261
6987
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
6988
|
+
__security: { bearerAuth: true },
|
|
5262
6989
|
});
|
|
5263
6990
|
}
|
|
5264
6991
|
}
|
|
@@ -5278,6 +7005,7 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
5278
7005
|
return this._client.get(path `/chatkit/threads/${threadID}`, {
|
|
5279
7006
|
...options,
|
|
5280
7007
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
7008
|
+
__security: { bearerAuth: true },
|
|
5281
7009
|
});
|
|
5282
7010
|
}
|
|
5283
7011
|
/**
|
|
@@ -5296,6 +7024,7 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
5296
7024
|
query,
|
|
5297
7025
|
...options,
|
|
5298
7026
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
7027
|
+
__security: { bearerAuth: true },
|
|
5299
7028
|
});
|
|
5300
7029
|
}
|
|
5301
7030
|
/**
|
|
@@ -5312,6 +7041,7 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
5312
7041
|
return this._client.delete(path `/chatkit/threads/${threadID}`, {
|
|
5313
7042
|
...options,
|
|
5314
7043
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
7044
|
+
__security: { bearerAuth: true },
|
|
5315
7045
|
});
|
|
5316
7046
|
}
|
|
5317
7047
|
/**
|
|
@@ -5328,7 +7058,12 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
5328
7058
|
* ```
|
|
5329
7059
|
*/
|
|
5330
7060
|
listItems(threadID, query = {}, options) {
|
|
5331
|
-
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
|
+
});
|
|
5332
7067
|
}
|
|
5333
7068
|
};
|
|
5334
7069
|
|
|
@@ -5360,6 +7095,7 @@ class Messages extends APIResource {
|
|
|
5360
7095
|
body,
|
|
5361
7096
|
...options,
|
|
5362
7097
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7098
|
+
__security: { bearerAuth: true },
|
|
5363
7099
|
});
|
|
5364
7100
|
}
|
|
5365
7101
|
/**
|
|
@@ -5372,6 +7108,7 @@ class Messages extends APIResource {
|
|
|
5372
7108
|
return this._client.get(path `/threads/${thread_id}/messages/${messageID}`, {
|
|
5373
7109
|
...options,
|
|
5374
7110
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7111
|
+
__security: { bearerAuth: true },
|
|
5375
7112
|
});
|
|
5376
7113
|
}
|
|
5377
7114
|
/**
|
|
@@ -5385,6 +7122,7 @@ class Messages extends APIResource {
|
|
|
5385
7122
|
body,
|
|
5386
7123
|
...options,
|
|
5387
7124
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7125
|
+
__security: { bearerAuth: true },
|
|
5388
7126
|
});
|
|
5389
7127
|
}
|
|
5390
7128
|
/**
|
|
@@ -5397,6 +7135,7 @@ class Messages extends APIResource {
|
|
|
5397
7135
|
query,
|
|
5398
7136
|
...options,
|
|
5399
7137
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7138
|
+
__security: { bearerAuth: true },
|
|
5400
7139
|
});
|
|
5401
7140
|
}
|
|
5402
7141
|
/**
|
|
@@ -5409,6 +7148,7 @@ class Messages extends APIResource {
|
|
|
5409
7148
|
return this._client.delete(path `/threads/${thread_id}/messages/${messageID}`, {
|
|
5410
7149
|
...options,
|
|
5411
7150
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7151
|
+
__security: { bearerAuth: true },
|
|
5412
7152
|
});
|
|
5413
7153
|
}
|
|
5414
7154
|
}
|
|
@@ -5431,6 +7171,7 @@ class Steps extends APIResource {
|
|
|
5431
7171
|
query,
|
|
5432
7172
|
...options,
|
|
5433
7173
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7174
|
+
__security: { bearerAuth: true },
|
|
5434
7175
|
});
|
|
5435
7176
|
}
|
|
5436
7177
|
/**
|
|
@@ -5444,6 +7185,7 @@ class Steps extends APIResource {
|
|
|
5444
7185
|
query,
|
|
5445
7186
|
...options,
|
|
5446
7187
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7188
|
+
__security: { bearerAuth: true },
|
|
5447
7189
|
});
|
|
5448
7190
|
}
|
|
5449
7191
|
}
|
|
@@ -6047,6 +7789,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
6047
7789
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6048
7790
|
stream: params.stream ?? false,
|
|
6049
7791
|
__synthesizeEventData: true,
|
|
7792
|
+
__security: { bearerAuth: true },
|
|
6050
7793
|
});
|
|
6051
7794
|
}
|
|
6052
7795
|
/**
|
|
@@ -6059,6 +7802,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
6059
7802
|
return this._client.get(path `/threads/${thread_id}/runs/${runID}`, {
|
|
6060
7803
|
...options,
|
|
6061
7804
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7805
|
+
__security: { bearerAuth: true },
|
|
6062
7806
|
});
|
|
6063
7807
|
}
|
|
6064
7808
|
/**
|
|
@@ -6072,6 +7816,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
6072
7816
|
body,
|
|
6073
7817
|
...options,
|
|
6074
7818
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7819
|
+
__security: { bearerAuth: true },
|
|
6075
7820
|
});
|
|
6076
7821
|
}
|
|
6077
7822
|
/**
|
|
@@ -6084,6 +7829,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
6084
7829
|
query,
|
|
6085
7830
|
...options,
|
|
6086
7831
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7832
|
+
__security: { bearerAuth: true },
|
|
6087
7833
|
});
|
|
6088
7834
|
}
|
|
6089
7835
|
/**
|
|
@@ -6096,6 +7842,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
6096
7842
|
return this._client.post(path `/threads/${thread_id}/runs/${runID}/cancel`, {
|
|
6097
7843
|
...options,
|
|
6098
7844
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7845
|
+
__security: { bearerAuth: true },
|
|
6099
7846
|
});
|
|
6100
7847
|
}
|
|
6101
7848
|
/**
|
|
@@ -6178,6 +7925,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
6178
7925
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6179
7926
|
stream: params.stream ?? false,
|
|
6180
7927
|
__synthesizeEventData: true,
|
|
7928
|
+
__security: { bearerAuth: true },
|
|
6181
7929
|
});
|
|
6182
7930
|
}
|
|
6183
7931
|
/**
|
|
@@ -6222,6 +7970,7 @@ class Threads extends APIResource {
|
|
|
6222
7970
|
body,
|
|
6223
7971
|
...options,
|
|
6224
7972
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7973
|
+
__security: { bearerAuth: true },
|
|
6225
7974
|
});
|
|
6226
7975
|
}
|
|
6227
7976
|
/**
|
|
@@ -6233,6 +7982,7 @@ class Threads extends APIResource {
|
|
|
6233
7982
|
return this._client.get(path `/threads/${threadID}`, {
|
|
6234
7983
|
...options,
|
|
6235
7984
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7985
|
+
__security: { bearerAuth: true },
|
|
6236
7986
|
});
|
|
6237
7987
|
}
|
|
6238
7988
|
/**
|
|
@@ -6245,6 +7995,7 @@ class Threads extends APIResource {
|
|
|
6245
7995
|
body,
|
|
6246
7996
|
...options,
|
|
6247
7997
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7998
|
+
__security: { bearerAuth: true },
|
|
6248
7999
|
});
|
|
6249
8000
|
}
|
|
6250
8001
|
/**
|
|
@@ -6256,6 +8007,7 @@ class Threads extends APIResource {
|
|
|
6256
8007
|
return this._client.delete(path `/threads/${threadID}`, {
|
|
6257
8008
|
...options,
|
|
6258
8009
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8010
|
+
__security: { bearerAuth: true },
|
|
6259
8011
|
});
|
|
6260
8012
|
}
|
|
6261
8013
|
createAndRun(body, options) {
|
|
@@ -6265,6 +8017,7 @@ class Threads extends APIResource {
|
|
|
6265
8017
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6266
8018
|
stream: body.stream ?? false,
|
|
6267
8019
|
__synthesizeEventData: true,
|
|
8020
|
+
__security: { bearerAuth: true },
|
|
6268
8021
|
});
|
|
6269
8022
|
}
|
|
6270
8023
|
/**
|
|
@@ -6307,7 +8060,12 @@ Beta.Threads = Threads;
|
|
|
6307
8060
|
*/
|
|
6308
8061
|
class Completions extends APIResource {
|
|
6309
8062
|
create(body, options) {
|
|
6310
|
-
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
|
+
});
|
|
6311
8069
|
}
|
|
6312
8070
|
}
|
|
6313
8071
|
|
|
@@ -6321,6 +8079,7 @@ let Content$2 = class Content extends APIResource {
|
|
|
6321
8079
|
return this._client.get(path `/containers/${container_id}/files/${fileID}/content`, {
|
|
6322
8080
|
...options,
|
|
6323
8081
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
8082
|
+
__security: { bearerAuth: true },
|
|
6324
8083
|
__binaryResponse: true,
|
|
6325
8084
|
});
|
|
6326
8085
|
}
|
|
@@ -6339,14 +8098,17 @@ let Files$2 = class Files extends APIResource {
|
|
|
6339
8098
|
* a JSON request with a file ID.
|
|
6340
8099
|
*/
|
|
6341
8100
|
create(containerID, body, options) {
|
|
6342
|
-
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));
|
|
6343
8102
|
}
|
|
6344
8103
|
/**
|
|
6345
8104
|
* Retrieve Container File
|
|
6346
8105
|
*/
|
|
6347
8106
|
retrieve(fileID, params, options) {
|
|
6348
8107
|
const { container_id } = params;
|
|
6349
|
-
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
|
+
});
|
|
6350
8112
|
}
|
|
6351
8113
|
/**
|
|
6352
8114
|
* List Container files
|
|
@@ -6355,6 +8117,7 @@ let Files$2 = class Files extends APIResource {
|
|
|
6355
8117
|
return this._client.getAPIList(path `/containers/${containerID}/files`, (CursorPage), {
|
|
6356
8118
|
query,
|
|
6357
8119
|
...options,
|
|
8120
|
+
__security: { bearerAuth: true },
|
|
6358
8121
|
});
|
|
6359
8122
|
}
|
|
6360
8123
|
/**
|
|
@@ -6365,6 +8128,7 @@ let Files$2 = class Files extends APIResource {
|
|
|
6365
8128
|
return this._client.delete(path `/containers/${container_id}/files/${fileID}`, {
|
|
6366
8129
|
...options,
|
|
6367
8130
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
8131
|
+
__security: { bearerAuth: true },
|
|
6368
8132
|
});
|
|
6369
8133
|
}
|
|
6370
8134
|
};
|
|
@@ -6380,19 +8144,26 @@ class Containers extends APIResource {
|
|
|
6380
8144
|
* Create Container
|
|
6381
8145
|
*/
|
|
6382
8146
|
create(body, options) {
|
|
6383
|
-
return this._client.post('/containers', { body, ...options });
|
|
8147
|
+
return this._client.post('/containers', { body, ...options, __security: { bearerAuth: true } });
|
|
6384
8148
|
}
|
|
6385
8149
|
/**
|
|
6386
8150
|
* Retrieve Container
|
|
6387
8151
|
*/
|
|
6388
8152
|
retrieve(containerID, options) {
|
|
6389
|
-
return this._client.get(path `/containers/${containerID}`,
|
|
8153
|
+
return this._client.get(path `/containers/${containerID}`, {
|
|
8154
|
+
...options,
|
|
8155
|
+
__security: { bearerAuth: true },
|
|
8156
|
+
});
|
|
6390
8157
|
}
|
|
6391
8158
|
/**
|
|
6392
8159
|
* List Containers
|
|
6393
8160
|
*/
|
|
6394
8161
|
list(query = {}, options) {
|
|
6395
|
-
return this._client.getAPIList('/containers', (CursorPage), {
|
|
8162
|
+
return this._client.getAPIList('/containers', (CursorPage), {
|
|
8163
|
+
query,
|
|
8164
|
+
...options,
|
|
8165
|
+
__security: { bearerAuth: true },
|
|
8166
|
+
});
|
|
6396
8167
|
}
|
|
6397
8168
|
/**
|
|
6398
8169
|
* Delete Container
|
|
@@ -6401,6 +8172,7 @@ class Containers extends APIResource {
|
|
|
6401
8172
|
return this._client.delete(path `/containers/${containerID}`, {
|
|
6402
8173
|
...options,
|
|
6403
8174
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
8175
|
+
__security: { bearerAuth: true },
|
|
6404
8176
|
});
|
|
6405
8177
|
}
|
|
6406
8178
|
}
|
|
@@ -6420,6 +8192,7 @@ class Items extends APIResource {
|
|
|
6420
8192
|
query: { include },
|
|
6421
8193
|
body,
|
|
6422
8194
|
...options,
|
|
8195
|
+
__security: { bearerAuth: true },
|
|
6423
8196
|
});
|
|
6424
8197
|
}
|
|
6425
8198
|
/**
|
|
@@ -6427,20 +8200,27 @@ class Items extends APIResource {
|
|
|
6427
8200
|
*/
|
|
6428
8201
|
retrieve(itemID, params, options) {
|
|
6429
8202
|
const { conversation_id, ...query } = params;
|
|
6430
|
-
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
|
+
});
|
|
6431
8208
|
}
|
|
6432
8209
|
/**
|
|
6433
8210
|
* List all items for a conversation with the given ID.
|
|
6434
8211
|
*/
|
|
6435
8212
|
list(conversationID, query = {}, options) {
|
|
6436
|
-
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 } });
|
|
6437
8214
|
}
|
|
6438
8215
|
/**
|
|
6439
8216
|
* Delete an item from a conversation with the given IDs.
|
|
6440
8217
|
*/
|
|
6441
8218
|
delete(itemID, params, options) {
|
|
6442
8219
|
const { conversation_id } = params;
|
|
6443
|
-
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
|
+
});
|
|
6444
8224
|
}
|
|
6445
8225
|
}
|
|
6446
8226
|
|
|
@@ -6457,25 +8237,35 @@ class Conversations extends APIResource {
|
|
|
6457
8237
|
* Create a conversation.
|
|
6458
8238
|
*/
|
|
6459
8239
|
create(body = {}, options) {
|
|
6460
|
-
return this._client.post('/conversations', { body, ...options });
|
|
8240
|
+
return this._client.post('/conversations', { body, ...options, __security: { bearerAuth: true } });
|
|
6461
8241
|
}
|
|
6462
8242
|
/**
|
|
6463
8243
|
* Get a conversation
|
|
6464
8244
|
*/
|
|
6465
8245
|
retrieve(conversationID, options) {
|
|
6466
|
-
return this._client.get(path `/conversations/${conversationID}`,
|
|
8246
|
+
return this._client.get(path `/conversations/${conversationID}`, {
|
|
8247
|
+
...options,
|
|
8248
|
+
__security: { bearerAuth: true },
|
|
8249
|
+
});
|
|
6467
8250
|
}
|
|
6468
8251
|
/**
|
|
6469
8252
|
* Update a conversation
|
|
6470
8253
|
*/
|
|
6471
8254
|
update(conversationID, body, options) {
|
|
6472
|
-
return this._client.post(path `/conversations/${conversationID}`, {
|
|
8255
|
+
return this._client.post(path `/conversations/${conversationID}`, {
|
|
8256
|
+
body,
|
|
8257
|
+
...options,
|
|
8258
|
+
__security: { bearerAuth: true },
|
|
8259
|
+
});
|
|
6473
8260
|
}
|
|
6474
8261
|
/**
|
|
6475
8262
|
* Delete a conversation. Items in the conversation will not be deleted.
|
|
6476
8263
|
*/
|
|
6477
8264
|
delete(conversationID, options) {
|
|
6478
|
-
return this._client.delete(path `/conversations/${conversationID}`,
|
|
8265
|
+
return this._client.delete(path `/conversations/${conversationID}`, {
|
|
8266
|
+
...options,
|
|
8267
|
+
__security: { bearerAuth: true },
|
|
8268
|
+
});
|
|
6479
8269
|
}
|
|
6480
8270
|
}
|
|
6481
8271
|
Conversations.Items = Items;
|
|
@@ -6511,6 +8301,7 @@ class Embeddings extends APIResource {
|
|
|
6511
8301
|
encoding_format: encoding_format,
|
|
6512
8302
|
},
|
|
6513
8303
|
...options,
|
|
8304
|
+
__security: { bearerAuth: true },
|
|
6514
8305
|
});
|
|
6515
8306
|
// if the user specified an encoding_format, return the response as-is
|
|
6516
8307
|
if (hasUserProvidedEncodingFormat) {
|
|
@@ -6543,14 +8334,17 @@ class OutputItems extends APIResource {
|
|
|
6543
8334
|
*/
|
|
6544
8335
|
retrieve(outputItemID, params, options) {
|
|
6545
8336
|
const { eval_id, run_id } = params;
|
|
6546
|
-
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
|
+
});
|
|
6547
8341
|
}
|
|
6548
8342
|
/**
|
|
6549
8343
|
* Get a list of output items for an evaluation run.
|
|
6550
8344
|
*/
|
|
6551
8345
|
list(runID, params, options) {
|
|
6552
8346
|
const { eval_id, ...query } = params;
|
|
6553
|
-
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 } });
|
|
6554
8348
|
}
|
|
6555
8349
|
}
|
|
6556
8350
|
|
|
@@ -6569,14 +8363,21 @@ class Runs extends APIResource {
|
|
|
6569
8363
|
* schema specified in the config of the evaluation.
|
|
6570
8364
|
*/
|
|
6571
8365
|
create(evalID, body, options) {
|
|
6572
|
-
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
|
+
});
|
|
6573
8371
|
}
|
|
6574
8372
|
/**
|
|
6575
8373
|
* Get an evaluation run by ID.
|
|
6576
8374
|
*/
|
|
6577
8375
|
retrieve(runID, params, options) {
|
|
6578
8376
|
const { eval_id } = params;
|
|
6579
|
-
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
|
+
});
|
|
6580
8381
|
}
|
|
6581
8382
|
/**
|
|
6582
8383
|
* Get a list of runs for an evaluation.
|
|
@@ -6585,6 +8386,7 @@ class Runs extends APIResource {
|
|
|
6585
8386
|
return this._client.getAPIList(path `/evals/${evalID}/runs`, (CursorPage), {
|
|
6586
8387
|
query,
|
|
6587
8388
|
...options,
|
|
8389
|
+
__security: { bearerAuth: true },
|
|
6588
8390
|
});
|
|
6589
8391
|
}
|
|
6590
8392
|
/**
|
|
@@ -6592,14 +8394,20 @@ class Runs extends APIResource {
|
|
|
6592
8394
|
*/
|
|
6593
8395
|
delete(runID, params, options) {
|
|
6594
8396
|
const { eval_id } = params;
|
|
6595
|
-
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
|
+
});
|
|
6596
8401
|
}
|
|
6597
8402
|
/**
|
|
6598
8403
|
* Cancel an ongoing evaluation run.
|
|
6599
8404
|
*/
|
|
6600
8405
|
cancel(runID, params, options) {
|
|
6601
8406
|
const { eval_id } = params;
|
|
6602
|
-
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
|
+
});
|
|
6603
8411
|
}
|
|
6604
8412
|
}
|
|
6605
8413
|
Runs.OutputItems = OutputItems;
|
|
@@ -6622,31 +8430,35 @@ class Evals extends APIResource {
|
|
|
6622
8430
|
* the [Evals guide](https://platform.openai.com/docs/guides/evals).
|
|
6623
8431
|
*/
|
|
6624
8432
|
create(body, options) {
|
|
6625
|
-
return this._client.post('/evals', { body, ...options });
|
|
8433
|
+
return this._client.post('/evals', { body, ...options, __security: { bearerAuth: true } });
|
|
6626
8434
|
}
|
|
6627
8435
|
/**
|
|
6628
8436
|
* Get an evaluation by ID.
|
|
6629
8437
|
*/
|
|
6630
8438
|
retrieve(evalID, options) {
|
|
6631
|
-
return this._client.get(path `/evals/${evalID}`, options);
|
|
8439
|
+
return this._client.get(path `/evals/${evalID}`, { ...options, __security: { bearerAuth: true } });
|
|
6632
8440
|
}
|
|
6633
8441
|
/**
|
|
6634
8442
|
* Update certain properties of an evaluation.
|
|
6635
8443
|
*/
|
|
6636
8444
|
update(evalID, body, options) {
|
|
6637
|
-
return this._client.post(path `/evals/${evalID}`, { body, ...options });
|
|
8445
|
+
return this._client.post(path `/evals/${evalID}`, { body, ...options, __security: { bearerAuth: true } });
|
|
6638
8446
|
}
|
|
6639
8447
|
/**
|
|
6640
8448
|
* List evaluations for a project.
|
|
6641
8449
|
*/
|
|
6642
8450
|
list(query = {}, options) {
|
|
6643
|
-
return this._client.getAPIList('/evals', (CursorPage), {
|
|
8451
|
+
return this._client.getAPIList('/evals', (CursorPage), {
|
|
8452
|
+
query,
|
|
8453
|
+
...options,
|
|
8454
|
+
__security: { bearerAuth: true },
|
|
8455
|
+
});
|
|
6644
8456
|
}
|
|
6645
8457
|
/**
|
|
6646
8458
|
* Delete an evaluation.
|
|
6647
8459
|
*/
|
|
6648
8460
|
delete(evalID, options) {
|
|
6649
|
-
return this._client.delete(path `/evals/${evalID}`, options);
|
|
8461
|
+
return this._client.delete(path `/evals/${evalID}`, { ...options, __security: { bearerAuth: true } });
|
|
6650
8462
|
}
|
|
6651
8463
|
}
|
|
6652
8464
|
Evals.Runs = Runs;
|
|
@@ -6659,7 +8471,8 @@ let Files$1 = class Files extends APIResource {
|
|
|
6659
8471
|
/**
|
|
6660
8472
|
* Upload a file that can be used across various endpoints. Individual files can be
|
|
6661
8473
|
* up to 512 MB, and each project can store up to 2.5 TB of files in total. There
|
|
6662
|
-
* 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.
|
|
6663
8476
|
*
|
|
6664
8477
|
* - The Assistants API supports files up to 2 million tokens and of specific file
|
|
6665
8478
|
* types. See the
|
|
@@ -6674,30 +8487,40 @@ let Files$1 = class Files extends APIResource {
|
|
|
6674
8487
|
* - The Batch API only supports `.jsonl` files up to 200 MB in size. The input
|
|
6675
8488
|
* also has a specific required
|
|
6676
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.
|
|
6677
8496
|
*
|
|
6678
8497
|
* Please [contact us](https://help.openai.com/) if you need to increase these
|
|
6679
8498
|
* storage limits.
|
|
6680
8499
|
*/
|
|
6681
8500
|
create(body, options) {
|
|
6682
|
-
return this._client.post('/files', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
8501
|
+
return this._client.post('/files', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
6683
8502
|
}
|
|
6684
8503
|
/**
|
|
6685
8504
|
* Returns information about a specific file.
|
|
6686
8505
|
*/
|
|
6687
8506
|
retrieve(fileID, options) {
|
|
6688
|
-
return this._client.get(path `/files/${fileID}`, options);
|
|
8507
|
+
return this._client.get(path `/files/${fileID}`, { ...options, __security: { bearerAuth: true } });
|
|
6689
8508
|
}
|
|
6690
8509
|
/**
|
|
6691
8510
|
* Returns a list of files.
|
|
6692
8511
|
*/
|
|
6693
8512
|
list(query = {}, options) {
|
|
6694
|
-
return this._client.getAPIList('/files', (CursorPage), {
|
|
8513
|
+
return this._client.getAPIList('/files', (CursorPage), {
|
|
8514
|
+
query,
|
|
8515
|
+
...options,
|
|
8516
|
+
__security: { bearerAuth: true },
|
|
8517
|
+
});
|
|
6695
8518
|
}
|
|
6696
8519
|
/**
|
|
6697
8520
|
* Delete a file and remove it from all vector stores.
|
|
6698
8521
|
*/
|
|
6699
8522
|
delete(fileID, options) {
|
|
6700
|
-
return this._client.delete(path `/files/${fileID}`, options);
|
|
8523
|
+
return this._client.delete(path `/files/${fileID}`, { ...options, __security: { bearerAuth: true } });
|
|
6701
8524
|
}
|
|
6702
8525
|
/**
|
|
6703
8526
|
* Returns the contents of the specified file.
|
|
@@ -6706,6 +8529,7 @@ let Files$1 = class Files extends APIResource {
|
|
|
6706
8529
|
return this._client.get(path `/files/${fileID}/content`, {
|
|
6707
8530
|
...options,
|
|
6708
8531
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
8532
|
+
__security: { bearerAuth: true },
|
|
6709
8533
|
__binaryResponse: true,
|
|
6710
8534
|
});
|
|
6711
8535
|
}
|
|
@@ -6756,7 +8580,11 @@ let Graders$1 = class Graders extends APIResource {
|
|
|
6756
8580
|
* ```
|
|
6757
8581
|
*/
|
|
6758
8582
|
run(body, options) {
|
|
6759
|
-
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
|
+
});
|
|
6760
8588
|
}
|
|
6761
8589
|
/**
|
|
6762
8590
|
* Validate a grader.
|
|
@@ -6776,7 +8604,11 @@ let Graders$1 = class Graders extends APIResource {
|
|
|
6776
8604
|
* ```
|
|
6777
8605
|
*/
|
|
6778
8606
|
validate(body, options) {
|
|
6779
|
-
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
|
+
});
|
|
6780
8612
|
}
|
|
6781
8613
|
};
|
|
6782
8614
|
|
|
@@ -6812,7 +8644,7 @@ class Permissions extends APIResource {
|
|
|
6812
8644
|
* ```
|
|
6813
8645
|
*/
|
|
6814
8646
|
create(fineTunedModelCheckpoint, body, options) {
|
|
6815
|
-
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 } });
|
|
6816
8648
|
}
|
|
6817
8649
|
/**
|
|
6818
8650
|
* **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
|
|
@@ -6826,6 +8658,7 @@ class Permissions extends APIResource {
|
|
|
6826
8658
|
return this._client.get(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, {
|
|
6827
8659
|
query,
|
|
6828
8660
|
...options,
|
|
8661
|
+
__security: { adminAPIKeyAuth: true },
|
|
6829
8662
|
});
|
|
6830
8663
|
}
|
|
6831
8664
|
/**
|
|
@@ -6845,7 +8678,7 @@ class Permissions extends APIResource {
|
|
|
6845
8678
|
* ```
|
|
6846
8679
|
*/
|
|
6847
8680
|
list(fineTunedModelCheckpoint, query = {}, options) {
|
|
6848
|
-
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 } });
|
|
6849
8682
|
}
|
|
6850
8683
|
/**
|
|
6851
8684
|
* **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
|
|
@@ -6867,7 +8700,7 @@ class Permissions extends APIResource {
|
|
|
6867
8700
|
*/
|
|
6868
8701
|
delete(permissionID, params, options) {
|
|
6869
8702
|
const { fine_tuned_model_checkpoint } = params;
|
|
6870
|
-
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 } });
|
|
6871
8704
|
}
|
|
6872
8705
|
}
|
|
6873
8706
|
|
|
@@ -6899,7 +8732,7 @@ class Checkpoints extends APIResource {
|
|
|
6899
8732
|
* ```
|
|
6900
8733
|
*/
|
|
6901
8734
|
list(fineTuningJobID, query = {}, options) {
|
|
6902
|
-
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 } });
|
|
6903
8736
|
}
|
|
6904
8737
|
}
|
|
6905
8738
|
|
|
@@ -6930,7 +8763,7 @@ class Jobs extends APIResource {
|
|
|
6930
8763
|
* ```
|
|
6931
8764
|
*/
|
|
6932
8765
|
create(body, options) {
|
|
6933
|
-
return this._client.post('/fine_tuning/jobs', { body, ...options });
|
|
8766
|
+
return this._client.post('/fine_tuning/jobs', { body, ...options, __security: { bearerAuth: true } });
|
|
6934
8767
|
}
|
|
6935
8768
|
/**
|
|
6936
8769
|
* Get info about a fine-tuning job.
|
|
@@ -6945,7 +8778,10 @@ class Jobs extends APIResource {
|
|
|
6945
8778
|
* ```
|
|
6946
8779
|
*/
|
|
6947
8780
|
retrieve(fineTuningJobID, options) {
|
|
6948
|
-
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
|
+
});
|
|
6949
8785
|
}
|
|
6950
8786
|
/**
|
|
6951
8787
|
* List your organization's fine-tuning jobs
|
|
@@ -6959,7 +8795,11 @@ class Jobs extends APIResource {
|
|
|
6959
8795
|
* ```
|
|
6960
8796
|
*/
|
|
6961
8797
|
list(query = {}, options) {
|
|
6962
|
-
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
|
+
});
|
|
6963
8803
|
}
|
|
6964
8804
|
/**
|
|
6965
8805
|
* Immediately cancel a fine-tune job.
|
|
@@ -6972,7 +8812,10 @@ class Jobs extends APIResource {
|
|
|
6972
8812
|
* ```
|
|
6973
8813
|
*/
|
|
6974
8814
|
cancel(fineTuningJobID, options) {
|
|
6975
|
-
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
|
+
});
|
|
6976
8819
|
}
|
|
6977
8820
|
/**
|
|
6978
8821
|
* Get status updates for a fine-tuning job.
|
|
@@ -6988,7 +8831,7 @@ class Jobs extends APIResource {
|
|
|
6988
8831
|
* ```
|
|
6989
8832
|
*/
|
|
6990
8833
|
listEvents(fineTuningJobID, query = {}, options) {
|
|
6991
|
-
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 } });
|
|
6992
8835
|
}
|
|
6993
8836
|
/**
|
|
6994
8837
|
* Pause a fine-tune job.
|
|
@@ -7001,7 +8844,10 @@ class Jobs extends APIResource {
|
|
|
7001
8844
|
* ```
|
|
7002
8845
|
*/
|
|
7003
8846
|
pause(fineTuningJobID, options) {
|
|
7004
|
-
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
|
+
});
|
|
7005
8851
|
}
|
|
7006
8852
|
/**
|
|
7007
8853
|
* Resume a fine-tune job.
|
|
@@ -7014,7 +8860,10 @@ class Jobs extends APIResource {
|
|
|
7014
8860
|
* ```
|
|
7015
8861
|
*/
|
|
7016
8862
|
resume(fineTuningJobID, options) {
|
|
7017
|
-
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
|
+
});
|
|
7018
8867
|
}
|
|
7019
8868
|
}
|
|
7020
8869
|
Jobs.Checkpoints = Checkpoints;
|
|
@@ -7063,13 +8912,18 @@ class Images extends APIResource {
|
|
|
7063
8912
|
* ```
|
|
7064
8913
|
*/
|
|
7065
8914
|
createVariation(body, options) {
|
|
7066
|
-
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));
|
|
7067
8916
|
}
|
|
7068
8917
|
edit(body, options) {
|
|
7069
|
-
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));
|
|
7070
8919
|
}
|
|
7071
8920
|
generate(body, options) {
|
|
7072
|
-
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
|
+
});
|
|
7073
8927
|
}
|
|
7074
8928
|
}
|
|
7075
8929
|
|
|
@@ -7083,21 +8937,21 @@ class Models extends APIResource {
|
|
|
7083
8937
|
* the owner and permissioning.
|
|
7084
8938
|
*/
|
|
7085
8939
|
retrieve(model, options) {
|
|
7086
|
-
return this._client.get(path `/models/${model}`, options);
|
|
8940
|
+
return this._client.get(path `/models/${model}`, { ...options, __security: { bearerAuth: true } });
|
|
7087
8941
|
}
|
|
7088
8942
|
/**
|
|
7089
8943
|
* Lists the currently available models, and provides basic information about each
|
|
7090
8944
|
* one such as the owner and availability.
|
|
7091
8945
|
*/
|
|
7092
8946
|
list(options) {
|
|
7093
|
-
return this._client.getAPIList('/models', (Page), options);
|
|
8947
|
+
return this._client.getAPIList('/models', (Page), { ...options, __security: { bearerAuth: true } });
|
|
7094
8948
|
}
|
|
7095
8949
|
/**
|
|
7096
8950
|
* Delete a fine-tuned model. You must have the Owner role in your organization to
|
|
7097
8951
|
* delete a model.
|
|
7098
8952
|
*/
|
|
7099
8953
|
delete(model, options) {
|
|
7100
|
-
return this._client.delete(path `/models/${model}`, options);
|
|
8954
|
+
return this._client.delete(path `/models/${model}`, { ...options, __security: { bearerAuth: true } });
|
|
7101
8955
|
}
|
|
7102
8956
|
}
|
|
7103
8957
|
|
|
@@ -7111,7 +8965,7 @@ class Moderations extends APIResource {
|
|
|
7111
8965
|
* the [moderation guide](https://platform.openai.com/docs/guides/moderation).
|
|
7112
8966
|
*/
|
|
7113
8967
|
create(body, options) {
|
|
7114
|
-
return this._client.post('/moderations', { body, ...options });
|
|
8968
|
+
return this._client.post('/moderations', { body, ...options, __security: { bearerAuth: true } });
|
|
7115
8969
|
}
|
|
7116
8970
|
}
|
|
7117
8971
|
|
|
@@ -7133,6 +8987,7 @@ class Calls extends APIResource {
|
|
|
7133
8987
|
body,
|
|
7134
8988
|
...options,
|
|
7135
8989
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
8990
|
+
__security: { bearerAuth: true },
|
|
7136
8991
|
});
|
|
7137
8992
|
}
|
|
7138
8993
|
/**
|
|
@@ -7147,6 +9002,7 @@ class Calls extends APIResource {
|
|
|
7147
9002
|
return this._client.post(path `/realtime/calls/${callID}/hangup`, {
|
|
7148
9003
|
...options,
|
|
7149
9004
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
9005
|
+
__security: { bearerAuth: true },
|
|
7150
9006
|
});
|
|
7151
9007
|
}
|
|
7152
9008
|
/**
|
|
@@ -7164,6 +9020,7 @@ class Calls extends APIResource {
|
|
|
7164
9020
|
body,
|
|
7165
9021
|
...options,
|
|
7166
9022
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
9023
|
+
__security: { bearerAuth: true },
|
|
7167
9024
|
});
|
|
7168
9025
|
}
|
|
7169
9026
|
/**
|
|
@@ -7179,6 +9036,7 @@ class Calls extends APIResource {
|
|
|
7179
9036
|
body,
|
|
7180
9037
|
...options,
|
|
7181
9038
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
9039
|
+
__security: { bearerAuth: true },
|
|
7182
9040
|
});
|
|
7183
9041
|
}
|
|
7184
9042
|
}
|
|
@@ -7209,7 +9067,11 @@ class ClientSecrets extends APIResource {
|
|
|
7209
9067
|
* ```
|
|
7210
9068
|
*/
|
|
7211
9069
|
create(body, options) {
|
|
7212
|
-
return this._client.post('/realtime/client_secrets', {
|
|
9070
|
+
return this._client.post('/realtime/client_secrets', {
|
|
9071
|
+
body,
|
|
9072
|
+
...options,
|
|
9073
|
+
__security: { bearerAuth: true },
|
|
9074
|
+
});
|
|
7213
9075
|
}
|
|
7214
9076
|
}
|
|
7215
9077
|
|
|
@@ -7620,7 +9482,7 @@ class InputItems extends APIResource {
|
|
|
7620
9482
|
* ```
|
|
7621
9483
|
*/
|
|
7622
9484
|
list(responseID, query = {}, options) {
|
|
7623
|
-
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 } });
|
|
7624
9486
|
}
|
|
7625
9487
|
}
|
|
7626
9488
|
|
|
@@ -7638,7 +9500,11 @@ class InputTokens extends APIResource {
|
|
|
7638
9500
|
* ```
|
|
7639
9501
|
*/
|
|
7640
9502
|
count(body = {}, options) {
|
|
7641
|
-
return this._client.post('/responses/input_tokens', {
|
|
9503
|
+
return this._client.post('/responses/input_tokens', {
|
|
9504
|
+
body,
|
|
9505
|
+
...options,
|
|
9506
|
+
__security: { bearerAuth: true },
|
|
9507
|
+
});
|
|
7642
9508
|
}
|
|
7643
9509
|
}
|
|
7644
9510
|
|
|
@@ -7650,7 +9516,12 @@ class Responses extends APIResource {
|
|
|
7650
9516
|
this.inputTokens = new InputTokens(this._client);
|
|
7651
9517
|
}
|
|
7652
9518
|
create(body, options) {
|
|
7653
|
-
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) => {
|
|
7654
9525
|
if ('object' in rsp && rsp.object === 'response') {
|
|
7655
9526
|
addOutputText(rsp);
|
|
7656
9527
|
}
|
|
@@ -7662,6 +9533,7 @@ class Responses extends APIResource {
|
|
|
7662
9533
|
query,
|
|
7663
9534
|
...options,
|
|
7664
9535
|
stream: query?.stream ?? false,
|
|
9536
|
+
__security: { bearerAuth: true },
|
|
7665
9537
|
})._thenUnwrap((rsp) => {
|
|
7666
9538
|
if ('object' in rsp && rsp.object === 'response') {
|
|
7667
9539
|
addOutputText(rsp);
|
|
@@ -7683,6 +9555,7 @@ class Responses extends APIResource {
|
|
|
7683
9555
|
return this._client.delete(path `/responses/${responseID}`, {
|
|
7684
9556
|
...options,
|
|
7685
9557
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
9558
|
+
__security: { bearerAuth: true },
|
|
7686
9559
|
});
|
|
7687
9560
|
}
|
|
7688
9561
|
parse(body, options) {
|
|
@@ -7709,7 +9582,10 @@ class Responses extends APIResource {
|
|
|
7709
9582
|
* ```
|
|
7710
9583
|
*/
|
|
7711
9584
|
cancel(responseID, options) {
|
|
7712
|
-
return this._client.post(path `/responses/${responseID}/cancel`,
|
|
9585
|
+
return this._client.post(path `/responses/${responseID}/cancel`, {
|
|
9586
|
+
...options,
|
|
9587
|
+
__security: { bearerAuth: true },
|
|
9588
|
+
});
|
|
7713
9589
|
}
|
|
7714
9590
|
/**
|
|
7715
9591
|
* Compact a conversation. Returns a compacted response object.
|
|
@@ -7727,7 +9603,7 @@ class Responses extends APIResource {
|
|
|
7727
9603
|
* ```
|
|
7728
9604
|
*/
|
|
7729
9605
|
compact(body, options) {
|
|
7730
|
-
return this._client.post('/responses/compact', { body, ...options });
|
|
9606
|
+
return this._client.post('/responses/compact', { body, ...options, __security: { bearerAuth: true } });
|
|
7731
9607
|
}
|
|
7732
9608
|
}
|
|
7733
9609
|
Responses.InputItems = InputItems;
|
|
@@ -7742,6 +9618,7 @@ let Content$1 = class Content extends APIResource {
|
|
|
7742
9618
|
return this._client.get(path `/skills/${skillID}/content`, {
|
|
7743
9619
|
...options,
|
|
7744
9620
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
9621
|
+
__security: { bearerAuth: true },
|
|
7745
9622
|
__binaryResponse: true,
|
|
7746
9623
|
});
|
|
7747
9624
|
}
|
|
@@ -7757,6 +9634,7 @@ class Content extends APIResource {
|
|
|
7757
9634
|
return this._client.get(path `/skills/${skill_id}/versions/${version}/content`, {
|
|
7758
9635
|
...options,
|
|
7759
9636
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
9637
|
+
__security: { bearerAuth: true },
|
|
7760
9638
|
__binaryResponse: true,
|
|
7761
9639
|
});
|
|
7762
9640
|
}
|
|
@@ -7772,14 +9650,17 @@ class Versions extends APIResource {
|
|
|
7772
9650
|
* Create a new immutable skill version.
|
|
7773
9651
|
*/
|
|
7774
9652
|
create(skillID, body = {}, options) {
|
|
7775
|
-
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));
|
|
7776
9654
|
}
|
|
7777
9655
|
/**
|
|
7778
9656
|
* Get a specific skill version.
|
|
7779
9657
|
*/
|
|
7780
9658
|
retrieve(version, params, options) {
|
|
7781
9659
|
const { skill_id } = params;
|
|
7782
|
-
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
|
+
});
|
|
7783
9664
|
}
|
|
7784
9665
|
/**
|
|
7785
9666
|
* List skill versions for a skill.
|
|
@@ -7788,6 +9669,7 @@ class Versions extends APIResource {
|
|
|
7788
9669
|
return this._client.getAPIList(path `/skills/${skillID}/versions`, (CursorPage), {
|
|
7789
9670
|
query,
|
|
7790
9671
|
...options,
|
|
9672
|
+
__security: { bearerAuth: true },
|
|
7791
9673
|
});
|
|
7792
9674
|
}
|
|
7793
9675
|
/**
|
|
@@ -7795,7 +9677,10 @@ class Versions extends APIResource {
|
|
|
7795
9677
|
*/
|
|
7796
9678
|
delete(version, params, options) {
|
|
7797
9679
|
const { skill_id } = params;
|
|
7798
|
-
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
|
+
});
|
|
7799
9684
|
}
|
|
7800
9685
|
}
|
|
7801
9686
|
Versions.Content = Content;
|
|
@@ -7811,31 +9696,39 @@ class Skills extends APIResource {
|
|
|
7811
9696
|
* Create a new skill.
|
|
7812
9697
|
*/
|
|
7813
9698
|
create(body = {}, options) {
|
|
7814
|
-
return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
9699
|
+
return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
7815
9700
|
}
|
|
7816
9701
|
/**
|
|
7817
9702
|
* Get a skill by its ID.
|
|
7818
9703
|
*/
|
|
7819
9704
|
retrieve(skillID, options) {
|
|
7820
|
-
return this._client.get(path `/skills/${skillID}`, options);
|
|
9705
|
+
return this._client.get(path `/skills/${skillID}`, { ...options, __security: { bearerAuth: true } });
|
|
7821
9706
|
}
|
|
7822
9707
|
/**
|
|
7823
9708
|
* Update the default version pointer for a skill.
|
|
7824
9709
|
*/
|
|
7825
9710
|
update(skillID, body, options) {
|
|
7826
|
-
return this._client.post(path `/skills/${skillID}`, {
|
|
9711
|
+
return this._client.post(path `/skills/${skillID}`, {
|
|
9712
|
+
body,
|
|
9713
|
+
...options,
|
|
9714
|
+
__security: { bearerAuth: true },
|
|
9715
|
+
});
|
|
7827
9716
|
}
|
|
7828
9717
|
/**
|
|
7829
9718
|
* List all skills for the current project.
|
|
7830
9719
|
*/
|
|
7831
9720
|
list(query = {}, options) {
|
|
7832
|
-
return this._client.getAPIList('/skills', (CursorPage), {
|
|
9721
|
+
return this._client.getAPIList('/skills', (CursorPage), {
|
|
9722
|
+
query,
|
|
9723
|
+
...options,
|
|
9724
|
+
__security: { bearerAuth: true },
|
|
9725
|
+
});
|
|
7833
9726
|
}
|
|
7834
9727
|
/**
|
|
7835
9728
|
* Delete a skill by its ID.
|
|
7836
9729
|
*/
|
|
7837
9730
|
delete(skillID, options) {
|
|
7838
|
-
return this._client.delete(path `/skills/${skillID}`, options);
|
|
9731
|
+
return this._client.delete(path `/skills/${skillID}`, { ...options, __security: { bearerAuth: true } });
|
|
7839
9732
|
}
|
|
7840
9733
|
}
|
|
7841
9734
|
Skills.Content = Content$1;
|
|
@@ -7860,7 +9753,7 @@ class Parts extends APIResource {
|
|
|
7860
9753
|
* [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete).
|
|
7861
9754
|
*/
|
|
7862
9755
|
create(uploadID, body, options) {
|
|
7863
|
-
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));
|
|
7864
9757
|
}
|
|
7865
9758
|
}
|
|
7866
9759
|
|
|
@@ -7897,7 +9790,7 @@ class Uploads extends APIResource {
|
|
|
7897
9790
|
* Returns the Upload object with status `pending`.
|
|
7898
9791
|
*/
|
|
7899
9792
|
create(body, options) {
|
|
7900
|
-
return this._client.post('/uploads', { body, ...options });
|
|
9793
|
+
return this._client.post('/uploads', { body, ...options, __security: { bearerAuth: true } });
|
|
7901
9794
|
}
|
|
7902
9795
|
/**
|
|
7903
9796
|
* Cancels the Upload. No Parts may be added after an Upload is cancelled.
|
|
@@ -7905,7 +9798,10 @@ class Uploads extends APIResource {
|
|
|
7905
9798
|
* Returns the Upload object with status `cancelled`.
|
|
7906
9799
|
*/
|
|
7907
9800
|
cancel(uploadID, options) {
|
|
7908
|
-
return this._client.post(path `/uploads/${uploadID}/cancel`,
|
|
9801
|
+
return this._client.post(path `/uploads/${uploadID}/cancel`, {
|
|
9802
|
+
...options,
|
|
9803
|
+
__security: { bearerAuth: true },
|
|
9804
|
+
});
|
|
7909
9805
|
}
|
|
7910
9806
|
/**
|
|
7911
9807
|
* Completes the
|
|
@@ -7925,7 +9821,11 @@ class Uploads extends APIResource {
|
|
|
7925
9821
|
* object.
|
|
7926
9822
|
*/
|
|
7927
9823
|
complete(uploadID, body, options) {
|
|
7928
|
-
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
|
+
});
|
|
7929
9829
|
}
|
|
7930
9830
|
}
|
|
7931
9831
|
Uploads.Parts = Parts;
|
|
@@ -7962,6 +9862,7 @@ class FileBatches extends APIResource {
|
|
|
7962
9862
|
body,
|
|
7963
9863
|
...options,
|
|
7964
9864
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9865
|
+
__security: { bearerAuth: true },
|
|
7965
9866
|
});
|
|
7966
9867
|
}
|
|
7967
9868
|
/**
|
|
@@ -7972,6 +9873,7 @@ class FileBatches extends APIResource {
|
|
|
7972
9873
|
return this._client.get(path `/vector_stores/${vector_store_id}/file_batches/${batchID}`, {
|
|
7973
9874
|
...options,
|
|
7974
9875
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9876
|
+
__security: { bearerAuth: true },
|
|
7975
9877
|
});
|
|
7976
9878
|
}
|
|
7977
9879
|
/**
|
|
@@ -7983,6 +9885,7 @@ class FileBatches extends APIResource {
|
|
|
7983
9885
|
return this._client.post(path `/vector_stores/${vector_store_id}/file_batches/${batchID}/cancel`, {
|
|
7984
9886
|
...options,
|
|
7985
9887
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9888
|
+
__security: { bearerAuth: true },
|
|
7986
9889
|
});
|
|
7987
9890
|
}
|
|
7988
9891
|
/**
|
|
@@ -7997,7 +9900,12 @@ class FileBatches extends APIResource {
|
|
|
7997
9900
|
*/
|
|
7998
9901
|
listFiles(batchID, params, options) {
|
|
7999
9902
|
const { vector_store_id, ...query } = params;
|
|
8000
|
-
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
|
+
});
|
|
8001
9909
|
}
|
|
8002
9910
|
/**
|
|
8003
9911
|
* Wait for the given file batch to be processed.
|
|
@@ -8087,6 +9995,7 @@ class Files extends APIResource {
|
|
|
8087
9995
|
body,
|
|
8088
9996
|
...options,
|
|
8089
9997
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9998
|
+
__security: { bearerAuth: true },
|
|
8090
9999
|
});
|
|
8091
10000
|
}
|
|
8092
10001
|
/**
|
|
@@ -8097,6 +10006,7 @@ class Files extends APIResource {
|
|
|
8097
10006
|
return this._client.get(path `/vector_stores/${vector_store_id}/files/${fileID}`, {
|
|
8098
10007
|
...options,
|
|
8099
10008
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10009
|
+
__security: { bearerAuth: true },
|
|
8100
10010
|
});
|
|
8101
10011
|
}
|
|
8102
10012
|
/**
|
|
@@ -8108,6 +10018,7 @@ class Files extends APIResource {
|
|
|
8108
10018
|
body,
|
|
8109
10019
|
...options,
|
|
8110
10020
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10021
|
+
__security: { bearerAuth: true },
|
|
8111
10022
|
});
|
|
8112
10023
|
}
|
|
8113
10024
|
/**
|
|
@@ -8118,6 +10029,7 @@ class Files extends APIResource {
|
|
|
8118
10029
|
query,
|
|
8119
10030
|
...options,
|
|
8120
10031
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10032
|
+
__security: { bearerAuth: true },
|
|
8121
10033
|
});
|
|
8122
10034
|
}
|
|
8123
10035
|
/**
|
|
@@ -8131,6 +10043,7 @@ class Files extends APIResource {
|
|
|
8131
10043
|
return this._client.delete(path `/vector_stores/${vector_store_id}/files/${fileID}`, {
|
|
8132
10044
|
...options,
|
|
8133
10045
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10046
|
+
__security: { bearerAuth: true },
|
|
8134
10047
|
});
|
|
8135
10048
|
}
|
|
8136
10049
|
/**
|
|
@@ -8204,7 +10117,11 @@ class Files extends APIResource {
|
|
|
8204
10117
|
*/
|
|
8205
10118
|
content(fileID, params, options) {
|
|
8206
10119
|
const { vector_store_id } = params;
|
|
8207
|
-
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
|
+
});
|
|
8208
10125
|
}
|
|
8209
10126
|
}
|
|
8210
10127
|
|
|
@@ -8223,6 +10140,7 @@ class VectorStores extends APIResource {
|
|
|
8223
10140
|
body,
|
|
8224
10141
|
...options,
|
|
8225
10142
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10143
|
+
__security: { bearerAuth: true },
|
|
8226
10144
|
});
|
|
8227
10145
|
}
|
|
8228
10146
|
/**
|
|
@@ -8232,6 +10150,7 @@ class VectorStores extends APIResource {
|
|
|
8232
10150
|
return this._client.get(path `/vector_stores/${vectorStoreID}`, {
|
|
8233
10151
|
...options,
|
|
8234
10152
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10153
|
+
__security: { bearerAuth: true },
|
|
8235
10154
|
});
|
|
8236
10155
|
}
|
|
8237
10156
|
/**
|
|
@@ -8242,6 +10161,7 @@ class VectorStores extends APIResource {
|
|
|
8242
10161
|
body,
|
|
8243
10162
|
...options,
|
|
8244
10163
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10164
|
+
__security: { bearerAuth: true },
|
|
8245
10165
|
});
|
|
8246
10166
|
}
|
|
8247
10167
|
/**
|
|
@@ -8252,6 +10172,7 @@ class VectorStores extends APIResource {
|
|
|
8252
10172
|
query,
|
|
8253
10173
|
...options,
|
|
8254
10174
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10175
|
+
__security: { bearerAuth: true },
|
|
8255
10176
|
});
|
|
8256
10177
|
}
|
|
8257
10178
|
/**
|
|
@@ -8261,6 +10182,7 @@ class VectorStores extends APIResource {
|
|
|
8261
10182
|
return this._client.delete(path `/vector_stores/${vectorStoreID}`, {
|
|
8262
10183
|
...options,
|
|
8263
10184
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10185
|
+
__security: { bearerAuth: true },
|
|
8264
10186
|
});
|
|
8265
10187
|
}
|
|
8266
10188
|
/**
|
|
@@ -8273,6 +10195,7 @@ class VectorStores extends APIResource {
|
|
|
8273
10195
|
method: 'post',
|
|
8274
10196
|
...options,
|
|
8275
10197
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10198
|
+
__security: { bearerAuth: true },
|
|
8276
10199
|
});
|
|
8277
10200
|
}
|
|
8278
10201
|
}
|
|
@@ -8285,31 +10208,35 @@ class Videos extends APIResource {
|
|
|
8285
10208
|
* Create a new video generation job from a prompt and optional reference assets.
|
|
8286
10209
|
*/
|
|
8287
10210
|
create(body, options) {
|
|
8288
|
-
return this._client.post('/videos', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
10211
|
+
return this._client.post('/videos', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
8289
10212
|
}
|
|
8290
10213
|
/**
|
|
8291
10214
|
* Fetch the latest metadata for a generated video.
|
|
8292
10215
|
*/
|
|
8293
10216
|
retrieve(videoID, options) {
|
|
8294
|
-
return this._client.get(path `/videos/${videoID}`, options);
|
|
10217
|
+
return this._client.get(path `/videos/${videoID}`, { ...options, __security: { bearerAuth: true } });
|
|
8295
10218
|
}
|
|
8296
10219
|
/**
|
|
8297
10220
|
* List recently generated videos for the current project.
|
|
8298
10221
|
*/
|
|
8299
10222
|
list(query = {}, options) {
|
|
8300
|
-
return this._client.getAPIList('/videos', (ConversationCursorPage), {
|
|
10223
|
+
return this._client.getAPIList('/videos', (ConversationCursorPage), {
|
|
10224
|
+
query,
|
|
10225
|
+
...options,
|
|
10226
|
+
__security: { bearerAuth: true },
|
|
10227
|
+
});
|
|
8301
10228
|
}
|
|
8302
10229
|
/**
|
|
8303
10230
|
* Permanently delete a completed or failed video and its stored assets.
|
|
8304
10231
|
*/
|
|
8305
10232
|
delete(videoID, options) {
|
|
8306
|
-
return this._client.delete(path `/videos/${videoID}`, options);
|
|
10233
|
+
return this._client.delete(path `/videos/${videoID}`, { ...options, __security: { bearerAuth: true } });
|
|
8307
10234
|
}
|
|
8308
10235
|
/**
|
|
8309
10236
|
* Create a character from an uploaded video.
|
|
8310
10237
|
*/
|
|
8311
10238
|
createCharacter(body, options) {
|
|
8312
|
-
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));
|
|
8313
10240
|
}
|
|
8314
10241
|
/**
|
|
8315
10242
|
* Download the generated video bytes or a derived preview asset.
|
|
@@ -8321,6 +10248,7 @@ class Videos extends APIResource {
|
|
|
8321
10248
|
query,
|
|
8322
10249
|
...options,
|
|
8323
10250
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
10251
|
+
__security: { bearerAuth: true },
|
|
8324
10252
|
__binaryResponse: true,
|
|
8325
10253
|
});
|
|
8326
10254
|
}
|
|
@@ -8329,25 +10257,28 @@ class Videos extends APIResource {
|
|
|
8329
10257
|
* generated video.
|
|
8330
10258
|
*/
|
|
8331
10259
|
edit(body, options) {
|
|
8332
|
-
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));
|
|
8333
10261
|
}
|
|
8334
10262
|
/**
|
|
8335
10263
|
* Create an extension of a completed video.
|
|
8336
10264
|
*/
|
|
8337
10265
|
extend(body, options) {
|
|
8338
|
-
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));
|
|
8339
10267
|
}
|
|
8340
10268
|
/**
|
|
8341
10269
|
* Fetch a character.
|
|
8342
10270
|
*/
|
|
8343
10271
|
getCharacter(characterID, options) {
|
|
8344
|
-
return this._client.get(path `/videos/characters/${characterID}`,
|
|
10272
|
+
return this._client.get(path `/videos/characters/${characterID}`, {
|
|
10273
|
+
...options,
|
|
10274
|
+
__security: { bearerAuth: true },
|
|
10275
|
+
});
|
|
8345
10276
|
}
|
|
8346
10277
|
/**
|
|
8347
10278
|
* Create a remix of a completed video using a refreshed prompt.
|
|
8348
10279
|
*/
|
|
8349
10280
|
remix(videoID, body, options) {
|
|
8350
|
-
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));
|
|
8351
10282
|
}
|
|
8352
10283
|
}
|
|
8353
10284
|
|
|
@@ -8454,7 +10385,8 @@ class OpenAI {
|
|
|
8454
10385
|
/**
|
|
8455
10386
|
* API Client for interfacing with the OpenAI API.
|
|
8456
10387
|
*
|
|
8457
|
-
* @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]
|
|
8458
10390
|
* @param {string | null | undefined} [opts.organization=process.env['OPENAI_ORG_ID'] ?? null]
|
|
8459
10391
|
* @param {string | null | undefined} [opts.project=process.env['OPENAI_PROJECT_ID'] ?? null]
|
|
8460
10392
|
* @param {string | null | undefined} [opts.webhookSecret=process.env['OPENAI_WEBHOOK_SECRET'] ?? null]
|
|
@@ -8467,7 +10399,7 @@ class OpenAI {
|
|
|
8467
10399
|
* @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
8468
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.
|
|
8469
10401
|
*/
|
|
8470
|
-
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 } = {}) {
|
|
8471
10403
|
_OpenAI_instances.add(this);
|
|
8472
10404
|
_OpenAI_encoder.set(this, void 0);
|
|
8473
10405
|
/**
|
|
@@ -8509,6 +10441,7 @@ class OpenAI {
|
|
|
8509
10441
|
* Use Uploads to upload large files in multiple parts.
|
|
8510
10442
|
*/
|
|
8511
10443
|
this.uploads = new Uploads(this);
|
|
10444
|
+
this.admin = new Admin(this);
|
|
8512
10445
|
this.responses = new Responses(this);
|
|
8513
10446
|
this.realtime = new Realtime(this);
|
|
8514
10447
|
/**
|
|
@@ -8522,17 +10455,9 @@ class OpenAI {
|
|
|
8522
10455
|
this.containers = new Containers(this);
|
|
8523
10456
|
this.skills = new Skills(this);
|
|
8524
10457
|
this.videos = new Videos(this);
|
|
8525
|
-
if (workloadIdentity) {
|
|
8526
|
-
if (apiKey && apiKey !== WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER) {
|
|
8527
|
-
throw new OpenAIError('The `apiKey` and `workloadIdentity` arguments are mutually exclusive; only one can be passed at a time.');
|
|
8528
|
-
}
|
|
8529
|
-
apiKey = WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER;
|
|
8530
|
-
}
|
|
8531
|
-
else if (apiKey === undefined) {
|
|
8532
|
-
throw new OpenAIError('Missing credentials. Please pass an `apiKey`, `workloadIdentity`, or set the `OPENAI_API_KEY` environment variable.');
|
|
8533
|
-
}
|
|
8534
10458
|
const options = {
|
|
8535
10459
|
apiKey,
|
|
10460
|
+
adminAPIKey,
|
|
8536
10461
|
organization,
|
|
8537
10462
|
project,
|
|
8538
10463
|
webhookSecret,
|
|
@@ -8540,6 +10465,12 @@ class OpenAI {
|
|
|
8540
10465
|
...opts,
|
|
8541
10466
|
baseURL: baseURL || `https://api.openai.com/v1`,
|
|
8542
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
|
+
}
|
|
8543
10474
|
if (!options.dangerouslyAllowBrowser && isRunningInBrowser()) {
|
|
8544
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");
|
|
8545
10476
|
}
|
|
@@ -8557,11 +10488,23 @@ class OpenAI {
|
|
|
8557
10488
|
this.maxRetries = options.maxRetries ?? 2;
|
|
8558
10489
|
this.fetch = options.fetch ?? getDefaultFetch();
|
|
8559
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
|
+
}
|
|
8560
10502
|
this._options = options;
|
|
8561
10503
|
if (workloadIdentity) {
|
|
8562
10504
|
this._workloadIdentityAuth = new WorkloadIdentityAuth(workloadIdentity, this.fetch);
|
|
8563
10505
|
}
|
|
8564
|
-
this.apiKey = typeof apiKey === 'string' ? apiKey :
|
|
10506
|
+
this.apiKey = typeof apiKey === 'string' ? apiKey : null;
|
|
10507
|
+
this.adminAPIKey = adminAPIKey;
|
|
8565
10508
|
this.organization = organization;
|
|
8566
10509
|
this.project = project;
|
|
8567
10510
|
this.webhookSecret = webhookSecret;
|
|
@@ -8579,7 +10522,8 @@ class OpenAI {
|
|
|
8579
10522
|
logLevel: this.logLevel,
|
|
8580
10523
|
fetch: this.fetch,
|
|
8581
10524
|
fetchOptions: this.fetchOptions,
|
|
8582
|
-
apiKey: this.apiKey,
|
|
10525
|
+
apiKey: this._options.apiKey,
|
|
10526
|
+
adminAPIKey: this.adminAPIKey,
|
|
8583
10527
|
workloadIdentity: this._options.workloadIdentity,
|
|
8584
10528
|
organization: this.organization,
|
|
8585
10529
|
project: this.project,
|
|
@@ -8591,12 +10535,45 @@ class OpenAI {
|
|
|
8591
10535
|
defaultQuery() {
|
|
8592
10536
|
return this._options.defaultQuery;
|
|
8593
10537
|
}
|
|
8594
|
-
validateHeaders({ values, nulls }
|
|
8595
|
-
|
|
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');
|
|
8596
10552
|
}
|
|
8597
|
-
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
|
+
}
|
|
8598
10569
|
return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]);
|
|
8599
10570
|
}
|
|
10571
|
+
async adminAPIKeyAuth(opts) {
|
|
10572
|
+
if (this.adminAPIKey == null) {
|
|
10573
|
+
return undefined;
|
|
10574
|
+
}
|
|
10575
|
+
return buildHeaders([{ Authorization: `Bearer ${this.adminAPIKey}` }]);
|
|
10576
|
+
}
|
|
8600
10577
|
stringifyQuery(query) {
|
|
8601
10578
|
return stringifyQuery(query);
|
|
8602
10579
|
}
|
|
@@ -8649,7 +10626,10 @@ class OpenAI {
|
|
|
8649
10626
|
* Used as a callback for mutating the given `FinalRequestOptions` object.
|
|
8650
10627
|
*/
|
|
8651
10628
|
async prepareOptions(options) {
|
|
8652
|
-
|
|
10629
|
+
const security = options.__security ?? { bearerAuth: true };
|
|
10630
|
+
if (security.bearerAuth) {
|
|
10631
|
+
await this._callApiKey();
|
|
10632
|
+
}
|
|
8653
10633
|
}
|
|
8654
10634
|
/**
|
|
8655
10635
|
* Used as a callback for mutating the given `RequestInit` object.
|
|
@@ -8706,8 +10686,9 @@ class OpenAI {
|
|
|
8706
10686
|
if (options.signal?.aborted) {
|
|
8707
10687
|
throw new APIUserAbortError();
|
|
8708
10688
|
}
|
|
10689
|
+
const security = options.__security ?? { bearerAuth: true };
|
|
8709
10690
|
const controller = new AbortController();
|
|
8710
|
-
const response = await this.fetchWithAuth(url, req, timeout, controller).catch(castToError);
|
|
10691
|
+
const response = await this.fetchWithAuth(url, req, timeout, controller, security).catch(castToError);
|
|
8711
10692
|
const headersTime = Date.now();
|
|
8712
10693
|
if (response instanceof globalThis.Error) {
|
|
8713
10694
|
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
@@ -8753,6 +10734,7 @@ class OpenAI {
|
|
|
8753
10734
|
if (!response.ok) {
|
|
8754
10735
|
if (response.status === 401 &&
|
|
8755
10736
|
this._workloadIdentityAuth &&
|
|
10737
|
+
security.bearerAuth &&
|
|
8756
10738
|
!options.__metadata?.['hasStreamingBody'] &&
|
|
8757
10739
|
!options.__metadata?.['workloadIdentityTokenRefreshed']) {
|
|
8758
10740
|
await CancelReadableStream(response.body);
|
|
@@ -8815,8 +10797,11 @@ class OpenAI {
|
|
|
8815
10797
|
const request = this.makeRequest(options, null, undefined);
|
|
8816
10798
|
return new PagePromise(this, request, Page);
|
|
8817
10799
|
}
|
|
8818
|
-
async fetchWithAuth(url, init, timeout, controller
|
|
8819
|
-
|
|
10800
|
+
async fetchWithAuth(url, init, timeout, controller, schemes = {
|
|
10801
|
+
bearerAuth: true,
|
|
10802
|
+
adminAPIKeyAuth: true,
|
|
10803
|
+
}) {
|
|
10804
|
+
if (this._workloadIdentityAuth && schemes.bearerAuth) {
|
|
8820
10805
|
const headers = init.headers;
|
|
8821
10806
|
const authHeader = headers.get('Authorization');
|
|
8822
10807
|
if (!authHeader || authHeader === `Bearer ${WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER}`) {
|
|
@@ -8961,12 +10946,12 @@ class OpenAI {
|
|
|
8961
10946
|
'OpenAI-Organization': this.organization,
|
|
8962
10947
|
'OpenAI-Project': this.project,
|
|
8963
10948
|
},
|
|
8964
|
-
await this.authHeaders(options),
|
|
10949
|
+
await this.authHeaders(options, options.__security ?? { bearerAuth: true }),
|
|
8965
10950
|
this._options.defaultHeaders,
|
|
8966
10951
|
bodyHeaders,
|
|
8967
10952
|
options.headers,
|
|
8968
10953
|
]);
|
|
8969
|
-
this.validateHeaders(headers);
|
|
10954
|
+
this.validateHeaders(headers, options.__security ?? { bearerAuth: true });
|
|
8970
10955
|
return headers.values;
|
|
8971
10956
|
}
|
|
8972
10957
|
_makeAbort(controller) {
|
|
@@ -9063,6 +11048,7 @@ OpenAI.Webhooks = Webhooks;
|
|
|
9063
11048
|
OpenAI.Beta = Beta;
|
|
9064
11049
|
OpenAI.Batches = Batches;
|
|
9065
11050
|
OpenAI.Uploads = Uploads;
|
|
11051
|
+
OpenAI.Admin = Admin;
|
|
9066
11052
|
OpenAI.Responses = Responses;
|
|
9067
11053
|
OpenAI.Realtime = Realtime;
|
|
9068
11054
|
OpenAI.Conversations = Conversations;
|
|
@@ -11622,7 +13608,6 @@ function zodTextFormat(zodObject, name, props) {
|
|
|
11622
13608
|
}, (content) => zodObject.parse(JSON.parse(content)));
|
|
11623
13609
|
}
|
|
11624
13610
|
|
|
11625
|
-
// llm-openai-config.ts
|
|
11626
13611
|
const DEFAULT_MODEL = 'gpt-5-mini';
|
|
11627
13612
|
const GPT_5_HIGH_CONTEXT_THRESHOLD_TOKENS = 272_000;
|
|
11628
13613
|
const GPT_5_HIGH_CONTEXT_INPUT_MULTIPLIER = 2;
|
|
@@ -11703,25 +13688,144 @@ const deepseekModelCosts = {
|
|
|
11703
13688
|
function shouldUseGPT5HighContextPricing(model, inputTokens) {
|
|
11704
13689
|
return (model === 'gpt-5.4' || model === 'gpt-5.5') && inputTokens > GPT_5_HIGH_CONTEXT_THRESHOLD_TOKENS;
|
|
11705
13690
|
}
|
|
11706
|
-
|
|
11707
|
-
const
|
|
11708
|
-
|
|
11709
|
-
'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
|
+
},
|
|
11710
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
|
+
}
|
|
11711
13811
|
/**
|
|
11712
13812
|
* Calculates the cost of generating images using OpenAI's Images API.
|
|
11713
13813
|
*
|
|
11714
13814
|
* @param model The image generation model name.
|
|
11715
13815
|
* @param imageCount The number of images generated.
|
|
13816
|
+
* @param quality The requested image quality.
|
|
13817
|
+
* @param size The requested image size.
|
|
11716
13818
|
* @returns The cost of generating the images in USD.
|
|
11717
13819
|
*/
|
|
11718
|
-
function calculateImageCost(model, imageCount) {
|
|
13820
|
+
function calculateImageCost(model, imageCount, quality, size) {
|
|
11719
13821
|
if (typeof model !== 'string' || typeof imageCount !== 'number' || imageCount <= 0) {
|
|
11720
13822
|
return 0;
|
|
11721
13823
|
}
|
|
11722
|
-
|
|
11723
|
-
if (!costPerImage)
|
|
13824
|
+
if (!isPricedOpenAIImageModel(model))
|
|
11724
13825
|
return 0;
|
|
13826
|
+
const pricingQuality = resolveImagePricingQuality(quality);
|
|
13827
|
+
const pricingSize = resolveImagePricingSize(size);
|
|
13828
|
+
const costPerImage = openAiImageCostByQualityAndSize[model][pricingQuality][pricingSize];
|
|
11725
13829
|
return imageCount * costPerImage;
|
|
11726
13830
|
}
|
|
11727
13831
|
/**
|
|
@@ -12420,7 +14524,7 @@ async function makeLLMCall(input, options = {}) {
|
|
|
12420
14524
|
return await makeResponsesAPICall(processedInput, responsesOptions);
|
|
12421
14525
|
}
|
|
12422
14526
|
|
|
12423
|
-
const DEFAULT_IMAGE_MODEL = 'gpt-image-
|
|
14527
|
+
const DEFAULT_IMAGE_MODEL = 'gpt-image-2';
|
|
12424
14528
|
const resolveImageModel = (model) => model ?? DEFAULT_IMAGE_MODEL;
|
|
12425
14529
|
const MULTIMODAL_VISION_MODELS = new Set(OPENAI_MODELS);
|
|
12426
14530
|
/**
|
|
@@ -12509,7 +14613,7 @@ async function makeImagesCall(prompt, options = {}) {
|
|
|
12509
14613
|
throw new Error('No images returned from OpenAI Images API');
|
|
12510
14614
|
}
|
|
12511
14615
|
// Calculate cost
|
|
12512
|
-
const cost = calculateImageCost(imageModel, count || 1);
|
|
14616
|
+
const cost = calculateImageCost(imageModel, count || 1, quality, size);
|
|
12513
14617
|
// Return the response with enhanced usage information
|
|
12514
14618
|
const enhancedResponse = {
|
|
12515
14619
|
...response,
|
|
@@ -21566,8 +23670,11 @@ const disco = {
|
|
|
21566
23670
|
|
|
21567
23671
|
exports.AlpacaMarketDataAPI = AlpacaMarketDataAPI;
|
|
21568
23672
|
exports.AlpacaTradingAPI = AlpacaTradingAPI;
|
|
23673
|
+
exports.OPENAI_IMAGE_MODELS = OPENAI_IMAGE_MODELS;
|
|
21569
23674
|
exports.OPENAI_MODELS = OPENAI_MODELS;
|
|
23675
|
+
exports.OPENROUTER_MODELS = OPENROUTER_MODELS;
|
|
21570
23676
|
exports.disco = disco;
|
|
23677
|
+
exports.isOpenAIImageModel = isOpenAIImageModel;
|
|
21571
23678
|
exports.isOpenAIModel = isOpenAIModel;
|
|
21572
23679
|
exports.isOpenRouterModel = isOpenRouterModel;
|
|
21573
23680
|
exports.supportsTemperature = supportsTemperature;
|