@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.mjs
CHANGED
|
@@ -1162,38 +1162,63 @@ const OPENAI_MODELS = [
|
|
|
1162
1162
|
function isOpenAIModel(model) {
|
|
1163
1163
|
return OPENAI_MODELS.includes(model);
|
|
1164
1164
|
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Represents OpenAI image models.
|
|
1167
|
+
*/
|
|
1168
|
+
const OPENAI_IMAGE_MODELS = [
|
|
1169
|
+
'gpt-image-2',
|
|
1170
|
+
'gpt-image-2-2026-04-21',
|
|
1171
|
+
'gpt-image-1.5',
|
|
1172
|
+
'gpt-image-1',
|
|
1173
|
+
'gpt-image-1-mini',
|
|
1174
|
+
'chatgpt-image-latest',
|
|
1175
|
+
'dall-e-2',
|
|
1176
|
+
'dall-e-3',
|
|
1177
|
+
];
|
|
1178
|
+
/**
|
|
1179
|
+
* Type guard to check if a model is a supported OpenAI image model.
|
|
1180
|
+
*/
|
|
1181
|
+
function isOpenAIImageModel(model) {
|
|
1182
|
+
return OPENAI_IMAGE_MODELS.includes(model);
|
|
1183
|
+
}
|
|
1184
|
+
/**
|
|
1185
|
+
* Represents OpenRouter models
|
|
1186
|
+
*/
|
|
1187
|
+
const OPENROUTER_MODELS = [
|
|
1188
|
+
'openai/gpt-5',
|
|
1189
|
+
'openai/gpt-5-mini',
|
|
1190
|
+
'openai/gpt-5.4-mini',
|
|
1191
|
+
'openai/gpt-5-nano',
|
|
1192
|
+
'openai/gpt-5.1',
|
|
1193
|
+
'openai/gpt-5.4',
|
|
1194
|
+
'openai/gpt-5.4-pro',
|
|
1195
|
+
'openai/gpt-5.5',
|
|
1196
|
+
'openai/gpt-5.5-pro',
|
|
1197
|
+
'openai/gpt-5.2',
|
|
1198
|
+
'openai/gpt-5.2-pro',
|
|
1199
|
+
'openai/gpt-5.1-codex',
|
|
1200
|
+
'openai/gpt-5.1-codex-max',
|
|
1201
|
+
'openai/gpt-oss-120b',
|
|
1202
|
+
'z.ai/glm-4.5',
|
|
1203
|
+
'z.ai/glm-4.5-air',
|
|
1204
|
+
'google/gemini-2.5-flash',
|
|
1205
|
+
'google/gemini-2.5-flash-lite',
|
|
1206
|
+
'deepseek/deepseek-r1-0528',
|
|
1207
|
+
'deepseek/deepseek-chat-v3-0324',
|
|
1208
|
+
];
|
|
1165
1209
|
/**
|
|
1166
1210
|
* Type guard to check if a model is an OpenRouter model
|
|
1167
1211
|
*/
|
|
1168
1212
|
function isOpenRouterModel(model) {
|
|
1169
|
-
|
|
1170
|
-
'openai/gpt-5',
|
|
1171
|
-
'openai/gpt-5-mini',
|
|
1172
|
-
'openai/gpt-5.4-mini',
|
|
1173
|
-
'openai/gpt-5-nano',
|
|
1174
|
-
'openai/gpt-5.1',
|
|
1175
|
-
'openai/gpt-5.4',
|
|
1176
|
-
'openai/gpt-5.4-pro',
|
|
1177
|
-
'openai/gpt-5.5',
|
|
1178
|
-
'openai/gpt-5.5-pro',
|
|
1179
|
-
'openai/gpt-5.2',
|
|
1180
|
-
'openai/gpt-5.2-pro',
|
|
1181
|
-
'openai/gpt-5.1-codex',
|
|
1182
|
-
'openai/gpt-5.1-codex-max',
|
|
1183
|
-
'openai/gpt-oss-120b',
|
|
1184
|
-
'z.ai/glm-4.5',
|
|
1185
|
-
'z.ai/glm-4.5-air',
|
|
1186
|
-
'google/gemini-2.5-flash',
|
|
1187
|
-
'google/gemini-2.5-flash-lite',
|
|
1188
|
-
'deepseek/deepseek-r1-0528',
|
|
1189
|
-
'deepseek/deepseek-chat-v3-0324',
|
|
1190
|
-
];
|
|
1191
|
-
return openRouterModels.includes(model);
|
|
1213
|
+
return OPENROUTER_MODELS.includes(model);
|
|
1192
1214
|
}
|
|
1193
1215
|
|
|
1194
1216
|
var Types = /*#__PURE__*/Object.freeze({
|
|
1195
1217
|
__proto__: null,
|
|
1218
|
+
OPENAI_IMAGE_MODELS: OPENAI_IMAGE_MODELS,
|
|
1196
1219
|
OPENAI_MODELS: OPENAI_MODELS,
|
|
1220
|
+
OPENROUTER_MODELS: OPENROUTER_MODELS,
|
|
1221
|
+
isOpenAIImageModel: isOpenAIImageModel,
|
|
1197
1222
|
isOpenAIModel: isOpenAIModel,
|
|
1198
1223
|
isOpenRouterModel: isOpenRouterModel
|
|
1199
1224
|
});
|
|
@@ -1673,7 +1698,7 @@ const safeJSON = (text) => {
|
|
|
1673
1698
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
1674
1699
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
1675
1700
|
|
|
1676
|
-
const VERSION = '6.
|
|
1701
|
+
const VERSION = '6.37.0'; // x-release-please-version
|
|
1677
1702
|
|
|
1678
1703
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
1679
1704
|
const isRunningInBrowser = () => {
|
|
@@ -2493,6 +2518,8 @@ const formatRequestDetails = (details) => {
|
|
|
2493
2518
|
details.headers = Object.fromEntries((details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map(([name, value]) => [
|
|
2494
2519
|
name,
|
|
2495
2520
|
(name.toLowerCase() === 'authorization' ||
|
|
2521
|
+
name.toLowerCase() === 'api-key' ||
|
|
2522
|
+
name.toLowerCase() === 'x-api-key' ||
|
|
2496
2523
|
name.toLowerCase() === 'cookie' ||
|
|
2497
2524
|
name.toLowerCase() === 'set-cookie') ?
|
|
2498
2525
|
'***'
|
|
@@ -3053,6 +3080,36 @@ class ConversationCursorPage extends AbstractPage {
|
|
|
3053
3080
|
};
|
|
3054
3081
|
}
|
|
3055
3082
|
}
|
|
3083
|
+
class NextCursorPage extends AbstractPage {
|
|
3084
|
+
constructor(client, response, body, options) {
|
|
3085
|
+
super(client, response, body, options);
|
|
3086
|
+
this.data = body.data || [];
|
|
3087
|
+
this.has_more = body.has_more || false;
|
|
3088
|
+
this.next = body.next || null;
|
|
3089
|
+
}
|
|
3090
|
+
getPaginatedItems() {
|
|
3091
|
+
return this.data ?? [];
|
|
3092
|
+
}
|
|
3093
|
+
hasNextPage() {
|
|
3094
|
+
if (this.has_more === false) {
|
|
3095
|
+
return false;
|
|
3096
|
+
}
|
|
3097
|
+
return super.hasNextPage();
|
|
3098
|
+
}
|
|
3099
|
+
nextPageRequestOptions() {
|
|
3100
|
+
const cursor = this.next;
|
|
3101
|
+
if (!cursor) {
|
|
3102
|
+
return null;
|
|
3103
|
+
}
|
|
3104
|
+
return {
|
|
3105
|
+
...this.options,
|
|
3106
|
+
query: {
|
|
3107
|
+
...maybeObj(this.options.query),
|
|
3108
|
+
after: cursor,
|
|
3109
|
+
},
|
|
3110
|
+
};
|
|
3111
|
+
}
|
|
3112
|
+
}
|
|
3056
3113
|
|
|
3057
3114
|
const SUBJECT_TOKEN_TYPES = {
|
|
3058
3115
|
jwt: 'urn:ietf:params:oauth:token-type:jwt',
|
|
@@ -3455,7 +3512,7 @@ let Messages$1 = class Messages extends APIResource {
|
|
|
3455
3512
|
* ```
|
|
3456
3513
|
*/
|
|
3457
3514
|
list(completionID, query = {}, options) {
|
|
3458
|
-
return this._client.getAPIList(path `/chat/completions/${completionID}/messages`, (CursorPage), { query, ...options });
|
|
3515
|
+
return this._client.getAPIList(path `/chat/completions/${completionID}/messages`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
3459
3516
|
}
|
|
3460
3517
|
};
|
|
3461
3518
|
|
|
@@ -4801,123 +4858,1775 @@ class ChatCompletionStreamingRunner extends ChatCompletionStream {
|
|
|
4801
4858
|
runner._run(() => runner._fromReadableStream(stream));
|
|
4802
4859
|
return runner;
|
|
4803
4860
|
}
|
|
4804
|
-
static runTools(client, params, options) {
|
|
4805
|
-
const runner = new ChatCompletionStreamingRunner(
|
|
4806
|
-
// @ts-expect-error TODO these types are incompatible
|
|
4807
|
-
params);
|
|
4808
|
-
const opts = {
|
|
4861
|
+
static runTools(client, params, options) {
|
|
4862
|
+
const runner = new ChatCompletionStreamingRunner(
|
|
4863
|
+
// @ts-expect-error TODO these types are incompatible
|
|
4864
|
+
params);
|
|
4865
|
+
const opts = {
|
|
4866
|
+
...options,
|
|
4867
|
+
headers: { ...options?.headers, 'X-Stainless-Helper-Method': 'runTools' },
|
|
4868
|
+
};
|
|
4869
|
+
runner._run(() => runner._runTools(client, params, opts));
|
|
4870
|
+
return runner;
|
|
4871
|
+
}
|
|
4872
|
+
}
|
|
4873
|
+
|
|
4874
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4875
|
+
/**
|
|
4876
|
+
* Given a list of messages comprising a conversation, the model will return a response.
|
|
4877
|
+
*/
|
|
4878
|
+
let Completions$1 = class Completions extends APIResource {
|
|
4879
|
+
constructor() {
|
|
4880
|
+
super(...arguments);
|
|
4881
|
+
this.messages = new Messages$1(this._client);
|
|
4882
|
+
}
|
|
4883
|
+
create(body, options) {
|
|
4884
|
+
return this._client.post('/chat/completions', {
|
|
4885
|
+
body,
|
|
4886
|
+
...options,
|
|
4887
|
+
stream: body.stream ?? false,
|
|
4888
|
+
__security: { bearerAuth: true },
|
|
4889
|
+
});
|
|
4890
|
+
}
|
|
4891
|
+
/**
|
|
4892
|
+
* Get a stored chat completion. Only Chat Completions that have been created with
|
|
4893
|
+
* the `store` parameter set to `true` will be returned.
|
|
4894
|
+
*
|
|
4895
|
+
* @example
|
|
4896
|
+
* ```ts
|
|
4897
|
+
* const chatCompletion =
|
|
4898
|
+
* await client.chat.completions.retrieve('completion_id');
|
|
4899
|
+
* ```
|
|
4900
|
+
*/
|
|
4901
|
+
retrieve(completionID, options) {
|
|
4902
|
+
return this._client.get(path `/chat/completions/${completionID}`, {
|
|
4903
|
+
...options,
|
|
4904
|
+
__security: { bearerAuth: true },
|
|
4905
|
+
});
|
|
4906
|
+
}
|
|
4907
|
+
/**
|
|
4908
|
+
* Modify a stored chat completion. Only Chat Completions that have been created
|
|
4909
|
+
* with the `store` parameter set to `true` can be modified. Currently, the only
|
|
4910
|
+
* supported modification is to update the `metadata` field.
|
|
4911
|
+
*
|
|
4912
|
+
* @example
|
|
4913
|
+
* ```ts
|
|
4914
|
+
* const chatCompletion = await client.chat.completions.update(
|
|
4915
|
+
* 'completion_id',
|
|
4916
|
+
* { metadata: { foo: 'string' } },
|
|
4917
|
+
* );
|
|
4918
|
+
* ```
|
|
4919
|
+
*/
|
|
4920
|
+
update(completionID, body, options) {
|
|
4921
|
+
return this._client.post(path `/chat/completions/${completionID}`, {
|
|
4922
|
+
body,
|
|
4923
|
+
...options,
|
|
4924
|
+
__security: { bearerAuth: true },
|
|
4925
|
+
});
|
|
4926
|
+
}
|
|
4927
|
+
/**
|
|
4928
|
+
* List stored Chat Completions. Only Chat Completions that have been stored with
|
|
4929
|
+
* the `store` parameter set to `true` will be returned.
|
|
4930
|
+
*
|
|
4931
|
+
* @example
|
|
4932
|
+
* ```ts
|
|
4933
|
+
* // Automatically fetches more pages as needed.
|
|
4934
|
+
* for await (const chatCompletion of client.chat.completions.list()) {
|
|
4935
|
+
* // ...
|
|
4936
|
+
* }
|
|
4937
|
+
* ```
|
|
4938
|
+
*/
|
|
4939
|
+
list(query = {}, options) {
|
|
4940
|
+
return this._client.getAPIList('/chat/completions', (CursorPage), {
|
|
4941
|
+
query,
|
|
4942
|
+
...options,
|
|
4943
|
+
__security: { bearerAuth: true },
|
|
4944
|
+
});
|
|
4945
|
+
}
|
|
4946
|
+
/**
|
|
4947
|
+
* Delete a stored chat completion. Only Chat Completions that have been created
|
|
4948
|
+
* with the `store` parameter set to `true` can be deleted.
|
|
4949
|
+
*
|
|
4950
|
+
* @example
|
|
4951
|
+
* ```ts
|
|
4952
|
+
* const chatCompletionDeleted =
|
|
4953
|
+
* await client.chat.completions.delete('completion_id');
|
|
4954
|
+
* ```
|
|
4955
|
+
*/
|
|
4956
|
+
delete(completionID, options) {
|
|
4957
|
+
return this._client.delete(path `/chat/completions/${completionID}`, {
|
|
4958
|
+
...options,
|
|
4959
|
+
__security: { bearerAuth: true },
|
|
4960
|
+
});
|
|
4961
|
+
}
|
|
4962
|
+
parse(body, options) {
|
|
4963
|
+
validateInputTools(body.tools);
|
|
4964
|
+
return this._client.chat.completions
|
|
4965
|
+
.create(body, {
|
|
4966
|
+
...options,
|
|
4967
|
+
headers: {
|
|
4968
|
+
...options?.headers,
|
|
4969
|
+
'X-Stainless-Helper-Method': 'chat.completions.parse',
|
|
4970
|
+
},
|
|
4971
|
+
})
|
|
4972
|
+
._thenUnwrap((completion) => parseChatCompletion(completion, body));
|
|
4973
|
+
}
|
|
4974
|
+
runTools(body, options) {
|
|
4975
|
+
if (body.stream) {
|
|
4976
|
+
return ChatCompletionStreamingRunner.runTools(this._client, body, options);
|
|
4977
|
+
}
|
|
4978
|
+
return ChatCompletionRunner.runTools(this._client, body, options);
|
|
4979
|
+
}
|
|
4980
|
+
/**
|
|
4981
|
+
* Creates a chat completion stream
|
|
4982
|
+
*/
|
|
4983
|
+
stream(body, options) {
|
|
4984
|
+
return ChatCompletionStream.createChatCompletion(this._client, body, options);
|
|
4985
|
+
}
|
|
4986
|
+
};
|
|
4987
|
+
Completions$1.Messages = Messages$1;
|
|
4988
|
+
|
|
4989
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4990
|
+
class Chat extends APIResource {
|
|
4991
|
+
constructor() {
|
|
4992
|
+
super(...arguments);
|
|
4993
|
+
this.completions = new Completions$1(this._client);
|
|
4994
|
+
}
|
|
4995
|
+
}
|
|
4996
|
+
Chat.Completions = Completions$1;
|
|
4997
|
+
|
|
4998
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4999
|
+
class AdminAPIKeys extends APIResource {
|
|
5000
|
+
/**
|
|
5001
|
+
* Create an organization admin API key
|
|
5002
|
+
*
|
|
5003
|
+
* @example
|
|
5004
|
+
* ```ts
|
|
5005
|
+
* const adminAPIKey =
|
|
5006
|
+
* await client.admin.organization.adminAPIKeys.create({
|
|
5007
|
+
* name: 'New Admin Key',
|
|
5008
|
+
* });
|
|
5009
|
+
* ```
|
|
5010
|
+
*/
|
|
5011
|
+
create(body, options) {
|
|
5012
|
+
return this._client.post('/organization/admin_api_keys', {
|
|
5013
|
+
body,
|
|
5014
|
+
...options,
|
|
5015
|
+
__security: { adminAPIKeyAuth: true },
|
|
5016
|
+
});
|
|
5017
|
+
}
|
|
5018
|
+
/**
|
|
5019
|
+
* Retrieve a single organization API key
|
|
5020
|
+
*
|
|
5021
|
+
* @example
|
|
5022
|
+
* ```ts
|
|
5023
|
+
* const adminAPIKey =
|
|
5024
|
+
* await client.admin.organization.adminAPIKeys.retrieve(
|
|
5025
|
+
* 'key_id',
|
|
5026
|
+
* );
|
|
5027
|
+
* ```
|
|
5028
|
+
*/
|
|
5029
|
+
retrieve(keyID, options) {
|
|
5030
|
+
return this._client.get(path `/organization/admin_api_keys/${keyID}`, {
|
|
5031
|
+
...options,
|
|
5032
|
+
__security: { adminAPIKeyAuth: true },
|
|
5033
|
+
});
|
|
5034
|
+
}
|
|
5035
|
+
/**
|
|
5036
|
+
* List organization API keys
|
|
5037
|
+
*
|
|
5038
|
+
* @example
|
|
5039
|
+
* ```ts
|
|
5040
|
+
* // Automatically fetches more pages as needed.
|
|
5041
|
+
* for await (const adminAPIKey of client.admin.organization.adminAPIKeys.list()) {
|
|
5042
|
+
* // ...
|
|
5043
|
+
* }
|
|
5044
|
+
* ```
|
|
5045
|
+
*/
|
|
5046
|
+
list(query = {}, options) {
|
|
5047
|
+
return this._client.getAPIList('/organization/admin_api_keys', (CursorPage), {
|
|
5048
|
+
query,
|
|
5049
|
+
...options,
|
|
5050
|
+
__security: { adminAPIKeyAuth: true },
|
|
5051
|
+
});
|
|
5052
|
+
}
|
|
5053
|
+
/**
|
|
5054
|
+
* Delete an organization admin API key
|
|
5055
|
+
*
|
|
5056
|
+
* @example
|
|
5057
|
+
* ```ts
|
|
5058
|
+
* const adminAPIKey =
|
|
5059
|
+
* await client.admin.organization.adminAPIKeys.delete(
|
|
5060
|
+
* 'key_id',
|
|
5061
|
+
* );
|
|
5062
|
+
* ```
|
|
5063
|
+
*/
|
|
5064
|
+
delete(keyID, options) {
|
|
5065
|
+
return this._client.delete(path `/organization/admin_api_keys/${keyID}`, {
|
|
5066
|
+
...options,
|
|
5067
|
+
__security: { adminAPIKeyAuth: true },
|
|
5068
|
+
});
|
|
5069
|
+
}
|
|
5070
|
+
}
|
|
5071
|
+
|
|
5072
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5073
|
+
/**
|
|
5074
|
+
* List user actions and configuration changes within this organization.
|
|
5075
|
+
*/
|
|
5076
|
+
class AuditLogs extends APIResource {
|
|
5077
|
+
/**
|
|
5078
|
+
* List user actions and configuration changes within this organization.
|
|
5079
|
+
*
|
|
5080
|
+
* @example
|
|
5081
|
+
* ```ts
|
|
5082
|
+
* // Automatically fetches more pages as needed.
|
|
5083
|
+
* for await (const auditLogListResponse of client.admin.organization.auditLogs.list()) {
|
|
5084
|
+
* // ...
|
|
5085
|
+
* }
|
|
5086
|
+
* ```
|
|
5087
|
+
*/
|
|
5088
|
+
list(query = {}, options) {
|
|
5089
|
+
return this._client.getAPIList('/organization/audit_logs', (ConversationCursorPage), {
|
|
5090
|
+
query,
|
|
5091
|
+
...options,
|
|
5092
|
+
__security: { adminAPIKeyAuth: true },
|
|
5093
|
+
});
|
|
5094
|
+
}
|
|
5095
|
+
}
|
|
5096
|
+
|
|
5097
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5098
|
+
let Certificates$1 = class Certificates extends APIResource {
|
|
5099
|
+
/**
|
|
5100
|
+
* Upload a certificate to the organization. This does **not** automatically
|
|
5101
|
+
* activate the certificate.
|
|
5102
|
+
*
|
|
5103
|
+
* Organizations can upload up to 50 certificates.
|
|
5104
|
+
*
|
|
5105
|
+
* @example
|
|
5106
|
+
* ```ts
|
|
5107
|
+
* const certificate =
|
|
5108
|
+
* await client.admin.organization.certificates.create({
|
|
5109
|
+
* certificate: 'certificate',
|
|
5110
|
+
* });
|
|
5111
|
+
* ```
|
|
5112
|
+
*/
|
|
5113
|
+
create(body, options) {
|
|
5114
|
+
return this._client.post('/organization/certificates', {
|
|
5115
|
+
body,
|
|
5116
|
+
...options,
|
|
5117
|
+
__security: { adminAPIKeyAuth: true },
|
|
5118
|
+
});
|
|
5119
|
+
}
|
|
5120
|
+
/**
|
|
5121
|
+
* Get a certificate that has been uploaded to the organization.
|
|
5122
|
+
*
|
|
5123
|
+
* You can get a certificate regardless of whether it is active or not.
|
|
5124
|
+
*
|
|
5125
|
+
* @example
|
|
5126
|
+
* ```ts
|
|
5127
|
+
* const certificate =
|
|
5128
|
+
* await client.admin.organization.certificates.retrieve(
|
|
5129
|
+
* 'certificate_id',
|
|
5130
|
+
* );
|
|
5131
|
+
* ```
|
|
5132
|
+
*/
|
|
5133
|
+
retrieve(certificateID, query = {}, options) {
|
|
5134
|
+
return this._client.get(path `/organization/certificates/${certificateID}`, {
|
|
5135
|
+
query,
|
|
5136
|
+
...options,
|
|
5137
|
+
__security: { adminAPIKeyAuth: true },
|
|
5138
|
+
});
|
|
5139
|
+
}
|
|
5140
|
+
/**
|
|
5141
|
+
* Modify a certificate. Note that only the name can be modified.
|
|
5142
|
+
*
|
|
5143
|
+
* @example
|
|
5144
|
+
* ```ts
|
|
5145
|
+
* const certificate =
|
|
5146
|
+
* await client.admin.organization.certificates.update(
|
|
5147
|
+
* 'certificate_id',
|
|
5148
|
+
* );
|
|
5149
|
+
* ```
|
|
5150
|
+
*/
|
|
5151
|
+
update(certificateID, body, options) {
|
|
5152
|
+
return this._client.post(path `/organization/certificates/${certificateID}`, {
|
|
5153
|
+
body,
|
|
5154
|
+
...options,
|
|
5155
|
+
__security: { adminAPIKeyAuth: true },
|
|
5156
|
+
});
|
|
5157
|
+
}
|
|
5158
|
+
/**
|
|
5159
|
+
* List uploaded certificates for this organization.
|
|
5160
|
+
*
|
|
5161
|
+
* @example
|
|
5162
|
+
* ```ts
|
|
5163
|
+
* // Automatically fetches more pages as needed.
|
|
5164
|
+
* for await (const certificateListResponse of client.admin.organization.certificates.list()) {
|
|
5165
|
+
* // ...
|
|
5166
|
+
* }
|
|
5167
|
+
* ```
|
|
5168
|
+
*/
|
|
5169
|
+
list(query = {}, options) {
|
|
5170
|
+
return this._client.getAPIList('/organization/certificates', (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5171
|
+
}
|
|
5172
|
+
/**
|
|
5173
|
+
* Delete a certificate from the organization.
|
|
5174
|
+
*
|
|
5175
|
+
* The certificate must be inactive for the organization and all projects.
|
|
5176
|
+
*
|
|
5177
|
+
* @example
|
|
5178
|
+
* ```ts
|
|
5179
|
+
* const certificate =
|
|
5180
|
+
* await client.admin.organization.certificates.delete(
|
|
5181
|
+
* 'certificate_id',
|
|
5182
|
+
* );
|
|
5183
|
+
* ```
|
|
5184
|
+
*/
|
|
5185
|
+
delete(certificateID, options) {
|
|
5186
|
+
return this._client.delete(path `/organization/certificates/${certificateID}`, {
|
|
5187
|
+
...options,
|
|
5188
|
+
__security: { adminAPIKeyAuth: true },
|
|
5189
|
+
});
|
|
5190
|
+
}
|
|
5191
|
+
/**
|
|
5192
|
+
* Activate certificates at the organization level.
|
|
5193
|
+
*
|
|
5194
|
+
* You can atomically and idempotently activate up to 10 certificates at a time.
|
|
5195
|
+
*
|
|
5196
|
+
* @example
|
|
5197
|
+
* ```ts
|
|
5198
|
+
* // Automatically fetches more pages as needed.
|
|
5199
|
+
* for await (const certificateActivateResponse of client.admin.organization.certificates.activate(
|
|
5200
|
+
* { certificate_ids: ['cert_abc'] },
|
|
5201
|
+
* )) {
|
|
5202
|
+
* // ...
|
|
5203
|
+
* }
|
|
5204
|
+
* ```
|
|
5205
|
+
*/
|
|
5206
|
+
activate(body, options) {
|
|
5207
|
+
return this._client.getAPIList('/organization/certificates/activate', (Page), {
|
|
5208
|
+
body,
|
|
5209
|
+
method: 'post',
|
|
5210
|
+
...options,
|
|
5211
|
+
__security: { adminAPIKeyAuth: true },
|
|
5212
|
+
});
|
|
5213
|
+
}
|
|
5214
|
+
/**
|
|
5215
|
+
* Deactivate certificates at the organization level.
|
|
5216
|
+
*
|
|
5217
|
+
* You can atomically and idempotently deactivate up to 10 certificates at a time.
|
|
5218
|
+
*
|
|
5219
|
+
* @example
|
|
5220
|
+
* ```ts
|
|
5221
|
+
* // Automatically fetches more pages as needed.
|
|
5222
|
+
* for await (const certificateDeactivateResponse of client.admin.organization.certificates.deactivate(
|
|
5223
|
+
* { certificate_ids: ['cert_abc'] },
|
|
5224
|
+
* )) {
|
|
5225
|
+
* // ...
|
|
5226
|
+
* }
|
|
5227
|
+
* ```
|
|
5228
|
+
*/
|
|
5229
|
+
deactivate(body, options) {
|
|
5230
|
+
return this._client.getAPIList('/organization/certificates/deactivate', (Page), { body, method: 'post', ...options, __security: { adminAPIKeyAuth: true } });
|
|
5231
|
+
}
|
|
5232
|
+
};
|
|
5233
|
+
|
|
5234
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5235
|
+
class Invites extends APIResource {
|
|
5236
|
+
/**
|
|
5237
|
+
* Create an invite for a user to the organization. The invite must be accepted by
|
|
5238
|
+
* the user before they have access to the organization.
|
|
5239
|
+
*
|
|
5240
|
+
* @example
|
|
5241
|
+
* ```ts
|
|
5242
|
+
* const invite =
|
|
5243
|
+
* await client.admin.organization.invites.create({
|
|
5244
|
+
* email: 'email',
|
|
5245
|
+
* role: 'reader',
|
|
5246
|
+
* });
|
|
5247
|
+
* ```
|
|
5248
|
+
*/
|
|
5249
|
+
create(body, options) {
|
|
5250
|
+
return this._client.post('/organization/invites', {
|
|
5251
|
+
body,
|
|
5252
|
+
...options,
|
|
5253
|
+
__security: { adminAPIKeyAuth: true },
|
|
5254
|
+
});
|
|
5255
|
+
}
|
|
5256
|
+
/**
|
|
5257
|
+
* Retrieves an invite.
|
|
5258
|
+
*
|
|
5259
|
+
* @example
|
|
5260
|
+
* ```ts
|
|
5261
|
+
* const invite =
|
|
5262
|
+
* await client.admin.organization.invites.retrieve(
|
|
5263
|
+
* 'invite_id',
|
|
5264
|
+
* );
|
|
5265
|
+
* ```
|
|
5266
|
+
*/
|
|
5267
|
+
retrieve(inviteID, options) {
|
|
5268
|
+
return this._client.get(path `/organization/invites/${inviteID}`, {
|
|
5269
|
+
...options,
|
|
5270
|
+
__security: { adminAPIKeyAuth: true },
|
|
5271
|
+
});
|
|
5272
|
+
}
|
|
5273
|
+
/**
|
|
5274
|
+
* Returns a list of invites in the organization.
|
|
5275
|
+
*
|
|
5276
|
+
* @example
|
|
5277
|
+
* ```ts
|
|
5278
|
+
* // Automatically fetches more pages as needed.
|
|
5279
|
+
* for await (const invite of client.admin.organization.invites.list()) {
|
|
5280
|
+
* // ...
|
|
5281
|
+
* }
|
|
5282
|
+
* ```
|
|
5283
|
+
*/
|
|
5284
|
+
list(query = {}, options) {
|
|
5285
|
+
return this._client.getAPIList('/organization/invites', (ConversationCursorPage), {
|
|
5286
|
+
query,
|
|
5287
|
+
...options,
|
|
5288
|
+
__security: { adminAPIKeyAuth: true },
|
|
5289
|
+
});
|
|
5290
|
+
}
|
|
5291
|
+
/**
|
|
5292
|
+
* Delete an invite. If the invite has already been accepted, it cannot be deleted.
|
|
5293
|
+
*
|
|
5294
|
+
* @example
|
|
5295
|
+
* ```ts
|
|
5296
|
+
* const invite =
|
|
5297
|
+
* await client.admin.organization.invites.delete(
|
|
5298
|
+
* 'invite_id',
|
|
5299
|
+
* );
|
|
5300
|
+
* ```
|
|
5301
|
+
*/
|
|
5302
|
+
delete(inviteID, options) {
|
|
5303
|
+
return this._client.delete(path `/organization/invites/${inviteID}`, {
|
|
5304
|
+
...options,
|
|
5305
|
+
__security: { adminAPIKeyAuth: true },
|
|
5306
|
+
});
|
|
5307
|
+
}
|
|
5308
|
+
}
|
|
5309
|
+
|
|
5310
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5311
|
+
let Roles$5 = class Roles extends APIResource {
|
|
5312
|
+
/**
|
|
5313
|
+
* Creates a custom role for the organization.
|
|
5314
|
+
*
|
|
5315
|
+
* @example
|
|
5316
|
+
* ```ts
|
|
5317
|
+
* const role = await client.admin.organization.roles.create({
|
|
5318
|
+
* permissions: ['string'],
|
|
5319
|
+
* role_name: 'role_name',
|
|
5320
|
+
* });
|
|
5321
|
+
* ```
|
|
5322
|
+
*/
|
|
5323
|
+
create(body, options) {
|
|
5324
|
+
return this._client.post('/organization/roles', {
|
|
5325
|
+
body,
|
|
5326
|
+
...options,
|
|
5327
|
+
__security: { adminAPIKeyAuth: true },
|
|
5328
|
+
});
|
|
5329
|
+
}
|
|
5330
|
+
/**
|
|
5331
|
+
* Updates an existing organization role.
|
|
5332
|
+
*
|
|
5333
|
+
* @example
|
|
5334
|
+
* ```ts
|
|
5335
|
+
* const role = await client.admin.organization.roles.update(
|
|
5336
|
+
* 'role_id',
|
|
5337
|
+
* );
|
|
5338
|
+
* ```
|
|
5339
|
+
*/
|
|
5340
|
+
update(roleID, body, options) {
|
|
5341
|
+
return this._client.post(path `/organization/roles/${roleID}`, {
|
|
5342
|
+
body,
|
|
5343
|
+
...options,
|
|
5344
|
+
__security: { adminAPIKeyAuth: true },
|
|
5345
|
+
});
|
|
5346
|
+
}
|
|
5347
|
+
/**
|
|
5348
|
+
* Lists the roles configured for the organization.
|
|
5349
|
+
*
|
|
5350
|
+
* @example
|
|
5351
|
+
* ```ts
|
|
5352
|
+
* // Automatically fetches more pages as needed.
|
|
5353
|
+
* for await (const role of client.admin.organization.roles.list()) {
|
|
5354
|
+
* // ...
|
|
5355
|
+
* }
|
|
5356
|
+
* ```
|
|
5357
|
+
*/
|
|
5358
|
+
list(query = {}, options) {
|
|
5359
|
+
return this._client.getAPIList('/organization/roles', (NextCursorPage), {
|
|
5360
|
+
query,
|
|
5361
|
+
...options,
|
|
5362
|
+
__security: { adminAPIKeyAuth: true },
|
|
5363
|
+
});
|
|
5364
|
+
}
|
|
5365
|
+
/**
|
|
5366
|
+
* Deletes a custom role from the organization.
|
|
5367
|
+
*
|
|
5368
|
+
* @example
|
|
5369
|
+
* ```ts
|
|
5370
|
+
* const role = await client.admin.organization.roles.delete(
|
|
5371
|
+
* 'role_id',
|
|
5372
|
+
* );
|
|
5373
|
+
* ```
|
|
5374
|
+
*/
|
|
5375
|
+
delete(roleID, options) {
|
|
5376
|
+
return this._client.delete(path `/organization/roles/${roleID}`, {
|
|
5377
|
+
...options,
|
|
5378
|
+
__security: { adminAPIKeyAuth: true },
|
|
5379
|
+
});
|
|
5380
|
+
}
|
|
5381
|
+
};
|
|
5382
|
+
|
|
5383
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5384
|
+
class Usage extends APIResource {
|
|
5385
|
+
/**
|
|
5386
|
+
* Get audio speeches usage details for the organization.
|
|
5387
|
+
*
|
|
5388
|
+
* @example
|
|
5389
|
+
* ```ts
|
|
5390
|
+
* const response =
|
|
5391
|
+
* await client.admin.organization.usage.audioSpeeches({
|
|
5392
|
+
* start_time: 0,
|
|
5393
|
+
* });
|
|
5394
|
+
* ```
|
|
5395
|
+
*/
|
|
5396
|
+
audioSpeeches(query, options) {
|
|
5397
|
+
return this._client.get('/organization/usage/audio_speeches', {
|
|
5398
|
+
query,
|
|
5399
|
+
...options,
|
|
5400
|
+
__security: { adminAPIKeyAuth: true },
|
|
5401
|
+
});
|
|
5402
|
+
}
|
|
5403
|
+
/**
|
|
5404
|
+
* Get audio transcriptions usage details for the organization.
|
|
5405
|
+
*
|
|
5406
|
+
* @example
|
|
5407
|
+
* ```ts
|
|
5408
|
+
* const response =
|
|
5409
|
+
* await client.admin.organization.usage.audioTranscriptions(
|
|
5410
|
+
* { start_time: 0 },
|
|
5411
|
+
* );
|
|
5412
|
+
* ```
|
|
5413
|
+
*/
|
|
5414
|
+
audioTranscriptions(query, options) {
|
|
5415
|
+
return this._client.get('/organization/usage/audio_transcriptions', {
|
|
5416
|
+
query,
|
|
5417
|
+
...options,
|
|
5418
|
+
__security: { adminAPIKeyAuth: true },
|
|
5419
|
+
});
|
|
5420
|
+
}
|
|
5421
|
+
/**
|
|
5422
|
+
* Get code interpreter sessions usage details for the organization.
|
|
5423
|
+
*
|
|
5424
|
+
* @example
|
|
5425
|
+
* ```ts
|
|
5426
|
+
* const response =
|
|
5427
|
+
* await client.admin.organization.usage.codeInterpreterSessions(
|
|
5428
|
+
* { start_time: 0 },
|
|
5429
|
+
* );
|
|
5430
|
+
* ```
|
|
5431
|
+
*/
|
|
5432
|
+
codeInterpreterSessions(query, options) {
|
|
5433
|
+
return this._client.get('/organization/usage/code_interpreter_sessions', {
|
|
5434
|
+
query,
|
|
5435
|
+
...options,
|
|
5436
|
+
__security: { adminAPIKeyAuth: true },
|
|
5437
|
+
});
|
|
5438
|
+
}
|
|
5439
|
+
/**
|
|
5440
|
+
* Get completions usage details for the organization.
|
|
5441
|
+
*
|
|
5442
|
+
* @example
|
|
5443
|
+
* ```ts
|
|
5444
|
+
* const response =
|
|
5445
|
+
* await client.admin.organization.usage.completions({
|
|
5446
|
+
* start_time: 0,
|
|
5447
|
+
* });
|
|
5448
|
+
* ```
|
|
5449
|
+
*/
|
|
5450
|
+
completions(query, options) {
|
|
5451
|
+
return this._client.get('/organization/usage/completions', {
|
|
5452
|
+
query,
|
|
5453
|
+
...options,
|
|
5454
|
+
__security: { adminAPIKeyAuth: true },
|
|
5455
|
+
});
|
|
5456
|
+
}
|
|
5457
|
+
/**
|
|
5458
|
+
* Get costs details for the organization.
|
|
5459
|
+
*
|
|
5460
|
+
* @example
|
|
5461
|
+
* ```ts
|
|
5462
|
+
* const response =
|
|
5463
|
+
* await client.admin.organization.usage.costs({
|
|
5464
|
+
* start_time: 0,
|
|
5465
|
+
* });
|
|
5466
|
+
* ```
|
|
5467
|
+
*/
|
|
5468
|
+
costs(query, options) {
|
|
5469
|
+
return this._client.get('/organization/costs', {
|
|
5470
|
+
query,
|
|
5471
|
+
...options,
|
|
5472
|
+
__security: { adminAPIKeyAuth: true },
|
|
5473
|
+
});
|
|
5474
|
+
}
|
|
5475
|
+
/**
|
|
5476
|
+
* Get embeddings usage details for the organization.
|
|
5477
|
+
*
|
|
5478
|
+
* @example
|
|
5479
|
+
* ```ts
|
|
5480
|
+
* const response =
|
|
5481
|
+
* await client.admin.organization.usage.embeddings({
|
|
5482
|
+
* start_time: 0,
|
|
5483
|
+
* });
|
|
5484
|
+
* ```
|
|
5485
|
+
*/
|
|
5486
|
+
embeddings(query, options) {
|
|
5487
|
+
return this._client.get('/organization/usage/embeddings', {
|
|
5488
|
+
query,
|
|
5489
|
+
...options,
|
|
5490
|
+
__security: { adminAPIKeyAuth: true },
|
|
5491
|
+
});
|
|
5492
|
+
}
|
|
5493
|
+
/**
|
|
5494
|
+
* Get images usage details for the organization.
|
|
5495
|
+
*
|
|
5496
|
+
* @example
|
|
5497
|
+
* ```ts
|
|
5498
|
+
* const response =
|
|
5499
|
+
* await client.admin.organization.usage.images({
|
|
5500
|
+
* start_time: 0,
|
|
5501
|
+
* });
|
|
5502
|
+
* ```
|
|
5503
|
+
*/
|
|
5504
|
+
images(query, options) {
|
|
5505
|
+
return this._client.get('/organization/usage/images', {
|
|
5506
|
+
query,
|
|
5507
|
+
...options,
|
|
5508
|
+
__security: { adminAPIKeyAuth: true },
|
|
5509
|
+
});
|
|
5510
|
+
}
|
|
5511
|
+
/**
|
|
5512
|
+
* Get moderations usage details for the organization.
|
|
5513
|
+
*
|
|
5514
|
+
* @example
|
|
5515
|
+
* ```ts
|
|
5516
|
+
* const response =
|
|
5517
|
+
* await client.admin.organization.usage.moderations({
|
|
5518
|
+
* start_time: 0,
|
|
5519
|
+
* });
|
|
5520
|
+
* ```
|
|
5521
|
+
*/
|
|
5522
|
+
moderations(query, options) {
|
|
5523
|
+
return this._client.get('/organization/usage/moderations', {
|
|
5524
|
+
query,
|
|
5525
|
+
...options,
|
|
5526
|
+
__security: { adminAPIKeyAuth: true },
|
|
5527
|
+
});
|
|
5528
|
+
}
|
|
5529
|
+
/**
|
|
5530
|
+
* Get vector stores usage details for the organization.
|
|
5531
|
+
*
|
|
5532
|
+
* @example
|
|
5533
|
+
* ```ts
|
|
5534
|
+
* const response =
|
|
5535
|
+
* await client.admin.organization.usage.vectorStores({
|
|
5536
|
+
* start_time: 0,
|
|
5537
|
+
* });
|
|
5538
|
+
* ```
|
|
5539
|
+
*/
|
|
5540
|
+
vectorStores(query, options) {
|
|
5541
|
+
return this._client.get('/organization/usage/vector_stores', {
|
|
5542
|
+
query,
|
|
5543
|
+
...options,
|
|
5544
|
+
__security: { adminAPIKeyAuth: true },
|
|
5545
|
+
});
|
|
5546
|
+
}
|
|
5547
|
+
}
|
|
5548
|
+
|
|
5549
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5550
|
+
let Roles$4 = class Roles extends APIResource {
|
|
5551
|
+
/**
|
|
5552
|
+
* Assigns an organization role to a group within the organization.
|
|
5553
|
+
*
|
|
5554
|
+
* @example
|
|
5555
|
+
* ```ts
|
|
5556
|
+
* const role =
|
|
5557
|
+
* await client.admin.organization.groups.roles.create(
|
|
5558
|
+
* 'group_id',
|
|
5559
|
+
* { role_id: 'role_id' },
|
|
5560
|
+
* );
|
|
5561
|
+
* ```
|
|
5562
|
+
*/
|
|
5563
|
+
create(groupID, body, options) {
|
|
5564
|
+
return this._client.post(path `/organization/groups/${groupID}/roles`, {
|
|
5565
|
+
body,
|
|
5566
|
+
...options,
|
|
5567
|
+
__security: { adminAPIKeyAuth: true },
|
|
5568
|
+
});
|
|
5569
|
+
}
|
|
5570
|
+
/**
|
|
5571
|
+
* Lists the organization roles assigned to a group within the organization.
|
|
5572
|
+
*
|
|
5573
|
+
* @example
|
|
5574
|
+
* ```ts
|
|
5575
|
+
* // Automatically fetches more pages as needed.
|
|
5576
|
+
* for await (const roleListResponse of client.admin.organization.groups.roles.list(
|
|
5577
|
+
* 'group_id',
|
|
5578
|
+
* )) {
|
|
5579
|
+
* // ...
|
|
5580
|
+
* }
|
|
5581
|
+
* ```
|
|
5582
|
+
*/
|
|
5583
|
+
list(groupID, query = {}, options) {
|
|
5584
|
+
return this._client.getAPIList(path `/organization/groups/${groupID}/roles`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5585
|
+
}
|
|
5586
|
+
/**
|
|
5587
|
+
* Unassigns an organization role from a group within the organization.
|
|
5588
|
+
*
|
|
5589
|
+
* @example
|
|
5590
|
+
* ```ts
|
|
5591
|
+
* const role =
|
|
5592
|
+
* await client.admin.organization.groups.roles.delete(
|
|
5593
|
+
* 'role_id',
|
|
5594
|
+
* { group_id: 'group_id' },
|
|
5595
|
+
* );
|
|
5596
|
+
* ```
|
|
5597
|
+
*/
|
|
5598
|
+
delete(roleID, params, options) {
|
|
5599
|
+
const { group_id } = params;
|
|
5600
|
+
return this._client.delete(path `/organization/groups/${group_id}/roles/${roleID}`, {
|
|
5601
|
+
...options,
|
|
5602
|
+
__security: { adminAPIKeyAuth: true },
|
|
5603
|
+
});
|
|
5604
|
+
}
|
|
5605
|
+
};
|
|
5606
|
+
|
|
5607
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5608
|
+
let Users$2 = class Users extends APIResource {
|
|
5609
|
+
/**
|
|
5610
|
+
* Adds a user to a group.
|
|
5611
|
+
*
|
|
5612
|
+
* @example
|
|
5613
|
+
* ```ts
|
|
5614
|
+
* const user =
|
|
5615
|
+
* await client.admin.organization.groups.users.create(
|
|
5616
|
+
* 'group_id',
|
|
5617
|
+
* { user_id: 'user_id' },
|
|
5618
|
+
* );
|
|
5619
|
+
* ```
|
|
5620
|
+
*/
|
|
5621
|
+
create(groupID, body, options) {
|
|
5622
|
+
return this._client.post(path `/organization/groups/${groupID}/users`, {
|
|
5623
|
+
body,
|
|
5624
|
+
...options,
|
|
5625
|
+
__security: { adminAPIKeyAuth: true },
|
|
5626
|
+
});
|
|
5627
|
+
}
|
|
5628
|
+
/**
|
|
5629
|
+
* Lists the users assigned to a group.
|
|
5630
|
+
*
|
|
5631
|
+
* @example
|
|
5632
|
+
* ```ts
|
|
5633
|
+
* // Automatically fetches more pages as needed.
|
|
5634
|
+
* for await (const organizationGroupUser of client.admin.organization.groups.users.list(
|
|
5635
|
+
* 'group_id',
|
|
5636
|
+
* )) {
|
|
5637
|
+
* // ...
|
|
5638
|
+
* }
|
|
5639
|
+
* ```
|
|
5640
|
+
*/
|
|
5641
|
+
list(groupID, query = {}, options) {
|
|
5642
|
+
return this._client.getAPIList(path `/organization/groups/${groupID}/users`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5643
|
+
}
|
|
5644
|
+
/**
|
|
5645
|
+
* Removes a user from a group.
|
|
5646
|
+
*
|
|
5647
|
+
* @example
|
|
5648
|
+
* ```ts
|
|
5649
|
+
* const user =
|
|
5650
|
+
* await client.admin.organization.groups.users.delete(
|
|
5651
|
+
* 'user_id',
|
|
5652
|
+
* { group_id: 'group_id' },
|
|
5653
|
+
* );
|
|
5654
|
+
* ```
|
|
5655
|
+
*/
|
|
5656
|
+
delete(userID, params, options) {
|
|
5657
|
+
const { group_id } = params;
|
|
5658
|
+
return this._client.delete(path `/organization/groups/${group_id}/users/${userID}`, {
|
|
5659
|
+
...options,
|
|
5660
|
+
__security: { adminAPIKeyAuth: true },
|
|
5661
|
+
});
|
|
5662
|
+
}
|
|
5663
|
+
};
|
|
5664
|
+
|
|
5665
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5666
|
+
let Groups$1 = class Groups extends APIResource {
|
|
5667
|
+
constructor() {
|
|
5668
|
+
super(...arguments);
|
|
5669
|
+
this.users = new Users$2(this._client);
|
|
5670
|
+
this.roles = new Roles$4(this._client);
|
|
5671
|
+
}
|
|
5672
|
+
/**
|
|
5673
|
+
* Creates a new group in the organization.
|
|
5674
|
+
*
|
|
5675
|
+
* @example
|
|
5676
|
+
* ```ts
|
|
5677
|
+
* const group = await client.admin.organization.groups.create(
|
|
5678
|
+
* { name: 'x' },
|
|
5679
|
+
* );
|
|
5680
|
+
* ```
|
|
5681
|
+
*/
|
|
5682
|
+
create(body, options) {
|
|
5683
|
+
return this._client.post('/organization/groups', {
|
|
5684
|
+
body,
|
|
5685
|
+
...options,
|
|
5686
|
+
__security: { adminAPIKeyAuth: true },
|
|
5687
|
+
});
|
|
5688
|
+
}
|
|
5689
|
+
/**
|
|
5690
|
+
* Updates a group's information.
|
|
5691
|
+
*
|
|
5692
|
+
* @example
|
|
5693
|
+
* ```ts
|
|
5694
|
+
* const group = await client.admin.organization.groups.update(
|
|
5695
|
+
* 'group_id',
|
|
5696
|
+
* { name: 'x' },
|
|
5697
|
+
* );
|
|
5698
|
+
* ```
|
|
5699
|
+
*/
|
|
5700
|
+
update(groupID, body, options) {
|
|
5701
|
+
return this._client.post(path `/organization/groups/${groupID}`, {
|
|
5702
|
+
body,
|
|
5703
|
+
...options,
|
|
5704
|
+
__security: { adminAPIKeyAuth: true },
|
|
5705
|
+
});
|
|
5706
|
+
}
|
|
5707
|
+
/**
|
|
5708
|
+
* Lists all groups in the organization.
|
|
5709
|
+
*
|
|
5710
|
+
* @example
|
|
5711
|
+
* ```ts
|
|
5712
|
+
* // Automatically fetches more pages as needed.
|
|
5713
|
+
* for await (const group of client.admin.organization.groups.list()) {
|
|
5714
|
+
* // ...
|
|
5715
|
+
* }
|
|
5716
|
+
* ```
|
|
5717
|
+
*/
|
|
5718
|
+
list(query = {}, options) {
|
|
5719
|
+
return this._client.getAPIList('/organization/groups', (NextCursorPage), {
|
|
5720
|
+
query,
|
|
5721
|
+
...options,
|
|
5722
|
+
__security: { adminAPIKeyAuth: true },
|
|
5723
|
+
});
|
|
5724
|
+
}
|
|
5725
|
+
/**
|
|
5726
|
+
* Deletes a group from the organization.
|
|
5727
|
+
*
|
|
5728
|
+
* @example
|
|
5729
|
+
* ```ts
|
|
5730
|
+
* const group = await client.admin.organization.groups.delete(
|
|
5731
|
+
* 'group_id',
|
|
5732
|
+
* );
|
|
5733
|
+
* ```
|
|
5734
|
+
*/
|
|
5735
|
+
delete(groupID, options) {
|
|
5736
|
+
return this._client.delete(path `/organization/groups/${groupID}`, {
|
|
5737
|
+
...options,
|
|
5738
|
+
__security: { adminAPIKeyAuth: true },
|
|
5739
|
+
});
|
|
5740
|
+
}
|
|
5741
|
+
};
|
|
5742
|
+
Groups$1.Users = Users$2;
|
|
5743
|
+
Groups$1.Roles = Roles$4;
|
|
5744
|
+
|
|
5745
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5746
|
+
class APIKeys extends APIResource {
|
|
5747
|
+
/**
|
|
5748
|
+
* Retrieves an API key in the project.
|
|
5749
|
+
*
|
|
5750
|
+
* @example
|
|
5751
|
+
* ```ts
|
|
5752
|
+
* const projectAPIKey =
|
|
5753
|
+
* await client.admin.organization.projects.apiKeys.retrieve(
|
|
5754
|
+
* 'api_key_id',
|
|
5755
|
+
* { project_id: 'project_id' },
|
|
5756
|
+
* );
|
|
5757
|
+
* ```
|
|
5758
|
+
*/
|
|
5759
|
+
retrieve(apiKeyID, params, options) {
|
|
5760
|
+
const { project_id } = params;
|
|
5761
|
+
return this._client.get(path `/organization/projects/${project_id}/api_keys/${apiKeyID}`, {
|
|
5762
|
+
...options,
|
|
5763
|
+
__security: { adminAPIKeyAuth: true },
|
|
5764
|
+
});
|
|
5765
|
+
}
|
|
5766
|
+
/**
|
|
5767
|
+
* Returns a list of API keys in the project.
|
|
5768
|
+
*
|
|
5769
|
+
* @example
|
|
5770
|
+
* ```ts
|
|
5771
|
+
* // Automatically fetches more pages as needed.
|
|
5772
|
+
* for await (const projectAPIKey of client.admin.organization.projects.apiKeys.list(
|
|
5773
|
+
* 'project_id',
|
|
5774
|
+
* )) {
|
|
5775
|
+
* // ...
|
|
5776
|
+
* }
|
|
5777
|
+
* ```
|
|
5778
|
+
*/
|
|
5779
|
+
list(projectID, query = {}, options) {
|
|
5780
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/api_keys`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5781
|
+
}
|
|
5782
|
+
/**
|
|
5783
|
+
* Deletes an API key from the project.
|
|
5784
|
+
*
|
|
5785
|
+
* Returns confirmation of the key deletion, or an error if the key belonged to a
|
|
5786
|
+
* service account.
|
|
5787
|
+
*
|
|
5788
|
+
* @example
|
|
5789
|
+
* ```ts
|
|
5790
|
+
* const apiKey =
|
|
5791
|
+
* await client.admin.organization.projects.apiKeys.delete(
|
|
5792
|
+
* 'api_key_id',
|
|
5793
|
+
* { project_id: 'project_id' },
|
|
5794
|
+
* );
|
|
5795
|
+
* ```
|
|
5796
|
+
*/
|
|
5797
|
+
delete(apiKeyID, params, options) {
|
|
5798
|
+
const { project_id } = params;
|
|
5799
|
+
return this._client.delete(path `/organization/projects/${project_id}/api_keys/${apiKeyID}`, {
|
|
5800
|
+
...options,
|
|
5801
|
+
__security: { adminAPIKeyAuth: true },
|
|
5802
|
+
});
|
|
5803
|
+
}
|
|
5804
|
+
}
|
|
5805
|
+
|
|
5806
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5807
|
+
class Certificates extends APIResource {
|
|
5808
|
+
/**
|
|
5809
|
+
* List certificates for this project.
|
|
5810
|
+
*
|
|
5811
|
+
* @example
|
|
5812
|
+
* ```ts
|
|
5813
|
+
* // Automatically fetches more pages as needed.
|
|
5814
|
+
* for await (const certificateListResponse of client.admin.organization.projects.certificates.list(
|
|
5815
|
+
* 'project_id',
|
|
5816
|
+
* )) {
|
|
5817
|
+
* // ...
|
|
5818
|
+
* }
|
|
5819
|
+
* ```
|
|
5820
|
+
*/
|
|
5821
|
+
list(projectID, query = {}, options) {
|
|
5822
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/certificates`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5823
|
+
}
|
|
5824
|
+
/**
|
|
5825
|
+
* Activate certificates at the project level.
|
|
5826
|
+
*
|
|
5827
|
+
* You can atomically and idempotently activate up to 10 certificates at a time.
|
|
5828
|
+
*
|
|
5829
|
+
* @example
|
|
5830
|
+
* ```ts
|
|
5831
|
+
* // Automatically fetches more pages as needed.
|
|
5832
|
+
* for await (const certificateActivateResponse of client.admin.organization.projects.certificates.activate(
|
|
5833
|
+
* 'project_id',
|
|
5834
|
+
* { certificate_ids: ['cert_abc'] },
|
|
5835
|
+
* )) {
|
|
5836
|
+
* // ...
|
|
5837
|
+
* }
|
|
5838
|
+
* ```
|
|
5839
|
+
*/
|
|
5840
|
+
activate(projectID, body, options) {
|
|
5841
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/certificates/activate`, (Page), { body, method: 'post', ...options, __security: { adminAPIKeyAuth: true } });
|
|
5842
|
+
}
|
|
5843
|
+
/**
|
|
5844
|
+
* Deactivate certificates at the project level. You can atomically and
|
|
5845
|
+
* idempotently deactivate up to 10 certificates at a time.
|
|
5846
|
+
*
|
|
5847
|
+
* @example
|
|
5848
|
+
* ```ts
|
|
5849
|
+
* // Automatically fetches more pages as needed.
|
|
5850
|
+
* for await (const certificateDeactivateResponse of client.admin.organization.projects.certificates.deactivate(
|
|
5851
|
+
* 'project_id',
|
|
5852
|
+
* { certificate_ids: ['cert_abc'] },
|
|
5853
|
+
* )) {
|
|
5854
|
+
* // ...
|
|
5855
|
+
* }
|
|
5856
|
+
* ```
|
|
5857
|
+
*/
|
|
5858
|
+
deactivate(projectID, body, options) {
|
|
5859
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/certificates/deactivate`, (Page), { body, method: 'post', ...options, __security: { adminAPIKeyAuth: true } });
|
|
5860
|
+
}
|
|
5861
|
+
}
|
|
5862
|
+
|
|
5863
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5864
|
+
class RateLimits extends APIResource {
|
|
5865
|
+
/**
|
|
5866
|
+
* Returns the rate limits per model for a project.
|
|
5867
|
+
*
|
|
5868
|
+
* @example
|
|
5869
|
+
* ```ts
|
|
5870
|
+
* // Automatically fetches more pages as needed.
|
|
5871
|
+
* for await (const projectRateLimit of client.admin.organization.projects.rateLimits.listRateLimits(
|
|
5872
|
+
* 'project_id',
|
|
5873
|
+
* )) {
|
|
5874
|
+
* // ...
|
|
5875
|
+
* }
|
|
5876
|
+
* ```
|
|
5877
|
+
*/
|
|
5878
|
+
listRateLimits(projectID, query = {}, options) {
|
|
5879
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/rate_limits`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5880
|
+
}
|
|
5881
|
+
/**
|
|
5882
|
+
* Updates a project rate limit.
|
|
5883
|
+
*
|
|
5884
|
+
* @example
|
|
5885
|
+
* ```ts
|
|
5886
|
+
* const projectRateLimit =
|
|
5887
|
+
* await client.admin.organization.projects.rateLimits.updateRateLimit(
|
|
5888
|
+
* 'rate_limit_id',
|
|
5889
|
+
* { project_id: 'project_id' },
|
|
5890
|
+
* );
|
|
5891
|
+
* ```
|
|
5892
|
+
*/
|
|
5893
|
+
updateRateLimit(rateLimitID, params, options) {
|
|
5894
|
+
const { project_id, ...body } = params;
|
|
5895
|
+
return this._client.post(path `/organization/projects/${project_id}/rate_limits/${rateLimitID}`, {
|
|
5896
|
+
body,
|
|
5897
|
+
...options,
|
|
5898
|
+
__security: { adminAPIKeyAuth: true },
|
|
5899
|
+
});
|
|
5900
|
+
}
|
|
5901
|
+
}
|
|
5902
|
+
|
|
5903
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5904
|
+
let Roles$3 = class Roles extends APIResource {
|
|
5905
|
+
/**
|
|
5906
|
+
* Creates a custom role for a project.
|
|
5907
|
+
*
|
|
5908
|
+
* @example
|
|
5909
|
+
* ```ts
|
|
5910
|
+
* const role =
|
|
5911
|
+
* await client.admin.organization.projects.roles.create(
|
|
5912
|
+
* 'project_id',
|
|
5913
|
+
* { permissions: ['string'], role_name: 'role_name' },
|
|
5914
|
+
* );
|
|
5915
|
+
* ```
|
|
5916
|
+
*/
|
|
5917
|
+
create(projectID, body, options) {
|
|
5918
|
+
return this._client.post(path `/projects/${projectID}/roles`, {
|
|
5919
|
+
body,
|
|
5920
|
+
...options,
|
|
5921
|
+
__security: { adminAPIKeyAuth: true },
|
|
5922
|
+
});
|
|
5923
|
+
}
|
|
5924
|
+
/**
|
|
5925
|
+
* Updates an existing project role.
|
|
5926
|
+
*
|
|
5927
|
+
* @example
|
|
5928
|
+
* ```ts
|
|
5929
|
+
* const role =
|
|
5930
|
+
* await client.admin.organization.projects.roles.update(
|
|
5931
|
+
* 'role_id',
|
|
5932
|
+
* { project_id: 'project_id' },
|
|
5933
|
+
* );
|
|
5934
|
+
* ```
|
|
5935
|
+
*/
|
|
5936
|
+
update(roleID, params, options) {
|
|
5937
|
+
const { project_id, ...body } = params;
|
|
5938
|
+
return this._client.post(path `/projects/${project_id}/roles/${roleID}`, {
|
|
5939
|
+
body,
|
|
5940
|
+
...options,
|
|
5941
|
+
__security: { adminAPIKeyAuth: true },
|
|
5942
|
+
});
|
|
5943
|
+
}
|
|
5944
|
+
/**
|
|
5945
|
+
* Lists the roles configured for a project.
|
|
5946
|
+
*
|
|
5947
|
+
* @example
|
|
5948
|
+
* ```ts
|
|
5949
|
+
* // Automatically fetches more pages as needed.
|
|
5950
|
+
* for await (const role of client.admin.organization.projects.roles.list(
|
|
5951
|
+
* 'project_id',
|
|
5952
|
+
* )) {
|
|
5953
|
+
* // ...
|
|
5954
|
+
* }
|
|
5955
|
+
* ```
|
|
5956
|
+
*/
|
|
5957
|
+
list(projectID, query = {}, options) {
|
|
5958
|
+
return this._client.getAPIList(path `/projects/${projectID}/roles`, (NextCursorPage), {
|
|
5959
|
+
query,
|
|
5960
|
+
...options,
|
|
5961
|
+
__security: { adminAPIKeyAuth: true },
|
|
5962
|
+
});
|
|
5963
|
+
}
|
|
5964
|
+
/**
|
|
5965
|
+
* Deletes a custom role from a project.
|
|
5966
|
+
*
|
|
5967
|
+
* @example
|
|
5968
|
+
* ```ts
|
|
5969
|
+
* const role =
|
|
5970
|
+
* await client.admin.organization.projects.roles.delete(
|
|
5971
|
+
* 'role_id',
|
|
5972
|
+
* { project_id: 'project_id' },
|
|
5973
|
+
* );
|
|
5974
|
+
* ```
|
|
5975
|
+
*/
|
|
5976
|
+
delete(roleID, params, options) {
|
|
5977
|
+
const { project_id } = params;
|
|
5978
|
+
return this._client.delete(path `/projects/${project_id}/roles/${roleID}`, {
|
|
5979
|
+
...options,
|
|
5980
|
+
__security: { adminAPIKeyAuth: true },
|
|
5981
|
+
});
|
|
5982
|
+
}
|
|
5983
|
+
};
|
|
5984
|
+
|
|
5985
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5986
|
+
class ServiceAccounts extends APIResource {
|
|
5987
|
+
/**
|
|
5988
|
+
* Creates a new service account in the project. This also returns an unredacted
|
|
5989
|
+
* API key for the service account.
|
|
5990
|
+
*
|
|
5991
|
+
* @example
|
|
5992
|
+
* ```ts
|
|
5993
|
+
* const serviceAccount =
|
|
5994
|
+
* await client.admin.organization.projects.serviceAccounts.create(
|
|
5995
|
+
* 'project_id',
|
|
5996
|
+
* { name: 'name' },
|
|
5997
|
+
* );
|
|
5998
|
+
* ```
|
|
5999
|
+
*/
|
|
6000
|
+
create(projectID, body, options) {
|
|
6001
|
+
return this._client.post(path `/organization/projects/${projectID}/service_accounts`, {
|
|
6002
|
+
body,
|
|
6003
|
+
...options,
|
|
6004
|
+
__security: { adminAPIKeyAuth: true },
|
|
6005
|
+
});
|
|
6006
|
+
}
|
|
6007
|
+
/**
|
|
6008
|
+
* Retrieves a service account in the project.
|
|
6009
|
+
*
|
|
6010
|
+
* @example
|
|
6011
|
+
* ```ts
|
|
6012
|
+
* const projectServiceAccount =
|
|
6013
|
+
* await client.admin.organization.projects.serviceAccounts.retrieve(
|
|
6014
|
+
* 'service_account_id',
|
|
6015
|
+
* { project_id: 'project_id' },
|
|
6016
|
+
* );
|
|
6017
|
+
* ```
|
|
6018
|
+
*/
|
|
6019
|
+
retrieve(serviceAccountID, params, options) {
|
|
6020
|
+
const { project_id } = params;
|
|
6021
|
+
return this._client.get(path `/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, {
|
|
6022
|
+
...options,
|
|
6023
|
+
__security: { adminAPIKeyAuth: true },
|
|
6024
|
+
});
|
|
6025
|
+
}
|
|
6026
|
+
/**
|
|
6027
|
+
* Returns a list of service accounts in the project.
|
|
6028
|
+
*
|
|
6029
|
+
* @example
|
|
6030
|
+
* ```ts
|
|
6031
|
+
* // Automatically fetches more pages as needed.
|
|
6032
|
+
* for await (const projectServiceAccount of client.admin.organization.projects.serviceAccounts.list(
|
|
6033
|
+
* 'project_id',
|
|
6034
|
+
* )) {
|
|
6035
|
+
* // ...
|
|
6036
|
+
* }
|
|
6037
|
+
* ```
|
|
6038
|
+
*/
|
|
6039
|
+
list(projectID, query = {}, options) {
|
|
6040
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/service_accounts`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
6041
|
+
}
|
|
6042
|
+
/**
|
|
6043
|
+
* Deletes a service account from the project.
|
|
6044
|
+
*
|
|
6045
|
+
* Returns confirmation of service account deletion, or an error if the project is
|
|
6046
|
+
* archived (archived projects have no service accounts).
|
|
6047
|
+
*
|
|
6048
|
+
* @example
|
|
6049
|
+
* ```ts
|
|
6050
|
+
* const serviceAccount =
|
|
6051
|
+
* await client.admin.organization.projects.serviceAccounts.delete(
|
|
6052
|
+
* 'service_account_id',
|
|
6053
|
+
* { project_id: 'project_id' },
|
|
6054
|
+
* );
|
|
6055
|
+
* ```
|
|
6056
|
+
*/
|
|
6057
|
+
delete(serviceAccountID, params, options) {
|
|
6058
|
+
const { project_id } = params;
|
|
6059
|
+
return this._client.delete(path `/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, { ...options, __security: { adminAPIKeyAuth: true } });
|
|
6060
|
+
}
|
|
6061
|
+
}
|
|
6062
|
+
|
|
6063
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6064
|
+
let Roles$2 = class Roles extends APIResource {
|
|
6065
|
+
/**
|
|
6066
|
+
* Assigns a project role to a group within a project.
|
|
6067
|
+
*
|
|
6068
|
+
* @example
|
|
6069
|
+
* ```ts
|
|
6070
|
+
* const role =
|
|
6071
|
+
* await client.admin.organization.projects.groups.roles.create(
|
|
6072
|
+
* 'group_id',
|
|
6073
|
+
* { project_id: 'project_id', role_id: 'role_id' },
|
|
6074
|
+
* );
|
|
6075
|
+
* ```
|
|
6076
|
+
*/
|
|
6077
|
+
create(groupID, params, options) {
|
|
6078
|
+
const { project_id, ...body } = params;
|
|
6079
|
+
return this._client.post(path `/projects/${project_id}/groups/${groupID}/roles`, {
|
|
6080
|
+
body,
|
|
6081
|
+
...options,
|
|
6082
|
+
__security: { adminAPIKeyAuth: true },
|
|
6083
|
+
});
|
|
6084
|
+
}
|
|
6085
|
+
/**
|
|
6086
|
+
* Lists the project roles assigned to a group within a project.
|
|
6087
|
+
*
|
|
6088
|
+
* @example
|
|
6089
|
+
* ```ts
|
|
6090
|
+
* // Automatically fetches more pages as needed.
|
|
6091
|
+
* for await (const roleListResponse of client.admin.organization.projects.groups.roles.list(
|
|
6092
|
+
* 'group_id',
|
|
6093
|
+
* { project_id: 'project_id' },
|
|
6094
|
+
* )) {
|
|
6095
|
+
* // ...
|
|
6096
|
+
* }
|
|
6097
|
+
* ```
|
|
6098
|
+
*/
|
|
6099
|
+
list(groupID, params, options) {
|
|
6100
|
+
const { project_id, ...query } = params;
|
|
6101
|
+
return this._client.getAPIList(path `/projects/${project_id}/groups/${groupID}/roles`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
6102
|
+
}
|
|
6103
|
+
/**
|
|
6104
|
+
* Unassigns a project role from a group within a project.
|
|
6105
|
+
*
|
|
6106
|
+
* @example
|
|
6107
|
+
* ```ts
|
|
6108
|
+
* const role =
|
|
6109
|
+
* await client.admin.organization.projects.groups.roles.delete(
|
|
6110
|
+
* 'role_id',
|
|
6111
|
+
* { project_id: 'project_id', group_id: 'group_id' },
|
|
6112
|
+
* );
|
|
6113
|
+
* ```
|
|
6114
|
+
*/
|
|
6115
|
+
delete(roleID, params, options) {
|
|
6116
|
+
const { project_id, group_id } = params;
|
|
6117
|
+
return this._client.delete(path `/projects/${project_id}/groups/${group_id}/roles/${roleID}`, {
|
|
6118
|
+
...options,
|
|
6119
|
+
__security: { adminAPIKeyAuth: true },
|
|
6120
|
+
});
|
|
6121
|
+
}
|
|
6122
|
+
};
|
|
6123
|
+
|
|
6124
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6125
|
+
class Groups extends APIResource {
|
|
6126
|
+
constructor() {
|
|
6127
|
+
super(...arguments);
|
|
6128
|
+
this.roles = new Roles$2(this._client);
|
|
6129
|
+
}
|
|
6130
|
+
/**
|
|
6131
|
+
* Grants a group access to a project.
|
|
6132
|
+
*
|
|
6133
|
+
* @example
|
|
6134
|
+
* ```ts
|
|
6135
|
+
* const projectGroup =
|
|
6136
|
+
* await client.admin.organization.projects.groups.create(
|
|
6137
|
+
* 'project_id',
|
|
6138
|
+
* { group_id: 'group_id', role: 'role' },
|
|
6139
|
+
* );
|
|
6140
|
+
* ```
|
|
6141
|
+
*/
|
|
6142
|
+
create(projectID, body, options) {
|
|
6143
|
+
return this._client.post(path `/organization/projects/${projectID}/groups`, {
|
|
6144
|
+
body,
|
|
6145
|
+
...options,
|
|
6146
|
+
__security: { adminAPIKeyAuth: true },
|
|
6147
|
+
});
|
|
6148
|
+
}
|
|
6149
|
+
/**
|
|
6150
|
+
* Lists the groups that have access to a project.
|
|
6151
|
+
*
|
|
6152
|
+
* @example
|
|
6153
|
+
* ```ts
|
|
6154
|
+
* // Automatically fetches more pages as needed.
|
|
6155
|
+
* for await (const projectGroup of client.admin.organization.projects.groups.list(
|
|
6156
|
+
* 'project_id',
|
|
6157
|
+
* )) {
|
|
6158
|
+
* // ...
|
|
6159
|
+
* }
|
|
6160
|
+
* ```
|
|
6161
|
+
*/
|
|
6162
|
+
list(projectID, query = {}, options) {
|
|
6163
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/groups`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
6164
|
+
}
|
|
6165
|
+
/**
|
|
6166
|
+
* Revokes a group's access to a project.
|
|
6167
|
+
*
|
|
6168
|
+
* @example
|
|
6169
|
+
* ```ts
|
|
6170
|
+
* const group =
|
|
6171
|
+
* await client.admin.organization.projects.groups.delete(
|
|
6172
|
+
* 'group_id',
|
|
6173
|
+
* { project_id: 'project_id' },
|
|
6174
|
+
* );
|
|
6175
|
+
* ```
|
|
6176
|
+
*/
|
|
6177
|
+
delete(groupID, params, options) {
|
|
6178
|
+
const { project_id } = params;
|
|
6179
|
+
return this._client.delete(path `/organization/projects/${project_id}/groups/${groupID}`, {
|
|
6180
|
+
...options,
|
|
6181
|
+
__security: { adminAPIKeyAuth: true },
|
|
6182
|
+
});
|
|
6183
|
+
}
|
|
6184
|
+
}
|
|
6185
|
+
Groups.Roles = Roles$2;
|
|
6186
|
+
|
|
6187
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6188
|
+
let Roles$1 = class Roles extends APIResource {
|
|
6189
|
+
/**
|
|
6190
|
+
* Assigns a project role to a user within a project.
|
|
6191
|
+
*
|
|
6192
|
+
* @example
|
|
6193
|
+
* ```ts
|
|
6194
|
+
* const role =
|
|
6195
|
+
* await client.admin.organization.projects.users.roles.create(
|
|
6196
|
+
* 'user_id',
|
|
6197
|
+
* { project_id: 'project_id', role_id: 'role_id' },
|
|
6198
|
+
* );
|
|
6199
|
+
* ```
|
|
6200
|
+
*/
|
|
6201
|
+
create(userID, params, options) {
|
|
6202
|
+
const { project_id, ...body } = params;
|
|
6203
|
+
return this._client.post(path `/projects/${project_id}/users/${userID}/roles`, {
|
|
6204
|
+
body,
|
|
6205
|
+
...options,
|
|
6206
|
+
__security: { adminAPIKeyAuth: true },
|
|
6207
|
+
});
|
|
6208
|
+
}
|
|
6209
|
+
/**
|
|
6210
|
+
* Lists the project roles assigned to a user within a project.
|
|
6211
|
+
*
|
|
6212
|
+
* @example
|
|
6213
|
+
* ```ts
|
|
6214
|
+
* // Automatically fetches more pages as needed.
|
|
6215
|
+
* for await (const roleListResponse of client.admin.organization.projects.users.roles.list(
|
|
6216
|
+
* 'user_id',
|
|
6217
|
+
* { project_id: 'project_id' },
|
|
6218
|
+
* )) {
|
|
6219
|
+
* // ...
|
|
6220
|
+
* }
|
|
6221
|
+
* ```
|
|
6222
|
+
*/
|
|
6223
|
+
list(userID, params, options) {
|
|
6224
|
+
const { project_id, ...query } = params;
|
|
6225
|
+
return this._client.getAPIList(path `/projects/${project_id}/users/${userID}/roles`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
6226
|
+
}
|
|
6227
|
+
/**
|
|
6228
|
+
* Unassigns a project role from a user within a project.
|
|
6229
|
+
*
|
|
6230
|
+
* @example
|
|
6231
|
+
* ```ts
|
|
6232
|
+
* const role =
|
|
6233
|
+
* await client.admin.organization.projects.users.roles.delete(
|
|
6234
|
+
* 'role_id',
|
|
6235
|
+
* { project_id: 'project_id', user_id: 'user_id' },
|
|
6236
|
+
* );
|
|
6237
|
+
* ```
|
|
6238
|
+
*/
|
|
6239
|
+
delete(roleID, params, options) {
|
|
6240
|
+
const { project_id, user_id } = params;
|
|
6241
|
+
return this._client.delete(path `/projects/${project_id}/users/${user_id}/roles/${roleID}`, {
|
|
6242
|
+
...options,
|
|
6243
|
+
__security: { adminAPIKeyAuth: true },
|
|
6244
|
+
});
|
|
6245
|
+
}
|
|
6246
|
+
};
|
|
6247
|
+
|
|
6248
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6249
|
+
let Users$1 = class Users extends APIResource {
|
|
6250
|
+
constructor() {
|
|
6251
|
+
super(...arguments);
|
|
6252
|
+
this.roles = new Roles$1(this._client);
|
|
6253
|
+
}
|
|
6254
|
+
/**
|
|
6255
|
+
* Adds a user to the project. Users must already be members of the organization to
|
|
6256
|
+
* be added to a project.
|
|
6257
|
+
*
|
|
6258
|
+
* @example
|
|
6259
|
+
* ```ts
|
|
6260
|
+
* const projectUser =
|
|
6261
|
+
* await client.admin.organization.projects.users.create(
|
|
6262
|
+
* 'project_id',
|
|
6263
|
+
* { role: 'role' },
|
|
6264
|
+
* );
|
|
6265
|
+
* ```
|
|
6266
|
+
*/
|
|
6267
|
+
create(projectID, body, options) {
|
|
6268
|
+
return this._client.post(path `/organization/projects/${projectID}/users`, {
|
|
6269
|
+
body,
|
|
6270
|
+
...options,
|
|
6271
|
+
__security: { adminAPIKeyAuth: true },
|
|
6272
|
+
});
|
|
6273
|
+
}
|
|
6274
|
+
/**
|
|
6275
|
+
* Retrieves a user in the project.
|
|
6276
|
+
*
|
|
6277
|
+
* @example
|
|
6278
|
+
* ```ts
|
|
6279
|
+
* const projectUser =
|
|
6280
|
+
* await client.admin.organization.projects.users.retrieve(
|
|
6281
|
+
* 'user_id',
|
|
6282
|
+
* { project_id: 'project_id' },
|
|
6283
|
+
* );
|
|
6284
|
+
* ```
|
|
6285
|
+
*/
|
|
6286
|
+
retrieve(userID, params, options) {
|
|
6287
|
+
const { project_id } = params;
|
|
6288
|
+
return this._client.get(path `/organization/projects/${project_id}/users/${userID}`, {
|
|
6289
|
+
...options,
|
|
6290
|
+
__security: { adminAPIKeyAuth: true },
|
|
6291
|
+
});
|
|
6292
|
+
}
|
|
6293
|
+
/**
|
|
6294
|
+
* Modifies a user's role in the project.
|
|
6295
|
+
*
|
|
6296
|
+
* @example
|
|
6297
|
+
* ```ts
|
|
6298
|
+
* const projectUser =
|
|
6299
|
+
* await client.admin.organization.projects.users.update(
|
|
6300
|
+
* 'user_id',
|
|
6301
|
+
* { project_id: 'project_id' },
|
|
6302
|
+
* );
|
|
6303
|
+
* ```
|
|
6304
|
+
*/
|
|
6305
|
+
update(userID, params, options) {
|
|
6306
|
+
const { project_id, ...body } = params;
|
|
6307
|
+
return this._client.post(path `/organization/projects/${project_id}/users/${userID}`, {
|
|
6308
|
+
body,
|
|
6309
|
+
...options,
|
|
6310
|
+
__security: { adminAPIKeyAuth: true },
|
|
6311
|
+
});
|
|
6312
|
+
}
|
|
6313
|
+
/**
|
|
6314
|
+
* Returns a list of users in the project.
|
|
6315
|
+
*
|
|
6316
|
+
* @example
|
|
6317
|
+
* ```ts
|
|
6318
|
+
* // Automatically fetches more pages as needed.
|
|
6319
|
+
* for await (const projectUser of client.admin.organization.projects.users.list(
|
|
6320
|
+
* 'project_id',
|
|
6321
|
+
* )) {
|
|
6322
|
+
* // ...
|
|
6323
|
+
* }
|
|
6324
|
+
* ```
|
|
6325
|
+
*/
|
|
6326
|
+
list(projectID, query = {}, options) {
|
|
6327
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/users`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
6328
|
+
}
|
|
6329
|
+
/**
|
|
6330
|
+
* Deletes a user from the project.
|
|
6331
|
+
*
|
|
6332
|
+
* Returns confirmation of project user deletion, or an error if the project is
|
|
6333
|
+
* archived (archived projects have no users).
|
|
6334
|
+
*
|
|
6335
|
+
* @example
|
|
6336
|
+
* ```ts
|
|
6337
|
+
* const user =
|
|
6338
|
+
* await client.admin.organization.projects.users.delete(
|
|
6339
|
+
* 'user_id',
|
|
6340
|
+
* { project_id: 'project_id' },
|
|
6341
|
+
* );
|
|
6342
|
+
* ```
|
|
6343
|
+
*/
|
|
6344
|
+
delete(userID, params, options) {
|
|
6345
|
+
const { project_id } = params;
|
|
6346
|
+
return this._client.delete(path `/organization/projects/${project_id}/users/${userID}`, {
|
|
6347
|
+
...options,
|
|
6348
|
+
__security: { adminAPIKeyAuth: true },
|
|
6349
|
+
});
|
|
6350
|
+
}
|
|
6351
|
+
};
|
|
6352
|
+
Users$1.Roles = Roles$1;
|
|
6353
|
+
|
|
6354
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6355
|
+
class Projects extends APIResource {
|
|
6356
|
+
constructor() {
|
|
6357
|
+
super(...arguments);
|
|
6358
|
+
this.users = new Users$1(this._client);
|
|
6359
|
+
this.serviceAccounts = new ServiceAccounts(this._client);
|
|
6360
|
+
this.apiKeys = new APIKeys(this._client);
|
|
6361
|
+
this.rateLimits = new RateLimits(this._client);
|
|
6362
|
+
this.groups = new Groups(this._client);
|
|
6363
|
+
this.roles = new Roles$3(this._client);
|
|
6364
|
+
this.certificates = new Certificates(this._client);
|
|
6365
|
+
}
|
|
6366
|
+
/**
|
|
6367
|
+
* Create a new project in the organization. Projects can be created and archived,
|
|
6368
|
+
* but cannot be deleted.
|
|
6369
|
+
*
|
|
6370
|
+
* @example
|
|
6371
|
+
* ```ts
|
|
6372
|
+
* const project =
|
|
6373
|
+
* await client.admin.organization.projects.create({
|
|
6374
|
+
* name: 'name',
|
|
6375
|
+
* });
|
|
6376
|
+
* ```
|
|
6377
|
+
*/
|
|
6378
|
+
create(body, options) {
|
|
6379
|
+
return this._client.post('/organization/projects', {
|
|
6380
|
+
body,
|
|
6381
|
+
...options,
|
|
6382
|
+
__security: { adminAPIKeyAuth: true },
|
|
6383
|
+
});
|
|
6384
|
+
}
|
|
6385
|
+
/**
|
|
6386
|
+
* Retrieves a project.
|
|
6387
|
+
*
|
|
6388
|
+
* @example
|
|
6389
|
+
* ```ts
|
|
6390
|
+
* const project =
|
|
6391
|
+
* await client.admin.organization.projects.retrieve(
|
|
6392
|
+
* 'project_id',
|
|
6393
|
+
* );
|
|
6394
|
+
* ```
|
|
6395
|
+
*/
|
|
6396
|
+
retrieve(projectID, options) {
|
|
6397
|
+
return this._client.get(path `/organization/projects/${projectID}`, {
|
|
6398
|
+
...options,
|
|
6399
|
+
__security: { adminAPIKeyAuth: true },
|
|
6400
|
+
});
|
|
6401
|
+
}
|
|
6402
|
+
/**
|
|
6403
|
+
* Modifies a project in the organization.
|
|
6404
|
+
*
|
|
6405
|
+
* @example
|
|
6406
|
+
* ```ts
|
|
6407
|
+
* const project =
|
|
6408
|
+
* await client.admin.organization.projects.update(
|
|
6409
|
+
* 'project_id',
|
|
6410
|
+
* );
|
|
6411
|
+
* ```
|
|
6412
|
+
*/
|
|
6413
|
+
update(projectID, body, options) {
|
|
6414
|
+
return this._client.post(path `/organization/projects/${projectID}`, {
|
|
6415
|
+
body,
|
|
6416
|
+
...options,
|
|
6417
|
+
__security: { adminAPIKeyAuth: true },
|
|
6418
|
+
});
|
|
6419
|
+
}
|
|
6420
|
+
/**
|
|
6421
|
+
* Returns a list of projects.
|
|
6422
|
+
*
|
|
6423
|
+
* @example
|
|
6424
|
+
* ```ts
|
|
6425
|
+
* // Automatically fetches more pages as needed.
|
|
6426
|
+
* for await (const project of client.admin.organization.projects.list()) {
|
|
6427
|
+
* // ...
|
|
6428
|
+
* }
|
|
6429
|
+
* ```
|
|
6430
|
+
*/
|
|
6431
|
+
list(query = {}, options) {
|
|
6432
|
+
return this._client.getAPIList('/organization/projects', (ConversationCursorPage), {
|
|
6433
|
+
query,
|
|
6434
|
+
...options,
|
|
6435
|
+
__security: { adminAPIKeyAuth: true },
|
|
6436
|
+
});
|
|
6437
|
+
}
|
|
6438
|
+
/**
|
|
6439
|
+
* Archives a project in the organization. Archived projects cannot be used or
|
|
6440
|
+
* updated.
|
|
6441
|
+
*
|
|
6442
|
+
* @example
|
|
6443
|
+
* ```ts
|
|
6444
|
+
* const project =
|
|
6445
|
+
* await client.admin.organization.projects.archive(
|
|
6446
|
+
* 'project_id',
|
|
6447
|
+
* );
|
|
6448
|
+
* ```
|
|
6449
|
+
*/
|
|
6450
|
+
archive(projectID, options) {
|
|
6451
|
+
return this._client.post(path `/organization/projects/${projectID}/archive`, {
|
|
6452
|
+
...options,
|
|
6453
|
+
__security: { adminAPIKeyAuth: true },
|
|
6454
|
+
});
|
|
6455
|
+
}
|
|
6456
|
+
}
|
|
6457
|
+
Projects.Users = Users$1;
|
|
6458
|
+
Projects.ServiceAccounts = ServiceAccounts;
|
|
6459
|
+
Projects.APIKeys = APIKeys;
|
|
6460
|
+
Projects.RateLimits = RateLimits;
|
|
6461
|
+
Projects.Groups = Groups;
|
|
6462
|
+
Projects.Roles = Roles$3;
|
|
6463
|
+
Projects.Certificates = Certificates;
|
|
6464
|
+
|
|
6465
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6466
|
+
class Roles extends APIResource {
|
|
6467
|
+
/**
|
|
6468
|
+
* Assigns an organization role to a user within the organization.
|
|
6469
|
+
*
|
|
6470
|
+
* @example
|
|
6471
|
+
* ```ts
|
|
6472
|
+
* const role =
|
|
6473
|
+
* await client.admin.organization.users.roles.create(
|
|
6474
|
+
* 'user_id',
|
|
6475
|
+
* { role_id: 'role_id' },
|
|
6476
|
+
* );
|
|
6477
|
+
* ```
|
|
6478
|
+
*/
|
|
6479
|
+
create(userID, body, options) {
|
|
6480
|
+
return this._client.post(path `/organization/users/${userID}/roles`, {
|
|
6481
|
+
body,
|
|
6482
|
+
...options,
|
|
6483
|
+
__security: { adminAPIKeyAuth: true },
|
|
6484
|
+
});
|
|
6485
|
+
}
|
|
6486
|
+
/**
|
|
6487
|
+
* Lists the organization roles assigned to a user within the organization.
|
|
6488
|
+
*
|
|
6489
|
+
* @example
|
|
6490
|
+
* ```ts
|
|
6491
|
+
* // Automatically fetches more pages as needed.
|
|
6492
|
+
* for await (const roleListResponse of client.admin.organization.users.roles.list(
|
|
6493
|
+
* 'user_id',
|
|
6494
|
+
* )) {
|
|
6495
|
+
* // ...
|
|
6496
|
+
* }
|
|
6497
|
+
* ```
|
|
6498
|
+
*/
|
|
6499
|
+
list(userID, query = {}, options) {
|
|
6500
|
+
return this._client.getAPIList(path `/organization/users/${userID}/roles`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
6501
|
+
}
|
|
6502
|
+
/**
|
|
6503
|
+
* Unassigns an organization role from a user within the organization.
|
|
6504
|
+
*
|
|
6505
|
+
* @example
|
|
6506
|
+
* ```ts
|
|
6507
|
+
* const role =
|
|
6508
|
+
* await client.admin.organization.users.roles.delete(
|
|
6509
|
+
* 'role_id',
|
|
6510
|
+
* { user_id: 'user_id' },
|
|
6511
|
+
* );
|
|
6512
|
+
* ```
|
|
6513
|
+
*/
|
|
6514
|
+
delete(roleID, params, options) {
|
|
6515
|
+
const { user_id } = params;
|
|
6516
|
+
return this._client.delete(path `/organization/users/${user_id}/roles/${roleID}`, {
|
|
4809
6517
|
...options,
|
|
4810
|
-
|
|
4811
|
-
};
|
|
4812
|
-
runner._run(() => runner._runTools(client, params, opts));
|
|
4813
|
-
return runner;
|
|
6518
|
+
__security: { adminAPIKeyAuth: true },
|
|
6519
|
+
});
|
|
4814
6520
|
}
|
|
4815
6521
|
}
|
|
4816
6522
|
|
|
4817
6523
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4818
|
-
|
|
4819
|
-
* Given a list of messages comprising a conversation, the model will return a response.
|
|
4820
|
-
*/
|
|
4821
|
-
let Completions$1 = class Completions extends APIResource {
|
|
6524
|
+
class Users extends APIResource {
|
|
4822
6525
|
constructor() {
|
|
4823
6526
|
super(...arguments);
|
|
4824
|
-
this.
|
|
4825
|
-
}
|
|
4826
|
-
create(body, options) {
|
|
4827
|
-
return this._client.post('/chat/completions', { body, ...options, stream: body.stream ?? false });
|
|
6527
|
+
this.roles = new Roles(this._client);
|
|
4828
6528
|
}
|
|
4829
6529
|
/**
|
|
4830
|
-
*
|
|
4831
|
-
* the `store` parameter set to `true` will be returned.
|
|
6530
|
+
* Retrieves a user by their identifier.
|
|
4832
6531
|
*
|
|
4833
6532
|
* @example
|
|
4834
6533
|
* ```ts
|
|
4835
|
-
* const
|
|
4836
|
-
* await client.
|
|
6534
|
+
* const organizationUser =
|
|
6535
|
+
* await client.admin.organization.users.retrieve('user_id');
|
|
4837
6536
|
* ```
|
|
4838
6537
|
*/
|
|
4839
|
-
retrieve(
|
|
4840
|
-
return this._client.get(path `/
|
|
6538
|
+
retrieve(userID, options) {
|
|
6539
|
+
return this._client.get(path `/organization/users/${userID}`, {
|
|
6540
|
+
...options,
|
|
6541
|
+
__security: { adminAPIKeyAuth: true },
|
|
6542
|
+
});
|
|
4841
6543
|
}
|
|
4842
6544
|
/**
|
|
4843
|
-
*
|
|
4844
|
-
* with the `store` parameter set to `true` can be modified. Currently, the only
|
|
4845
|
-
* supported modification is to update the `metadata` field.
|
|
6545
|
+
* Modifies a user's role in the organization.
|
|
4846
6546
|
*
|
|
4847
6547
|
* @example
|
|
4848
6548
|
* ```ts
|
|
4849
|
-
* const
|
|
4850
|
-
* '
|
|
4851
|
-
* { metadata: { foo: 'string' } },
|
|
4852
|
-
* );
|
|
6549
|
+
* const organizationUser =
|
|
6550
|
+
* await client.admin.organization.users.update('user_id');
|
|
4853
6551
|
* ```
|
|
4854
6552
|
*/
|
|
4855
|
-
update(
|
|
4856
|
-
return this._client.post(path `/
|
|
6553
|
+
update(userID, body, options) {
|
|
6554
|
+
return this._client.post(path `/organization/users/${userID}`, {
|
|
6555
|
+
body,
|
|
6556
|
+
...options,
|
|
6557
|
+
__security: { adminAPIKeyAuth: true },
|
|
6558
|
+
});
|
|
4857
6559
|
}
|
|
4858
6560
|
/**
|
|
4859
|
-
*
|
|
4860
|
-
* the `store` parameter set to `true` will be returned.
|
|
6561
|
+
* Lists all of the users in the organization.
|
|
4861
6562
|
*
|
|
4862
6563
|
* @example
|
|
4863
6564
|
* ```ts
|
|
4864
6565
|
* // Automatically fetches more pages as needed.
|
|
4865
|
-
* for await (const
|
|
6566
|
+
* for await (const organizationUser of client.admin.organization.users.list()) {
|
|
4866
6567
|
* // ...
|
|
4867
6568
|
* }
|
|
4868
6569
|
* ```
|
|
4869
6570
|
*/
|
|
4870
6571
|
list(query = {}, options) {
|
|
4871
|
-
return this._client.getAPIList('/
|
|
6572
|
+
return this._client.getAPIList('/organization/users', (ConversationCursorPage), {
|
|
6573
|
+
query,
|
|
6574
|
+
...options,
|
|
6575
|
+
__security: { adminAPIKeyAuth: true },
|
|
6576
|
+
});
|
|
4872
6577
|
}
|
|
4873
6578
|
/**
|
|
4874
|
-
*
|
|
4875
|
-
* with the `store` parameter set to `true` can be deleted.
|
|
6579
|
+
* Deletes a user from the organization.
|
|
4876
6580
|
*
|
|
4877
6581
|
* @example
|
|
4878
6582
|
* ```ts
|
|
4879
|
-
* const
|
|
4880
|
-
*
|
|
6583
|
+
* const user = await client.admin.organization.users.delete(
|
|
6584
|
+
* 'user_id',
|
|
6585
|
+
* );
|
|
4881
6586
|
* ```
|
|
4882
6587
|
*/
|
|
4883
|
-
delete(
|
|
4884
|
-
return this._client.delete(path `/
|
|
4885
|
-
}
|
|
4886
|
-
parse(body, options) {
|
|
4887
|
-
validateInputTools(body.tools);
|
|
4888
|
-
return this._client.chat.completions
|
|
4889
|
-
.create(body, {
|
|
6588
|
+
delete(userID, options) {
|
|
6589
|
+
return this._client.delete(path `/organization/users/${userID}`, {
|
|
4890
6590
|
...options,
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
'X-Stainless-Helper-Method': 'chat.completions.parse',
|
|
4894
|
-
},
|
|
4895
|
-
})
|
|
4896
|
-
._thenUnwrap((completion) => parseChatCompletion(completion, body));
|
|
4897
|
-
}
|
|
4898
|
-
runTools(body, options) {
|
|
4899
|
-
if (body.stream) {
|
|
4900
|
-
return ChatCompletionStreamingRunner.runTools(this._client, body, options);
|
|
4901
|
-
}
|
|
4902
|
-
return ChatCompletionRunner.runTools(this._client, body, options);
|
|
4903
|
-
}
|
|
4904
|
-
/**
|
|
4905
|
-
* Creates a chat completion stream
|
|
4906
|
-
*/
|
|
4907
|
-
stream(body, options) {
|
|
4908
|
-
return ChatCompletionStream.createChatCompletion(this._client, body, options);
|
|
6591
|
+
__security: { adminAPIKeyAuth: true },
|
|
6592
|
+
});
|
|
4909
6593
|
}
|
|
4910
|
-
}
|
|
4911
|
-
|
|
6594
|
+
}
|
|
6595
|
+
Users.Roles = Roles;
|
|
4912
6596
|
|
|
4913
6597
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4914
|
-
class
|
|
6598
|
+
class Organization extends APIResource {
|
|
4915
6599
|
constructor() {
|
|
4916
6600
|
super(...arguments);
|
|
4917
|
-
this.
|
|
6601
|
+
this.auditLogs = new AuditLogs(this._client);
|
|
6602
|
+
this.adminAPIKeys = new AdminAPIKeys(this._client);
|
|
6603
|
+
this.usage = new Usage(this._client);
|
|
6604
|
+
this.invites = new Invites(this._client);
|
|
6605
|
+
this.users = new Users(this._client);
|
|
6606
|
+
this.groups = new Groups$1(this._client);
|
|
6607
|
+
this.roles = new Roles$5(this._client);
|
|
6608
|
+
this.certificates = new Certificates$1(this._client);
|
|
6609
|
+
this.projects = new Projects(this._client);
|
|
6610
|
+
}
|
|
6611
|
+
}
|
|
6612
|
+
Organization.AuditLogs = AuditLogs;
|
|
6613
|
+
Organization.AdminAPIKeys = AdminAPIKeys;
|
|
6614
|
+
Organization.Usage = Usage;
|
|
6615
|
+
Organization.Invites = Invites;
|
|
6616
|
+
Organization.Users = Users;
|
|
6617
|
+
Organization.Groups = Groups$1;
|
|
6618
|
+
Organization.Roles = Roles$5;
|
|
6619
|
+
Organization.Certificates = Certificates$1;
|
|
6620
|
+
Organization.Projects = Projects;
|
|
6621
|
+
|
|
6622
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6623
|
+
class Admin extends APIResource {
|
|
6624
|
+
constructor() {
|
|
6625
|
+
super(...arguments);
|
|
6626
|
+
this.organization = new Organization(this._client);
|
|
4918
6627
|
}
|
|
4919
6628
|
}
|
|
4920
|
-
|
|
6629
|
+
Admin.Organization = Organization;
|
|
4921
6630
|
|
|
4922
6631
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4923
6632
|
const brand_privateNullableHeaders = /* @__PURE__ */ Symbol('brand.privateNullableHeaders');
|
|
@@ -5014,6 +6723,7 @@ class Speech extends APIResource {
|
|
|
5014
6723
|
body,
|
|
5015
6724
|
...options,
|
|
5016
6725
|
headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]),
|
|
6726
|
+
__security: { bearerAuth: true },
|
|
5017
6727
|
__binaryResponse: true,
|
|
5018
6728
|
});
|
|
5019
6729
|
}
|
|
@@ -5030,6 +6740,7 @@ class Transcriptions extends APIResource {
|
|
|
5030
6740
|
...options,
|
|
5031
6741
|
stream: body.stream ?? false,
|
|
5032
6742
|
__metadata: { model: body.model },
|
|
6743
|
+
__security: { bearerAuth: true },
|
|
5033
6744
|
}, this._client));
|
|
5034
6745
|
}
|
|
5035
6746
|
}
|
|
@@ -5040,7 +6751,7 @@ class Transcriptions extends APIResource {
|
|
|
5040
6751
|
*/
|
|
5041
6752
|
class Translations extends APIResource {
|
|
5042
6753
|
create(body, options) {
|
|
5043
|
-
return this._client.post('/audio/translations', multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }, this._client));
|
|
6754
|
+
return this._client.post('/audio/translations', multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model }, __security: { bearerAuth: true } }, this._client));
|
|
5044
6755
|
}
|
|
5045
6756
|
}
|
|
5046
6757
|
|
|
@@ -5066,19 +6777,23 @@ class Batches extends APIResource {
|
|
|
5066
6777
|
* Creates and executes a batch from an uploaded file of requests
|
|
5067
6778
|
*/
|
|
5068
6779
|
create(body, options) {
|
|
5069
|
-
return this._client.post('/batches', { body, ...options });
|
|
6780
|
+
return this._client.post('/batches', { body, ...options, __security: { bearerAuth: true } });
|
|
5070
6781
|
}
|
|
5071
6782
|
/**
|
|
5072
6783
|
* Retrieves a batch.
|
|
5073
6784
|
*/
|
|
5074
6785
|
retrieve(batchID, options) {
|
|
5075
|
-
return this._client.get(path `/batches/${batchID}`, options);
|
|
6786
|
+
return this._client.get(path `/batches/${batchID}`, { ...options, __security: { bearerAuth: true } });
|
|
5076
6787
|
}
|
|
5077
6788
|
/**
|
|
5078
6789
|
* List your organization's batches.
|
|
5079
6790
|
*/
|
|
5080
6791
|
list(query = {}, options) {
|
|
5081
|
-
return this._client.getAPIList('/batches', (CursorPage), {
|
|
6792
|
+
return this._client.getAPIList('/batches', (CursorPage), {
|
|
6793
|
+
query,
|
|
6794
|
+
...options,
|
|
6795
|
+
__security: { bearerAuth: true },
|
|
6796
|
+
});
|
|
5082
6797
|
}
|
|
5083
6798
|
/**
|
|
5084
6799
|
* Cancels an in-progress batch. The batch will be in status `cancelling` for up to
|
|
@@ -5086,7 +6801,10 @@ class Batches extends APIResource {
|
|
|
5086
6801
|
* (if any) available in the output file.
|
|
5087
6802
|
*/
|
|
5088
6803
|
cancel(batchID, options) {
|
|
5089
|
-
return this._client.post(path `/batches/${batchID}/cancel`,
|
|
6804
|
+
return this._client.post(path `/batches/${batchID}/cancel`, {
|
|
6805
|
+
...options,
|
|
6806
|
+
__security: { bearerAuth: true },
|
|
6807
|
+
});
|
|
5090
6808
|
}
|
|
5091
6809
|
}
|
|
5092
6810
|
|
|
@@ -5105,6 +6823,7 @@ class Assistants extends APIResource {
|
|
|
5105
6823
|
body,
|
|
5106
6824
|
...options,
|
|
5107
6825
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6826
|
+
__security: { bearerAuth: true },
|
|
5108
6827
|
});
|
|
5109
6828
|
}
|
|
5110
6829
|
/**
|
|
@@ -5116,6 +6835,7 @@ class Assistants extends APIResource {
|
|
|
5116
6835
|
return this._client.get(path `/assistants/${assistantID}`, {
|
|
5117
6836
|
...options,
|
|
5118
6837
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6838
|
+
__security: { bearerAuth: true },
|
|
5119
6839
|
});
|
|
5120
6840
|
}
|
|
5121
6841
|
/**
|
|
@@ -5128,6 +6848,7 @@ class Assistants extends APIResource {
|
|
|
5128
6848
|
body,
|
|
5129
6849
|
...options,
|
|
5130
6850
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6851
|
+
__security: { bearerAuth: true },
|
|
5131
6852
|
});
|
|
5132
6853
|
}
|
|
5133
6854
|
/**
|
|
@@ -5140,6 +6861,7 @@ class Assistants extends APIResource {
|
|
|
5140
6861
|
query,
|
|
5141
6862
|
...options,
|
|
5142
6863
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6864
|
+
__security: { bearerAuth: true },
|
|
5143
6865
|
});
|
|
5144
6866
|
}
|
|
5145
6867
|
/**
|
|
@@ -5151,6 +6873,7 @@ class Assistants extends APIResource {
|
|
|
5151
6873
|
return this._client.delete(path `/assistants/${assistantID}`, {
|
|
5152
6874
|
...options,
|
|
5153
6875
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6876
|
+
__security: { bearerAuth: true },
|
|
5154
6877
|
});
|
|
5155
6878
|
}
|
|
5156
6879
|
}
|
|
@@ -5177,6 +6900,7 @@ let Sessions$1 = class Sessions extends APIResource {
|
|
|
5177
6900
|
body,
|
|
5178
6901
|
...options,
|
|
5179
6902
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6903
|
+
__security: { bearerAuth: true },
|
|
5180
6904
|
});
|
|
5181
6905
|
}
|
|
5182
6906
|
};
|
|
@@ -5203,6 +6927,7 @@ class TranscriptionSessions extends APIResource {
|
|
|
5203
6927
|
body,
|
|
5204
6928
|
...options,
|
|
5205
6929
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6930
|
+
__security: { bearerAuth: true },
|
|
5206
6931
|
});
|
|
5207
6932
|
}
|
|
5208
6933
|
}
|
|
@@ -5240,6 +6965,7 @@ class Sessions extends APIResource {
|
|
|
5240
6965
|
body,
|
|
5241
6966
|
...options,
|
|
5242
6967
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
6968
|
+
__security: { bearerAuth: true },
|
|
5243
6969
|
});
|
|
5244
6970
|
}
|
|
5245
6971
|
/**
|
|
@@ -5257,6 +6983,7 @@ class Sessions extends APIResource {
|
|
|
5257
6983
|
return this._client.post(path `/chatkit/sessions/${sessionID}/cancel`, {
|
|
5258
6984
|
...options,
|
|
5259
6985
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
6986
|
+
__security: { bearerAuth: true },
|
|
5260
6987
|
});
|
|
5261
6988
|
}
|
|
5262
6989
|
}
|
|
@@ -5276,6 +7003,7 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
5276
7003
|
return this._client.get(path `/chatkit/threads/${threadID}`, {
|
|
5277
7004
|
...options,
|
|
5278
7005
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
7006
|
+
__security: { bearerAuth: true },
|
|
5279
7007
|
});
|
|
5280
7008
|
}
|
|
5281
7009
|
/**
|
|
@@ -5294,6 +7022,7 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
5294
7022
|
query,
|
|
5295
7023
|
...options,
|
|
5296
7024
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
7025
|
+
__security: { bearerAuth: true },
|
|
5297
7026
|
});
|
|
5298
7027
|
}
|
|
5299
7028
|
/**
|
|
@@ -5310,6 +7039,7 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
5310
7039
|
return this._client.delete(path `/chatkit/threads/${threadID}`, {
|
|
5311
7040
|
...options,
|
|
5312
7041
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
7042
|
+
__security: { bearerAuth: true },
|
|
5313
7043
|
});
|
|
5314
7044
|
}
|
|
5315
7045
|
/**
|
|
@@ -5326,7 +7056,12 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
5326
7056
|
* ```
|
|
5327
7057
|
*/
|
|
5328
7058
|
listItems(threadID, query = {}, options) {
|
|
5329
|
-
return this._client.getAPIList(path `/chatkit/threads/${threadID}/items`, (ConversationCursorPage), {
|
|
7059
|
+
return this._client.getAPIList(path `/chatkit/threads/${threadID}/items`, (ConversationCursorPage), {
|
|
7060
|
+
query,
|
|
7061
|
+
...options,
|
|
7062
|
+
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
7063
|
+
__security: { bearerAuth: true },
|
|
7064
|
+
});
|
|
5330
7065
|
}
|
|
5331
7066
|
};
|
|
5332
7067
|
|
|
@@ -5358,6 +7093,7 @@ class Messages extends APIResource {
|
|
|
5358
7093
|
body,
|
|
5359
7094
|
...options,
|
|
5360
7095
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7096
|
+
__security: { bearerAuth: true },
|
|
5361
7097
|
});
|
|
5362
7098
|
}
|
|
5363
7099
|
/**
|
|
@@ -5370,6 +7106,7 @@ class Messages extends APIResource {
|
|
|
5370
7106
|
return this._client.get(path `/threads/${thread_id}/messages/${messageID}`, {
|
|
5371
7107
|
...options,
|
|
5372
7108
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7109
|
+
__security: { bearerAuth: true },
|
|
5373
7110
|
});
|
|
5374
7111
|
}
|
|
5375
7112
|
/**
|
|
@@ -5383,6 +7120,7 @@ class Messages extends APIResource {
|
|
|
5383
7120
|
body,
|
|
5384
7121
|
...options,
|
|
5385
7122
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7123
|
+
__security: { bearerAuth: true },
|
|
5386
7124
|
});
|
|
5387
7125
|
}
|
|
5388
7126
|
/**
|
|
@@ -5395,6 +7133,7 @@ class Messages extends APIResource {
|
|
|
5395
7133
|
query,
|
|
5396
7134
|
...options,
|
|
5397
7135
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7136
|
+
__security: { bearerAuth: true },
|
|
5398
7137
|
});
|
|
5399
7138
|
}
|
|
5400
7139
|
/**
|
|
@@ -5407,6 +7146,7 @@ class Messages extends APIResource {
|
|
|
5407
7146
|
return this._client.delete(path `/threads/${thread_id}/messages/${messageID}`, {
|
|
5408
7147
|
...options,
|
|
5409
7148
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7149
|
+
__security: { bearerAuth: true },
|
|
5410
7150
|
});
|
|
5411
7151
|
}
|
|
5412
7152
|
}
|
|
@@ -5429,6 +7169,7 @@ class Steps extends APIResource {
|
|
|
5429
7169
|
query,
|
|
5430
7170
|
...options,
|
|
5431
7171
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7172
|
+
__security: { bearerAuth: true },
|
|
5432
7173
|
});
|
|
5433
7174
|
}
|
|
5434
7175
|
/**
|
|
@@ -5442,6 +7183,7 @@ class Steps extends APIResource {
|
|
|
5442
7183
|
query,
|
|
5443
7184
|
...options,
|
|
5444
7185
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7186
|
+
__security: { bearerAuth: true },
|
|
5445
7187
|
});
|
|
5446
7188
|
}
|
|
5447
7189
|
}
|
|
@@ -6045,6 +7787,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
6045
7787
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6046
7788
|
stream: params.stream ?? false,
|
|
6047
7789
|
__synthesizeEventData: true,
|
|
7790
|
+
__security: { bearerAuth: true },
|
|
6048
7791
|
});
|
|
6049
7792
|
}
|
|
6050
7793
|
/**
|
|
@@ -6057,6 +7800,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
6057
7800
|
return this._client.get(path `/threads/${thread_id}/runs/${runID}`, {
|
|
6058
7801
|
...options,
|
|
6059
7802
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7803
|
+
__security: { bearerAuth: true },
|
|
6060
7804
|
});
|
|
6061
7805
|
}
|
|
6062
7806
|
/**
|
|
@@ -6070,6 +7814,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
6070
7814
|
body,
|
|
6071
7815
|
...options,
|
|
6072
7816
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7817
|
+
__security: { bearerAuth: true },
|
|
6073
7818
|
});
|
|
6074
7819
|
}
|
|
6075
7820
|
/**
|
|
@@ -6082,6 +7827,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
6082
7827
|
query,
|
|
6083
7828
|
...options,
|
|
6084
7829
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7830
|
+
__security: { bearerAuth: true },
|
|
6085
7831
|
});
|
|
6086
7832
|
}
|
|
6087
7833
|
/**
|
|
@@ -6094,6 +7840,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
6094
7840
|
return this._client.post(path `/threads/${thread_id}/runs/${runID}/cancel`, {
|
|
6095
7841
|
...options,
|
|
6096
7842
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7843
|
+
__security: { bearerAuth: true },
|
|
6097
7844
|
});
|
|
6098
7845
|
}
|
|
6099
7846
|
/**
|
|
@@ -6176,6 +7923,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
6176
7923
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6177
7924
|
stream: params.stream ?? false,
|
|
6178
7925
|
__synthesizeEventData: true,
|
|
7926
|
+
__security: { bearerAuth: true },
|
|
6179
7927
|
});
|
|
6180
7928
|
}
|
|
6181
7929
|
/**
|
|
@@ -6220,6 +7968,7 @@ class Threads extends APIResource {
|
|
|
6220
7968
|
body,
|
|
6221
7969
|
...options,
|
|
6222
7970
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7971
|
+
__security: { bearerAuth: true },
|
|
6223
7972
|
});
|
|
6224
7973
|
}
|
|
6225
7974
|
/**
|
|
@@ -6231,6 +7980,7 @@ class Threads extends APIResource {
|
|
|
6231
7980
|
return this._client.get(path `/threads/${threadID}`, {
|
|
6232
7981
|
...options,
|
|
6233
7982
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7983
|
+
__security: { bearerAuth: true },
|
|
6234
7984
|
});
|
|
6235
7985
|
}
|
|
6236
7986
|
/**
|
|
@@ -6243,6 +7993,7 @@ class Threads extends APIResource {
|
|
|
6243
7993
|
body,
|
|
6244
7994
|
...options,
|
|
6245
7995
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
7996
|
+
__security: { bearerAuth: true },
|
|
6246
7997
|
});
|
|
6247
7998
|
}
|
|
6248
7999
|
/**
|
|
@@ -6254,6 +8005,7 @@ class Threads extends APIResource {
|
|
|
6254
8005
|
return this._client.delete(path `/threads/${threadID}`, {
|
|
6255
8006
|
...options,
|
|
6256
8007
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8008
|
+
__security: { bearerAuth: true },
|
|
6257
8009
|
});
|
|
6258
8010
|
}
|
|
6259
8011
|
createAndRun(body, options) {
|
|
@@ -6263,6 +8015,7 @@ class Threads extends APIResource {
|
|
|
6263
8015
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6264
8016
|
stream: body.stream ?? false,
|
|
6265
8017
|
__synthesizeEventData: true,
|
|
8018
|
+
__security: { bearerAuth: true },
|
|
6266
8019
|
});
|
|
6267
8020
|
}
|
|
6268
8021
|
/**
|
|
@@ -6305,7 +8058,12 @@ Beta.Threads = Threads;
|
|
|
6305
8058
|
*/
|
|
6306
8059
|
class Completions extends APIResource {
|
|
6307
8060
|
create(body, options) {
|
|
6308
|
-
return this._client.post('/completions', {
|
|
8061
|
+
return this._client.post('/completions', {
|
|
8062
|
+
body,
|
|
8063
|
+
...options,
|
|
8064
|
+
stream: body.stream ?? false,
|
|
8065
|
+
__security: { bearerAuth: true },
|
|
8066
|
+
});
|
|
6309
8067
|
}
|
|
6310
8068
|
}
|
|
6311
8069
|
|
|
@@ -6319,6 +8077,7 @@ let Content$2 = class Content extends APIResource {
|
|
|
6319
8077
|
return this._client.get(path `/containers/${container_id}/files/${fileID}/content`, {
|
|
6320
8078
|
...options,
|
|
6321
8079
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
8080
|
+
__security: { bearerAuth: true },
|
|
6322
8081
|
__binaryResponse: true,
|
|
6323
8082
|
});
|
|
6324
8083
|
}
|
|
@@ -6337,14 +8096,17 @@ let Files$2 = class Files extends APIResource {
|
|
|
6337
8096
|
* a JSON request with a file ID.
|
|
6338
8097
|
*/
|
|
6339
8098
|
create(containerID, body, options) {
|
|
6340
|
-
return this._client.post(path `/containers/${containerID}/files`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
8099
|
+
return this._client.post(path `/containers/${containerID}/files`, maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
6341
8100
|
}
|
|
6342
8101
|
/**
|
|
6343
8102
|
* Retrieve Container File
|
|
6344
8103
|
*/
|
|
6345
8104
|
retrieve(fileID, params, options) {
|
|
6346
8105
|
const { container_id } = params;
|
|
6347
|
-
return this._client.get(path `/containers/${container_id}/files/${fileID}`,
|
|
8106
|
+
return this._client.get(path `/containers/${container_id}/files/${fileID}`, {
|
|
8107
|
+
...options,
|
|
8108
|
+
__security: { bearerAuth: true },
|
|
8109
|
+
});
|
|
6348
8110
|
}
|
|
6349
8111
|
/**
|
|
6350
8112
|
* List Container files
|
|
@@ -6353,6 +8115,7 @@ let Files$2 = class Files extends APIResource {
|
|
|
6353
8115
|
return this._client.getAPIList(path `/containers/${containerID}/files`, (CursorPage), {
|
|
6354
8116
|
query,
|
|
6355
8117
|
...options,
|
|
8118
|
+
__security: { bearerAuth: true },
|
|
6356
8119
|
});
|
|
6357
8120
|
}
|
|
6358
8121
|
/**
|
|
@@ -6363,6 +8126,7 @@ let Files$2 = class Files extends APIResource {
|
|
|
6363
8126
|
return this._client.delete(path `/containers/${container_id}/files/${fileID}`, {
|
|
6364
8127
|
...options,
|
|
6365
8128
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
8129
|
+
__security: { bearerAuth: true },
|
|
6366
8130
|
});
|
|
6367
8131
|
}
|
|
6368
8132
|
};
|
|
@@ -6378,19 +8142,26 @@ class Containers extends APIResource {
|
|
|
6378
8142
|
* Create Container
|
|
6379
8143
|
*/
|
|
6380
8144
|
create(body, options) {
|
|
6381
|
-
return this._client.post('/containers', { body, ...options });
|
|
8145
|
+
return this._client.post('/containers', { body, ...options, __security: { bearerAuth: true } });
|
|
6382
8146
|
}
|
|
6383
8147
|
/**
|
|
6384
8148
|
* Retrieve Container
|
|
6385
8149
|
*/
|
|
6386
8150
|
retrieve(containerID, options) {
|
|
6387
|
-
return this._client.get(path `/containers/${containerID}`,
|
|
8151
|
+
return this._client.get(path `/containers/${containerID}`, {
|
|
8152
|
+
...options,
|
|
8153
|
+
__security: { bearerAuth: true },
|
|
8154
|
+
});
|
|
6388
8155
|
}
|
|
6389
8156
|
/**
|
|
6390
8157
|
* List Containers
|
|
6391
8158
|
*/
|
|
6392
8159
|
list(query = {}, options) {
|
|
6393
|
-
return this._client.getAPIList('/containers', (CursorPage), {
|
|
8160
|
+
return this._client.getAPIList('/containers', (CursorPage), {
|
|
8161
|
+
query,
|
|
8162
|
+
...options,
|
|
8163
|
+
__security: { bearerAuth: true },
|
|
8164
|
+
});
|
|
6394
8165
|
}
|
|
6395
8166
|
/**
|
|
6396
8167
|
* Delete Container
|
|
@@ -6399,6 +8170,7 @@ class Containers extends APIResource {
|
|
|
6399
8170
|
return this._client.delete(path `/containers/${containerID}`, {
|
|
6400
8171
|
...options,
|
|
6401
8172
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
8173
|
+
__security: { bearerAuth: true },
|
|
6402
8174
|
});
|
|
6403
8175
|
}
|
|
6404
8176
|
}
|
|
@@ -6418,6 +8190,7 @@ class Items extends APIResource {
|
|
|
6418
8190
|
query: { include },
|
|
6419
8191
|
body,
|
|
6420
8192
|
...options,
|
|
8193
|
+
__security: { bearerAuth: true },
|
|
6421
8194
|
});
|
|
6422
8195
|
}
|
|
6423
8196
|
/**
|
|
@@ -6425,20 +8198,27 @@ class Items extends APIResource {
|
|
|
6425
8198
|
*/
|
|
6426
8199
|
retrieve(itemID, params, options) {
|
|
6427
8200
|
const { conversation_id, ...query } = params;
|
|
6428
|
-
return this._client.get(path `/conversations/${conversation_id}/items/${itemID}`, {
|
|
8201
|
+
return this._client.get(path `/conversations/${conversation_id}/items/${itemID}`, {
|
|
8202
|
+
query,
|
|
8203
|
+
...options,
|
|
8204
|
+
__security: { bearerAuth: true },
|
|
8205
|
+
});
|
|
6429
8206
|
}
|
|
6430
8207
|
/**
|
|
6431
8208
|
* List all items for a conversation with the given ID.
|
|
6432
8209
|
*/
|
|
6433
8210
|
list(conversationID, query = {}, options) {
|
|
6434
|
-
return this._client.getAPIList(path `/conversations/${conversationID}/items`, (ConversationCursorPage), { query, ...options });
|
|
8211
|
+
return this._client.getAPIList(path `/conversations/${conversationID}/items`, (ConversationCursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
6435
8212
|
}
|
|
6436
8213
|
/**
|
|
6437
8214
|
* Delete an item from a conversation with the given IDs.
|
|
6438
8215
|
*/
|
|
6439
8216
|
delete(itemID, params, options) {
|
|
6440
8217
|
const { conversation_id } = params;
|
|
6441
|
-
return this._client.delete(path `/conversations/${conversation_id}/items/${itemID}`,
|
|
8218
|
+
return this._client.delete(path `/conversations/${conversation_id}/items/${itemID}`, {
|
|
8219
|
+
...options,
|
|
8220
|
+
__security: { bearerAuth: true },
|
|
8221
|
+
});
|
|
6442
8222
|
}
|
|
6443
8223
|
}
|
|
6444
8224
|
|
|
@@ -6455,25 +8235,35 @@ class Conversations extends APIResource {
|
|
|
6455
8235
|
* Create a conversation.
|
|
6456
8236
|
*/
|
|
6457
8237
|
create(body = {}, options) {
|
|
6458
|
-
return this._client.post('/conversations', { body, ...options });
|
|
8238
|
+
return this._client.post('/conversations', { body, ...options, __security: { bearerAuth: true } });
|
|
6459
8239
|
}
|
|
6460
8240
|
/**
|
|
6461
8241
|
* Get a conversation
|
|
6462
8242
|
*/
|
|
6463
8243
|
retrieve(conversationID, options) {
|
|
6464
|
-
return this._client.get(path `/conversations/${conversationID}`,
|
|
8244
|
+
return this._client.get(path `/conversations/${conversationID}`, {
|
|
8245
|
+
...options,
|
|
8246
|
+
__security: { bearerAuth: true },
|
|
8247
|
+
});
|
|
6465
8248
|
}
|
|
6466
8249
|
/**
|
|
6467
8250
|
* Update a conversation
|
|
6468
8251
|
*/
|
|
6469
8252
|
update(conversationID, body, options) {
|
|
6470
|
-
return this._client.post(path `/conversations/${conversationID}`, {
|
|
8253
|
+
return this._client.post(path `/conversations/${conversationID}`, {
|
|
8254
|
+
body,
|
|
8255
|
+
...options,
|
|
8256
|
+
__security: { bearerAuth: true },
|
|
8257
|
+
});
|
|
6471
8258
|
}
|
|
6472
8259
|
/**
|
|
6473
8260
|
* Delete a conversation. Items in the conversation will not be deleted.
|
|
6474
8261
|
*/
|
|
6475
8262
|
delete(conversationID, options) {
|
|
6476
|
-
return this._client.delete(path `/conversations/${conversationID}`,
|
|
8263
|
+
return this._client.delete(path `/conversations/${conversationID}`, {
|
|
8264
|
+
...options,
|
|
8265
|
+
__security: { bearerAuth: true },
|
|
8266
|
+
});
|
|
6477
8267
|
}
|
|
6478
8268
|
}
|
|
6479
8269
|
Conversations.Items = Items;
|
|
@@ -6509,6 +8299,7 @@ class Embeddings extends APIResource {
|
|
|
6509
8299
|
encoding_format: encoding_format,
|
|
6510
8300
|
},
|
|
6511
8301
|
...options,
|
|
8302
|
+
__security: { bearerAuth: true },
|
|
6512
8303
|
});
|
|
6513
8304
|
// if the user specified an encoding_format, return the response as-is
|
|
6514
8305
|
if (hasUserProvidedEncodingFormat) {
|
|
@@ -6541,14 +8332,17 @@ class OutputItems extends APIResource {
|
|
|
6541
8332
|
*/
|
|
6542
8333
|
retrieve(outputItemID, params, options) {
|
|
6543
8334
|
const { eval_id, run_id } = params;
|
|
6544
|
-
return this._client.get(path `/evals/${eval_id}/runs/${run_id}/output_items/${outputItemID}`,
|
|
8335
|
+
return this._client.get(path `/evals/${eval_id}/runs/${run_id}/output_items/${outputItemID}`, {
|
|
8336
|
+
...options,
|
|
8337
|
+
__security: { bearerAuth: true },
|
|
8338
|
+
});
|
|
6545
8339
|
}
|
|
6546
8340
|
/**
|
|
6547
8341
|
* Get a list of output items for an evaluation run.
|
|
6548
8342
|
*/
|
|
6549
8343
|
list(runID, params, options) {
|
|
6550
8344
|
const { eval_id, ...query } = params;
|
|
6551
|
-
return this._client.getAPIList(path `/evals/${eval_id}/runs/${runID}/output_items`, (CursorPage), { query, ...options });
|
|
8345
|
+
return this._client.getAPIList(path `/evals/${eval_id}/runs/${runID}/output_items`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
6552
8346
|
}
|
|
6553
8347
|
}
|
|
6554
8348
|
|
|
@@ -6567,14 +8361,21 @@ class Runs extends APIResource {
|
|
|
6567
8361
|
* schema specified in the config of the evaluation.
|
|
6568
8362
|
*/
|
|
6569
8363
|
create(evalID, body, options) {
|
|
6570
|
-
return this._client.post(path `/evals/${evalID}/runs`, {
|
|
8364
|
+
return this._client.post(path `/evals/${evalID}/runs`, {
|
|
8365
|
+
body,
|
|
8366
|
+
...options,
|
|
8367
|
+
__security: { bearerAuth: true },
|
|
8368
|
+
});
|
|
6571
8369
|
}
|
|
6572
8370
|
/**
|
|
6573
8371
|
* Get an evaluation run by ID.
|
|
6574
8372
|
*/
|
|
6575
8373
|
retrieve(runID, params, options) {
|
|
6576
8374
|
const { eval_id } = params;
|
|
6577
|
-
return this._client.get(path `/evals/${eval_id}/runs/${runID}`,
|
|
8375
|
+
return this._client.get(path `/evals/${eval_id}/runs/${runID}`, {
|
|
8376
|
+
...options,
|
|
8377
|
+
__security: { bearerAuth: true },
|
|
8378
|
+
});
|
|
6578
8379
|
}
|
|
6579
8380
|
/**
|
|
6580
8381
|
* Get a list of runs for an evaluation.
|
|
@@ -6583,6 +8384,7 @@ class Runs extends APIResource {
|
|
|
6583
8384
|
return this._client.getAPIList(path `/evals/${evalID}/runs`, (CursorPage), {
|
|
6584
8385
|
query,
|
|
6585
8386
|
...options,
|
|
8387
|
+
__security: { bearerAuth: true },
|
|
6586
8388
|
});
|
|
6587
8389
|
}
|
|
6588
8390
|
/**
|
|
@@ -6590,14 +8392,20 @@ class Runs extends APIResource {
|
|
|
6590
8392
|
*/
|
|
6591
8393
|
delete(runID, params, options) {
|
|
6592
8394
|
const { eval_id } = params;
|
|
6593
|
-
return this._client.delete(path `/evals/${eval_id}/runs/${runID}`,
|
|
8395
|
+
return this._client.delete(path `/evals/${eval_id}/runs/${runID}`, {
|
|
8396
|
+
...options,
|
|
8397
|
+
__security: { bearerAuth: true },
|
|
8398
|
+
});
|
|
6594
8399
|
}
|
|
6595
8400
|
/**
|
|
6596
8401
|
* Cancel an ongoing evaluation run.
|
|
6597
8402
|
*/
|
|
6598
8403
|
cancel(runID, params, options) {
|
|
6599
8404
|
const { eval_id } = params;
|
|
6600
|
-
return this._client.post(path `/evals/${eval_id}/runs/${runID}`,
|
|
8405
|
+
return this._client.post(path `/evals/${eval_id}/runs/${runID}`, {
|
|
8406
|
+
...options,
|
|
8407
|
+
__security: { bearerAuth: true },
|
|
8408
|
+
});
|
|
6601
8409
|
}
|
|
6602
8410
|
}
|
|
6603
8411
|
Runs.OutputItems = OutputItems;
|
|
@@ -6620,31 +8428,35 @@ class Evals extends APIResource {
|
|
|
6620
8428
|
* the [Evals guide](https://platform.openai.com/docs/guides/evals).
|
|
6621
8429
|
*/
|
|
6622
8430
|
create(body, options) {
|
|
6623
|
-
return this._client.post('/evals', { body, ...options });
|
|
8431
|
+
return this._client.post('/evals', { body, ...options, __security: { bearerAuth: true } });
|
|
6624
8432
|
}
|
|
6625
8433
|
/**
|
|
6626
8434
|
* Get an evaluation by ID.
|
|
6627
8435
|
*/
|
|
6628
8436
|
retrieve(evalID, options) {
|
|
6629
|
-
return this._client.get(path `/evals/${evalID}`, options);
|
|
8437
|
+
return this._client.get(path `/evals/${evalID}`, { ...options, __security: { bearerAuth: true } });
|
|
6630
8438
|
}
|
|
6631
8439
|
/**
|
|
6632
8440
|
* Update certain properties of an evaluation.
|
|
6633
8441
|
*/
|
|
6634
8442
|
update(evalID, body, options) {
|
|
6635
|
-
return this._client.post(path `/evals/${evalID}`, { body, ...options });
|
|
8443
|
+
return this._client.post(path `/evals/${evalID}`, { body, ...options, __security: { bearerAuth: true } });
|
|
6636
8444
|
}
|
|
6637
8445
|
/**
|
|
6638
8446
|
* List evaluations for a project.
|
|
6639
8447
|
*/
|
|
6640
8448
|
list(query = {}, options) {
|
|
6641
|
-
return this._client.getAPIList('/evals', (CursorPage), {
|
|
8449
|
+
return this._client.getAPIList('/evals', (CursorPage), {
|
|
8450
|
+
query,
|
|
8451
|
+
...options,
|
|
8452
|
+
__security: { bearerAuth: true },
|
|
8453
|
+
});
|
|
6642
8454
|
}
|
|
6643
8455
|
/**
|
|
6644
8456
|
* Delete an evaluation.
|
|
6645
8457
|
*/
|
|
6646
8458
|
delete(evalID, options) {
|
|
6647
|
-
return this._client.delete(path `/evals/${evalID}`, options);
|
|
8459
|
+
return this._client.delete(path `/evals/${evalID}`, { ...options, __security: { bearerAuth: true } });
|
|
6648
8460
|
}
|
|
6649
8461
|
}
|
|
6650
8462
|
Evals.Runs = Runs;
|
|
@@ -6657,7 +8469,8 @@ let Files$1 = class Files extends APIResource {
|
|
|
6657
8469
|
/**
|
|
6658
8470
|
* Upload a file that can be used across various endpoints. Individual files can be
|
|
6659
8471
|
* up to 512 MB, and each project can store up to 2.5 TB of files in total. There
|
|
6660
|
-
* is no organization-wide storage limit.
|
|
8472
|
+
* is no organization-wide storage limit. Uploads to this endpoint are rate-limited
|
|
8473
|
+
* to 1,000 requests per minute per authenticated user.
|
|
6661
8474
|
*
|
|
6662
8475
|
* - The Assistants API supports files up to 2 million tokens and of specific file
|
|
6663
8476
|
* types. See the
|
|
@@ -6672,30 +8485,40 @@ let Files$1 = class Files extends APIResource {
|
|
|
6672
8485
|
* - The Batch API only supports `.jsonl` files up to 200 MB in size. The input
|
|
6673
8486
|
* also has a specific required
|
|
6674
8487
|
* [format](https://platform.openai.com/docs/api-reference/batch/request-input).
|
|
8488
|
+
* - For Retrieval or `file_search` ingestion, upload files here first. If you need
|
|
8489
|
+
* to attach multiple uploaded files to the same vector store, use
|
|
8490
|
+
* [`/vector_stores/{vector_store_id}/file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch)
|
|
8491
|
+
* instead of attaching them one by one. Vector store attachment has separate
|
|
8492
|
+
* limits from file upload, including 2,000 attached files per minute per
|
|
8493
|
+
* organization.
|
|
6675
8494
|
*
|
|
6676
8495
|
* Please [contact us](https://help.openai.com/) if you need to increase these
|
|
6677
8496
|
* storage limits.
|
|
6678
8497
|
*/
|
|
6679
8498
|
create(body, options) {
|
|
6680
|
-
return this._client.post('/files', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
8499
|
+
return this._client.post('/files', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
6681
8500
|
}
|
|
6682
8501
|
/**
|
|
6683
8502
|
* Returns information about a specific file.
|
|
6684
8503
|
*/
|
|
6685
8504
|
retrieve(fileID, options) {
|
|
6686
|
-
return this._client.get(path `/files/${fileID}`, options);
|
|
8505
|
+
return this._client.get(path `/files/${fileID}`, { ...options, __security: { bearerAuth: true } });
|
|
6687
8506
|
}
|
|
6688
8507
|
/**
|
|
6689
8508
|
* Returns a list of files.
|
|
6690
8509
|
*/
|
|
6691
8510
|
list(query = {}, options) {
|
|
6692
|
-
return this._client.getAPIList('/files', (CursorPage), {
|
|
8511
|
+
return this._client.getAPIList('/files', (CursorPage), {
|
|
8512
|
+
query,
|
|
8513
|
+
...options,
|
|
8514
|
+
__security: { bearerAuth: true },
|
|
8515
|
+
});
|
|
6693
8516
|
}
|
|
6694
8517
|
/**
|
|
6695
8518
|
* Delete a file and remove it from all vector stores.
|
|
6696
8519
|
*/
|
|
6697
8520
|
delete(fileID, options) {
|
|
6698
|
-
return this._client.delete(path `/files/${fileID}`, options);
|
|
8521
|
+
return this._client.delete(path `/files/${fileID}`, { ...options, __security: { bearerAuth: true } });
|
|
6699
8522
|
}
|
|
6700
8523
|
/**
|
|
6701
8524
|
* Returns the contents of the specified file.
|
|
@@ -6704,6 +8527,7 @@ let Files$1 = class Files extends APIResource {
|
|
|
6704
8527
|
return this._client.get(path `/files/${fileID}/content`, {
|
|
6705
8528
|
...options,
|
|
6706
8529
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
8530
|
+
__security: { bearerAuth: true },
|
|
6707
8531
|
__binaryResponse: true,
|
|
6708
8532
|
});
|
|
6709
8533
|
}
|
|
@@ -6754,7 +8578,11 @@ let Graders$1 = class Graders extends APIResource {
|
|
|
6754
8578
|
* ```
|
|
6755
8579
|
*/
|
|
6756
8580
|
run(body, options) {
|
|
6757
|
-
return this._client.post('/fine_tuning/alpha/graders/run', {
|
|
8581
|
+
return this._client.post('/fine_tuning/alpha/graders/run', {
|
|
8582
|
+
body,
|
|
8583
|
+
...options,
|
|
8584
|
+
__security: { bearerAuth: true },
|
|
8585
|
+
});
|
|
6758
8586
|
}
|
|
6759
8587
|
/**
|
|
6760
8588
|
* Validate a grader.
|
|
@@ -6774,7 +8602,11 @@ let Graders$1 = class Graders extends APIResource {
|
|
|
6774
8602
|
* ```
|
|
6775
8603
|
*/
|
|
6776
8604
|
validate(body, options) {
|
|
6777
|
-
return this._client.post('/fine_tuning/alpha/graders/validate', {
|
|
8605
|
+
return this._client.post('/fine_tuning/alpha/graders/validate', {
|
|
8606
|
+
body,
|
|
8607
|
+
...options,
|
|
8608
|
+
__security: { bearerAuth: true },
|
|
8609
|
+
});
|
|
6778
8610
|
}
|
|
6779
8611
|
};
|
|
6780
8612
|
|
|
@@ -6810,7 +8642,7 @@ class Permissions extends APIResource {
|
|
|
6810
8642
|
* ```
|
|
6811
8643
|
*/
|
|
6812
8644
|
create(fineTunedModelCheckpoint, body, options) {
|
|
6813
|
-
return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (Page), { body, method: 'post', ...options });
|
|
8645
|
+
return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (Page), { body, method: 'post', ...options, __security: { adminAPIKeyAuth: true } });
|
|
6814
8646
|
}
|
|
6815
8647
|
/**
|
|
6816
8648
|
* **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
|
|
@@ -6824,6 +8656,7 @@ class Permissions extends APIResource {
|
|
|
6824
8656
|
return this._client.get(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, {
|
|
6825
8657
|
query,
|
|
6826
8658
|
...options,
|
|
8659
|
+
__security: { adminAPIKeyAuth: true },
|
|
6827
8660
|
});
|
|
6828
8661
|
}
|
|
6829
8662
|
/**
|
|
@@ -6843,7 +8676,7 @@ class Permissions extends APIResource {
|
|
|
6843
8676
|
* ```
|
|
6844
8677
|
*/
|
|
6845
8678
|
list(fineTunedModelCheckpoint, query = {}, options) {
|
|
6846
|
-
return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (ConversationCursorPage), { query, ...options });
|
|
8679
|
+
return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
6847
8680
|
}
|
|
6848
8681
|
/**
|
|
6849
8682
|
* **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
|
|
@@ -6865,7 +8698,7 @@ class Permissions extends APIResource {
|
|
|
6865
8698
|
*/
|
|
6866
8699
|
delete(permissionID, params, options) {
|
|
6867
8700
|
const { fine_tuned_model_checkpoint } = params;
|
|
6868
|
-
return this._client.delete(path `/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, options);
|
|
8701
|
+
return this._client.delete(path `/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, { ...options, __security: { adminAPIKeyAuth: true } });
|
|
6869
8702
|
}
|
|
6870
8703
|
}
|
|
6871
8704
|
|
|
@@ -6897,7 +8730,7 @@ class Checkpoints extends APIResource {
|
|
|
6897
8730
|
* ```
|
|
6898
8731
|
*/
|
|
6899
8732
|
list(fineTuningJobID, query = {}, options) {
|
|
6900
|
-
return this._client.getAPIList(path `/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, (CursorPage), { query, ...options });
|
|
8733
|
+
return this._client.getAPIList(path `/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
6901
8734
|
}
|
|
6902
8735
|
}
|
|
6903
8736
|
|
|
@@ -6928,7 +8761,7 @@ class Jobs extends APIResource {
|
|
|
6928
8761
|
* ```
|
|
6929
8762
|
*/
|
|
6930
8763
|
create(body, options) {
|
|
6931
|
-
return this._client.post('/fine_tuning/jobs', { body, ...options });
|
|
8764
|
+
return this._client.post('/fine_tuning/jobs', { body, ...options, __security: { bearerAuth: true } });
|
|
6932
8765
|
}
|
|
6933
8766
|
/**
|
|
6934
8767
|
* Get info about a fine-tuning job.
|
|
@@ -6943,7 +8776,10 @@ class Jobs extends APIResource {
|
|
|
6943
8776
|
* ```
|
|
6944
8777
|
*/
|
|
6945
8778
|
retrieve(fineTuningJobID, options) {
|
|
6946
|
-
return this._client.get(path `/fine_tuning/jobs/${fineTuningJobID}`,
|
|
8779
|
+
return this._client.get(path `/fine_tuning/jobs/${fineTuningJobID}`, {
|
|
8780
|
+
...options,
|
|
8781
|
+
__security: { bearerAuth: true },
|
|
8782
|
+
});
|
|
6947
8783
|
}
|
|
6948
8784
|
/**
|
|
6949
8785
|
* List your organization's fine-tuning jobs
|
|
@@ -6957,7 +8793,11 @@ class Jobs extends APIResource {
|
|
|
6957
8793
|
* ```
|
|
6958
8794
|
*/
|
|
6959
8795
|
list(query = {}, options) {
|
|
6960
|
-
return this._client.getAPIList('/fine_tuning/jobs', (CursorPage), {
|
|
8796
|
+
return this._client.getAPIList('/fine_tuning/jobs', (CursorPage), {
|
|
8797
|
+
query,
|
|
8798
|
+
...options,
|
|
8799
|
+
__security: { bearerAuth: true },
|
|
8800
|
+
});
|
|
6961
8801
|
}
|
|
6962
8802
|
/**
|
|
6963
8803
|
* Immediately cancel a fine-tune job.
|
|
@@ -6970,7 +8810,10 @@ class Jobs extends APIResource {
|
|
|
6970
8810
|
* ```
|
|
6971
8811
|
*/
|
|
6972
8812
|
cancel(fineTuningJobID, options) {
|
|
6973
|
-
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/cancel`,
|
|
8813
|
+
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/cancel`, {
|
|
8814
|
+
...options,
|
|
8815
|
+
__security: { bearerAuth: true },
|
|
8816
|
+
});
|
|
6974
8817
|
}
|
|
6975
8818
|
/**
|
|
6976
8819
|
* Get status updates for a fine-tuning job.
|
|
@@ -6986,7 +8829,7 @@ class Jobs extends APIResource {
|
|
|
6986
8829
|
* ```
|
|
6987
8830
|
*/
|
|
6988
8831
|
listEvents(fineTuningJobID, query = {}, options) {
|
|
6989
|
-
return this._client.getAPIList(path `/fine_tuning/jobs/${fineTuningJobID}/events`, (CursorPage), { query, ...options });
|
|
8832
|
+
return this._client.getAPIList(path `/fine_tuning/jobs/${fineTuningJobID}/events`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
6990
8833
|
}
|
|
6991
8834
|
/**
|
|
6992
8835
|
* Pause a fine-tune job.
|
|
@@ -6999,7 +8842,10 @@ class Jobs extends APIResource {
|
|
|
6999
8842
|
* ```
|
|
7000
8843
|
*/
|
|
7001
8844
|
pause(fineTuningJobID, options) {
|
|
7002
|
-
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/pause`,
|
|
8845
|
+
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/pause`, {
|
|
8846
|
+
...options,
|
|
8847
|
+
__security: { bearerAuth: true },
|
|
8848
|
+
});
|
|
7003
8849
|
}
|
|
7004
8850
|
/**
|
|
7005
8851
|
* Resume a fine-tune job.
|
|
@@ -7012,7 +8858,10 @@ class Jobs extends APIResource {
|
|
|
7012
8858
|
* ```
|
|
7013
8859
|
*/
|
|
7014
8860
|
resume(fineTuningJobID, options) {
|
|
7015
|
-
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/resume`,
|
|
8861
|
+
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/resume`, {
|
|
8862
|
+
...options,
|
|
8863
|
+
__security: { bearerAuth: true },
|
|
8864
|
+
});
|
|
7016
8865
|
}
|
|
7017
8866
|
}
|
|
7018
8867
|
Jobs.Checkpoints = Checkpoints;
|
|
@@ -7061,13 +8910,18 @@ class Images extends APIResource {
|
|
|
7061
8910
|
* ```
|
|
7062
8911
|
*/
|
|
7063
8912
|
createVariation(body, options) {
|
|
7064
|
-
return this._client.post('/images/variations', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
8913
|
+
return this._client.post('/images/variations', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
7065
8914
|
}
|
|
7066
8915
|
edit(body, options) {
|
|
7067
|
-
return this._client.post('/images/edits', multipartFormRequestOptions({ body, ...options, stream: body.stream ?? false }, this._client));
|
|
8916
|
+
return this._client.post('/images/edits', multipartFormRequestOptions({ body, ...options, stream: body.stream ?? false, __security: { bearerAuth: true } }, this._client));
|
|
7068
8917
|
}
|
|
7069
8918
|
generate(body, options) {
|
|
7070
|
-
return this._client.post('/images/generations', {
|
|
8919
|
+
return this._client.post('/images/generations', {
|
|
8920
|
+
body,
|
|
8921
|
+
...options,
|
|
8922
|
+
stream: body.stream ?? false,
|
|
8923
|
+
__security: { bearerAuth: true },
|
|
8924
|
+
});
|
|
7071
8925
|
}
|
|
7072
8926
|
}
|
|
7073
8927
|
|
|
@@ -7081,21 +8935,21 @@ class Models extends APIResource {
|
|
|
7081
8935
|
* the owner and permissioning.
|
|
7082
8936
|
*/
|
|
7083
8937
|
retrieve(model, options) {
|
|
7084
|
-
return this._client.get(path `/models/${model}`, options);
|
|
8938
|
+
return this._client.get(path `/models/${model}`, { ...options, __security: { bearerAuth: true } });
|
|
7085
8939
|
}
|
|
7086
8940
|
/**
|
|
7087
8941
|
* Lists the currently available models, and provides basic information about each
|
|
7088
8942
|
* one such as the owner and availability.
|
|
7089
8943
|
*/
|
|
7090
8944
|
list(options) {
|
|
7091
|
-
return this._client.getAPIList('/models', (Page), options);
|
|
8945
|
+
return this._client.getAPIList('/models', (Page), { ...options, __security: { bearerAuth: true } });
|
|
7092
8946
|
}
|
|
7093
8947
|
/**
|
|
7094
8948
|
* Delete a fine-tuned model. You must have the Owner role in your organization to
|
|
7095
8949
|
* delete a model.
|
|
7096
8950
|
*/
|
|
7097
8951
|
delete(model, options) {
|
|
7098
|
-
return this._client.delete(path `/models/${model}`, options);
|
|
8952
|
+
return this._client.delete(path `/models/${model}`, { ...options, __security: { bearerAuth: true } });
|
|
7099
8953
|
}
|
|
7100
8954
|
}
|
|
7101
8955
|
|
|
@@ -7109,7 +8963,7 @@ class Moderations extends APIResource {
|
|
|
7109
8963
|
* the [moderation guide](https://platform.openai.com/docs/guides/moderation).
|
|
7110
8964
|
*/
|
|
7111
8965
|
create(body, options) {
|
|
7112
|
-
return this._client.post('/moderations', { body, ...options });
|
|
8966
|
+
return this._client.post('/moderations', { body, ...options, __security: { bearerAuth: true } });
|
|
7113
8967
|
}
|
|
7114
8968
|
}
|
|
7115
8969
|
|
|
@@ -7131,6 +8985,7 @@ class Calls extends APIResource {
|
|
|
7131
8985
|
body,
|
|
7132
8986
|
...options,
|
|
7133
8987
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
8988
|
+
__security: { bearerAuth: true },
|
|
7134
8989
|
});
|
|
7135
8990
|
}
|
|
7136
8991
|
/**
|
|
@@ -7145,6 +9000,7 @@ class Calls extends APIResource {
|
|
|
7145
9000
|
return this._client.post(path `/realtime/calls/${callID}/hangup`, {
|
|
7146
9001
|
...options,
|
|
7147
9002
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
9003
|
+
__security: { bearerAuth: true },
|
|
7148
9004
|
});
|
|
7149
9005
|
}
|
|
7150
9006
|
/**
|
|
@@ -7162,6 +9018,7 @@ class Calls extends APIResource {
|
|
|
7162
9018
|
body,
|
|
7163
9019
|
...options,
|
|
7164
9020
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
9021
|
+
__security: { bearerAuth: true },
|
|
7165
9022
|
});
|
|
7166
9023
|
}
|
|
7167
9024
|
/**
|
|
@@ -7177,6 +9034,7 @@ class Calls extends APIResource {
|
|
|
7177
9034
|
body,
|
|
7178
9035
|
...options,
|
|
7179
9036
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
9037
|
+
__security: { bearerAuth: true },
|
|
7180
9038
|
});
|
|
7181
9039
|
}
|
|
7182
9040
|
}
|
|
@@ -7207,7 +9065,11 @@ class ClientSecrets extends APIResource {
|
|
|
7207
9065
|
* ```
|
|
7208
9066
|
*/
|
|
7209
9067
|
create(body, options) {
|
|
7210
|
-
return this._client.post('/realtime/client_secrets', {
|
|
9068
|
+
return this._client.post('/realtime/client_secrets', {
|
|
9069
|
+
body,
|
|
9070
|
+
...options,
|
|
9071
|
+
__security: { bearerAuth: true },
|
|
9072
|
+
});
|
|
7211
9073
|
}
|
|
7212
9074
|
}
|
|
7213
9075
|
|
|
@@ -7618,7 +9480,7 @@ class InputItems extends APIResource {
|
|
|
7618
9480
|
* ```
|
|
7619
9481
|
*/
|
|
7620
9482
|
list(responseID, query = {}, options) {
|
|
7621
|
-
return this._client.getAPIList(path `/responses/${responseID}/input_items`, (CursorPage), { query, ...options });
|
|
9483
|
+
return this._client.getAPIList(path `/responses/${responseID}/input_items`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
7622
9484
|
}
|
|
7623
9485
|
}
|
|
7624
9486
|
|
|
@@ -7636,7 +9498,11 @@ class InputTokens extends APIResource {
|
|
|
7636
9498
|
* ```
|
|
7637
9499
|
*/
|
|
7638
9500
|
count(body = {}, options) {
|
|
7639
|
-
return this._client.post('/responses/input_tokens', {
|
|
9501
|
+
return this._client.post('/responses/input_tokens', {
|
|
9502
|
+
body,
|
|
9503
|
+
...options,
|
|
9504
|
+
__security: { bearerAuth: true },
|
|
9505
|
+
});
|
|
7640
9506
|
}
|
|
7641
9507
|
}
|
|
7642
9508
|
|
|
@@ -7648,7 +9514,12 @@ class Responses extends APIResource {
|
|
|
7648
9514
|
this.inputTokens = new InputTokens(this._client);
|
|
7649
9515
|
}
|
|
7650
9516
|
create(body, options) {
|
|
7651
|
-
return this._client.post('/responses', {
|
|
9517
|
+
return this._client.post('/responses', {
|
|
9518
|
+
body,
|
|
9519
|
+
...options,
|
|
9520
|
+
stream: body.stream ?? false,
|
|
9521
|
+
__security: { bearerAuth: true },
|
|
9522
|
+
})._thenUnwrap((rsp) => {
|
|
7652
9523
|
if ('object' in rsp && rsp.object === 'response') {
|
|
7653
9524
|
addOutputText(rsp);
|
|
7654
9525
|
}
|
|
@@ -7660,6 +9531,7 @@ class Responses extends APIResource {
|
|
|
7660
9531
|
query,
|
|
7661
9532
|
...options,
|
|
7662
9533
|
stream: query?.stream ?? false,
|
|
9534
|
+
__security: { bearerAuth: true },
|
|
7663
9535
|
})._thenUnwrap((rsp) => {
|
|
7664
9536
|
if ('object' in rsp && rsp.object === 'response') {
|
|
7665
9537
|
addOutputText(rsp);
|
|
@@ -7681,6 +9553,7 @@ class Responses extends APIResource {
|
|
|
7681
9553
|
return this._client.delete(path `/responses/${responseID}`, {
|
|
7682
9554
|
...options,
|
|
7683
9555
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
9556
|
+
__security: { bearerAuth: true },
|
|
7684
9557
|
});
|
|
7685
9558
|
}
|
|
7686
9559
|
parse(body, options) {
|
|
@@ -7707,7 +9580,10 @@ class Responses extends APIResource {
|
|
|
7707
9580
|
* ```
|
|
7708
9581
|
*/
|
|
7709
9582
|
cancel(responseID, options) {
|
|
7710
|
-
return this._client.post(path `/responses/${responseID}/cancel`,
|
|
9583
|
+
return this._client.post(path `/responses/${responseID}/cancel`, {
|
|
9584
|
+
...options,
|
|
9585
|
+
__security: { bearerAuth: true },
|
|
9586
|
+
});
|
|
7711
9587
|
}
|
|
7712
9588
|
/**
|
|
7713
9589
|
* Compact a conversation. Returns a compacted response object.
|
|
@@ -7725,7 +9601,7 @@ class Responses extends APIResource {
|
|
|
7725
9601
|
* ```
|
|
7726
9602
|
*/
|
|
7727
9603
|
compact(body, options) {
|
|
7728
|
-
return this._client.post('/responses/compact', { body, ...options });
|
|
9604
|
+
return this._client.post('/responses/compact', { body, ...options, __security: { bearerAuth: true } });
|
|
7729
9605
|
}
|
|
7730
9606
|
}
|
|
7731
9607
|
Responses.InputItems = InputItems;
|
|
@@ -7740,6 +9616,7 @@ let Content$1 = class Content extends APIResource {
|
|
|
7740
9616
|
return this._client.get(path `/skills/${skillID}/content`, {
|
|
7741
9617
|
...options,
|
|
7742
9618
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
9619
|
+
__security: { bearerAuth: true },
|
|
7743
9620
|
__binaryResponse: true,
|
|
7744
9621
|
});
|
|
7745
9622
|
}
|
|
@@ -7755,6 +9632,7 @@ class Content extends APIResource {
|
|
|
7755
9632
|
return this._client.get(path `/skills/${skill_id}/versions/${version}/content`, {
|
|
7756
9633
|
...options,
|
|
7757
9634
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
9635
|
+
__security: { bearerAuth: true },
|
|
7758
9636
|
__binaryResponse: true,
|
|
7759
9637
|
});
|
|
7760
9638
|
}
|
|
@@ -7770,14 +9648,17 @@ class Versions extends APIResource {
|
|
|
7770
9648
|
* Create a new immutable skill version.
|
|
7771
9649
|
*/
|
|
7772
9650
|
create(skillID, body = {}, options) {
|
|
7773
|
-
return this._client.post(path `/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
9651
|
+
return this._client.post(path `/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
7774
9652
|
}
|
|
7775
9653
|
/**
|
|
7776
9654
|
* Get a specific skill version.
|
|
7777
9655
|
*/
|
|
7778
9656
|
retrieve(version, params, options) {
|
|
7779
9657
|
const { skill_id } = params;
|
|
7780
|
-
return this._client.get(path `/skills/${skill_id}/versions/${version}`,
|
|
9658
|
+
return this._client.get(path `/skills/${skill_id}/versions/${version}`, {
|
|
9659
|
+
...options,
|
|
9660
|
+
__security: { bearerAuth: true },
|
|
9661
|
+
});
|
|
7781
9662
|
}
|
|
7782
9663
|
/**
|
|
7783
9664
|
* List skill versions for a skill.
|
|
@@ -7786,6 +9667,7 @@ class Versions extends APIResource {
|
|
|
7786
9667
|
return this._client.getAPIList(path `/skills/${skillID}/versions`, (CursorPage), {
|
|
7787
9668
|
query,
|
|
7788
9669
|
...options,
|
|
9670
|
+
__security: { bearerAuth: true },
|
|
7789
9671
|
});
|
|
7790
9672
|
}
|
|
7791
9673
|
/**
|
|
@@ -7793,7 +9675,10 @@ class Versions extends APIResource {
|
|
|
7793
9675
|
*/
|
|
7794
9676
|
delete(version, params, options) {
|
|
7795
9677
|
const { skill_id } = params;
|
|
7796
|
-
return this._client.delete(path `/skills/${skill_id}/versions/${version}`,
|
|
9678
|
+
return this._client.delete(path `/skills/${skill_id}/versions/${version}`, {
|
|
9679
|
+
...options,
|
|
9680
|
+
__security: { bearerAuth: true },
|
|
9681
|
+
});
|
|
7797
9682
|
}
|
|
7798
9683
|
}
|
|
7799
9684
|
Versions.Content = Content;
|
|
@@ -7809,31 +9694,39 @@ class Skills extends APIResource {
|
|
|
7809
9694
|
* Create a new skill.
|
|
7810
9695
|
*/
|
|
7811
9696
|
create(body = {}, options) {
|
|
7812
|
-
return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
9697
|
+
return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
7813
9698
|
}
|
|
7814
9699
|
/**
|
|
7815
9700
|
* Get a skill by its ID.
|
|
7816
9701
|
*/
|
|
7817
9702
|
retrieve(skillID, options) {
|
|
7818
|
-
return this._client.get(path `/skills/${skillID}`, options);
|
|
9703
|
+
return this._client.get(path `/skills/${skillID}`, { ...options, __security: { bearerAuth: true } });
|
|
7819
9704
|
}
|
|
7820
9705
|
/**
|
|
7821
9706
|
* Update the default version pointer for a skill.
|
|
7822
9707
|
*/
|
|
7823
9708
|
update(skillID, body, options) {
|
|
7824
|
-
return this._client.post(path `/skills/${skillID}`, {
|
|
9709
|
+
return this._client.post(path `/skills/${skillID}`, {
|
|
9710
|
+
body,
|
|
9711
|
+
...options,
|
|
9712
|
+
__security: { bearerAuth: true },
|
|
9713
|
+
});
|
|
7825
9714
|
}
|
|
7826
9715
|
/**
|
|
7827
9716
|
* List all skills for the current project.
|
|
7828
9717
|
*/
|
|
7829
9718
|
list(query = {}, options) {
|
|
7830
|
-
return this._client.getAPIList('/skills', (CursorPage), {
|
|
9719
|
+
return this._client.getAPIList('/skills', (CursorPage), {
|
|
9720
|
+
query,
|
|
9721
|
+
...options,
|
|
9722
|
+
__security: { bearerAuth: true },
|
|
9723
|
+
});
|
|
7831
9724
|
}
|
|
7832
9725
|
/**
|
|
7833
9726
|
* Delete a skill by its ID.
|
|
7834
9727
|
*/
|
|
7835
9728
|
delete(skillID, options) {
|
|
7836
|
-
return this._client.delete(path `/skills/${skillID}`, options);
|
|
9729
|
+
return this._client.delete(path `/skills/${skillID}`, { ...options, __security: { bearerAuth: true } });
|
|
7837
9730
|
}
|
|
7838
9731
|
}
|
|
7839
9732
|
Skills.Content = Content$1;
|
|
@@ -7858,7 +9751,7 @@ class Parts extends APIResource {
|
|
|
7858
9751
|
* [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete).
|
|
7859
9752
|
*/
|
|
7860
9753
|
create(uploadID, body, options) {
|
|
7861
|
-
return this._client.post(path `/uploads/${uploadID}/parts`, multipartFormRequestOptions({ body, ...options }, this._client));
|
|
9754
|
+
return this._client.post(path `/uploads/${uploadID}/parts`, multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
7862
9755
|
}
|
|
7863
9756
|
}
|
|
7864
9757
|
|
|
@@ -7895,7 +9788,7 @@ class Uploads extends APIResource {
|
|
|
7895
9788
|
* Returns the Upload object with status `pending`.
|
|
7896
9789
|
*/
|
|
7897
9790
|
create(body, options) {
|
|
7898
|
-
return this._client.post('/uploads', { body, ...options });
|
|
9791
|
+
return this._client.post('/uploads', { body, ...options, __security: { bearerAuth: true } });
|
|
7899
9792
|
}
|
|
7900
9793
|
/**
|
|
7901
9794
|
* Cancels the Upload. No Parts may be added after an Upload is cancelled.
|
|
@@ -7903,7 +9796,10 @@ class Uploads extends APIResource {
|
|
|
7903
9796
|
* Returns the Upload object with status `cancelled`.
|
|
7904
9797
|
*/
|
|
7905
9798
|
cancel(uploadID, options) {
|
|
7906
|
-
return this._client.post(path `/uploads/${uploadID}/cancel`,
|
|
9799
|
+
return this._client.post(path `/uploads/${uploadID}/cancel`, {
|
|
9800
|
+
...options,
|
|
9801
|
+
__security: { bearerAuth: true },
|
|
9802
|
+
});
|
|
7907
9803
|
}
|
|
7908
9804
|
/**
|
|
7909
9805
|
* Completes the
|
|
@@ -7923,7 +9819,11 @@ class Uploads extends APIResource {
|
|
|
7923
9819
|
* object.
|
|
7924
9820
|
*/
|
|
7925
9821
|
complete(uploadID, body, options) {
|
|
7926
|
-
return this._client.post(path `/uploads/${uploadID}/complete`, {
|
|
9822
|
+
return this._client.post(path `/uploads/${uploadID}/complete`, {
|
|
9823
|
+
body,
|
|
9824
|
+
...options,
|
|
9825
|
+
__security: { bearerAuth: true },
|
|
9826
|
+
});
|
|
7927
9827
|
}
|
|
7928
9828
|
}
|
|
7929
9829
|
Uploads.Parts = Parts;
|
|
@@ -7960,6 +9860,7 @@ class FileBatches extends APIResource {
|
|
|
7960
9860
|
body,
|
|
7961
9861
|
...options,
|
|
7962
9862
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9863
|
+
__security: { bearerAuth: true },
|
|
7963
9864
|
});
|
|
7964
9865
|
}
|
|
7965
9866
|
/**
|
|
@@ -7970,6 +9871,7 @@ class FileBatches extends APIResource {
|
|
|
7970
9871
|
return this._client.get(path `/vector_stores/${vector_store_id}/file_batches/${batchID}`, {
|
|
7971
9872
|
...options,
|
|
7972
9873
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9874
|
+
__security: { bearerAuth: true },
|
|
7973
9875
|
});
|
|
7974
9876
|
}
|
|
7975
9877
|
/**
|
|
@@ -7981,6 +9883,7 @@ class FileBatches extends APIResource {
|
|
|
7981
9883
|
return this._client.post(path `/vector_stores/${vector_store_id}/file_batches/${batchID}/cancel`, {
|
|
7982
9884
|
...options,
|
|
7983
9885
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9886
|
+
__security: { bearerAuth: true },
|
|
7984
9887
|
});
|
|
7985
9888
|
}
|
|
7986
9889
|
/**
|
|
@@ -7995,7 +9898,12 @@ class FileBatches extends APIResource {
|
|
|
7995
9898
|
*/
|
|
7996
9899
|
listFiles(batchID, params, options) {
|
|
7997
9900
|
const { vector_store_id, ...query } = params;
|
|
7998
|
-
return this._client.getAPIList(path `/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, (CursorPage), {
|
|
9901
|
+
return this._client.getAPIList(path `/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, (CursorPage), {
|
|
9902
|
+
query,
|
|
9903
|
+
...options,
|
|
9904
|
+
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9905
|
+
__security: { bearerAuth: true },
|
|
9906
|
+
});
|
|
7999
9907
|
}
|
|
8000
9908
|
/**
|
|
8001
9909
|
* Wait for the given file batch to be processed.
|
|
@@ -8085,6 +9993,7 @@ class Files extends APIResource {
|
|
|
8085
9993
|
body,
|
|
8086
9994
|
...options,
|
|
8087
9995
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
9996
|
+
__security: { bearerAuth: true },
|
|
8088
9997
|
});
|
|
8089
9998
|
}
|
|
8090
9999
|
/**
|
|
@@ -8095,6 +10004,7 @@ class Files extends APIResource {
|
|
|
8095
10004
|
return this._client.get(path `/vector_stores/${vector_store_id}/files/${fileID}`, {
|
|
8096
10005
|
...options,
|
|
8097
10006
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10007
|
+
__security: { bearerAuth: true },
|
|
8098
10008
|
});
|
|
8099
10009
|
}
|
|
8100
10010
|
/**
|
|
@@ -8106,6 +10016,7 @@ class Files extends APIResource {
|
|
|
8106
10016
|
body,
|
|
8107
10017
|
...options,
|
|
8108
10018
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10019
|
+
__security: { bearerAuth: true },
|
|
8109
10020
|
});
|
|
8110
10021
|
}
|
|
8111
10022
|
/**
|
|
@@ -8116,6 +10027,7 @@ class Files extends APIResource {
|
|
|
8116
10027
|
query,
|
|
8117
10028
|
...options,
|
|
8118
10029
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10030
|
+
__security: { bearerAuth: true },
|
|
8119
10031
|
});
|
|
8120
10032
|
}
|
|
8121
10033
|
/**
|
|
@@ -8129,6 +10041,7 @@ class Files extends APIResource {
|
|
|
8129
10041
|
return this._client.delete(path `/vector_stores/${vector_store_id}/files/${fileID}`, {
|
|
8130
10042
|
...options,
|
|
8131
10043
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10044
|
+
__security: { bearerAuth: true },
|
|
8132
10045
|
});
|
|
8133
10046
|
}
|
|
8134
10047
|
/**
|
|
@@ -8202,7 +10115,11 @@ class Files extends APIResource {
|
|
|
8202
10115
|
*/
|
|
8203
10116
|
content(fileID, params, options) {
|
|
8204
10117
|
const { vector_store_id } = params;
|
|
8205
|
-
return this._client.getAPIList(path `/vector_stores/${vector_store_id}/files/${fileID}/content`, (Page), {
|
|
10118
|
+
return this._client.getAPIList(path `/vector_stores/${vector_store_id}/files/${fileID}/content`, (Page), {
|
|
10119
|
+
...options,
|
|
10120
|
+
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10121
|
+
__security: { bearerAuth: true },
|
|
10122
|
+
});
|
|
8206
10123
|
}
|
|
8207
10124
|
}
|
|
8208
10125
|
|
|
@@ -8221,6 +10138,7 @@ class VectorStores extends APIResource {
|
|
|
8221
10138
|
body,
|
|
8222
10139
|
...options,
|
|
8223
10140
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10141
|
+
__security: { bearerAuth: true },
|
|
8224
10142
|
});
|
|
8225
10143
|
}
|
|
8226
10144
|
/**
|
|
@@ -8230,6 +10148,7 @@ class VectorStores extends APIResource {
|
|
|
8230
10148
|
return this._client.get(path `/vector_stores/${vectorStoreID}`, {
|
|
8231
10149
|
...options,
|
|
8232
10150
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10151
|
+
__security: { bearerAuth: true },
|
|
8233
10152
|
});
|
|
8234
10153
|
}
|
|
8235
10154
|
/**
|
|
@@ -8240,6 +10159,7 @@ class VectorStores extends APIResource {
|
|
|
8240
10159
|
body,
|
|
8241
10160
|
...options,
|
|
8242
10161
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10162
|
+
__security: { bearerAuth: true },
|
|
8243
10163
|
});
|
|
8244
10164
|
}
|
|
8245
10165
|
/**
|
|
@@ -8250,6 +10170,7 @@ class VectorStores extends APIResource {
|
|
|
8250
10170
|
query,
|
|
8251
10171
|
...options,
|
|
8252
10172
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10173
|
+
__security: { bearerAuth: true },
|
|
8253
10174
|
});
|
|
8254
10175
|
}
|
|
8255
10176
|
/**
|
|
@@ -8259,6 +10180,7 @@ class VectorStores extends APIResource {
|
|
|
8259
10180
|
return this._client.delete(path `/vector_stores/${vectorStoreID}`, {
|
|
8260
10181
|
...options,
|
|
8261
10182
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10183
|
+
__security: { bearerAuth: true },
|
|
8262
10184
|
});
|
|
8263
10185
|
}
|
|
8264
10186
|
/**
|
|
@@ -8271,6 +10193,7 @@ class VectorStores extends APIResource {
|
|
|
8271
10193
|
method: 'post',
|
|
8272
10194
|
...options,
|
|
8273
10195
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
10196
|
+
__security: { bearerAuth: true },
|
|
8274
10197
|
});
|
|
8275
10198
|
}
|
|
8276
10199
|
}
|
|
@@ -8283,31 +10206,35 @@ class Videos extends APIResource {
|
|
|
8283
10206
|
* Create a new video generation job from a prompt and optional reference assets.
|
|
8284
10207
|
*/
|
|
8285
10208
|
create(body, options) {
|
|
8286
|
-
return this._client.post('/videos', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
10209
|
+
return this._client.post('/videos', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
8287
10210
|
}
|
|
8288
10211
|
/**
|
|
8289
10212
|
* Fetch the latest metadata for a generated video.
|
|
8290
10213
|
*/
|
|
8291
10214
|
retrieve(videoID, options) {
|
|
8292
|
-
return this._client.get(path `/videos/${videoID}`, options);
|
|
10215
|
+
return this._client.get(path `/videos/${videoID}`, { ...options, __security: { bearerAuth: true } });
|
|
8293
10216
|
}
|
|
8294
10217
|
/**
|
|
8295
10218
|
* List recently generated videos for the current project.
|
|
8296
10219
|
*/
|
|
8297
10220
|
list(query = {}, options) {
|
|
8298
|
-
return this._client.getAPIList('/videos', (ConversationCursorPage), {
|
|
10221
|
+
return this._client.getAPIList('/videos', (ConversationCursorPage), {
|
|
10222
|
+
query,
|
|
10223
|
+
...options,
|
|
10224
|
+
__security: { bearerAuth: true },
|
|
10225
|
+
});
|
|
8299
10226
|
}
|
|
8300
10227
|
/**
|
|
8301
10228
|
* Permanently delete a completed or failed video and its stored assets.
|
|
8302
10229
|
*/
|
|
8303
10230
|
delete(videoID, options) {
|
|
8304
|
-
return this._client.delete(path `/videos/${videoID}`, options);
|
|
10231
|
+
return this._client.delete(path `/videos/${videoID}`, { ...options, __security: { bearerAuth: true } });
|
|
8305
10232
|
}
|
|
8306
10233
|
/**
|
|
8307
10234
|
* Create a character from an uploaded video.
|
|
8308
10235
|
*/
|
|
8309
10236
|
createCharacter(body, options) {
|
|
8310
|
-
return this._client.post('/videos/characters', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
10237
|
+
return this._client.post('/videos/characters', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
8311
10238
|
}
|
|
8312
10239
|
/**
|
|
8313
10240
|
* Download the generated video bytes or a derived preview asset.
|
|
@@ -8319,6 +10246,7 @@ class Videos extends APIResource {
|
|
|
8319
10246
|
query,
|
|
8320
10247
|
...options,
|
|
8321
10248
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
10249
|
+
__security: { bearerAuth: true },
|
|
8322
10250
|
__binaryResponse: true,
|
|
8323
10251
|
});
|
|
8324
10252
|
}
|
|
@@ -8327,25 +10255,28 @@ class Videos extends APIResource {
|
|
|
8327
10255
|
* generated video.
|
|
8328
10256
|
*/
|
|
8329
10257
|
edit(body, options) {
|
|
8330
|
-
return this._client.post('/videos/edits', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
10258
|
+
return this._client.post('/videos/edits', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
8331
10259
|
}
|
|
8332
10260
|
/**
|
|
8333
10261
|
* Create an extension of a completed video.
|
|
8334
10262
|
*/
|
|
8335
10263
|
extend(body, options) {
|
|
8336
|
-
return this._client.post('/videos/extensions', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
10264
|
+
return this._client.post('/videos/extensions', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
8337
10265
|
}
|
|
8338
10266
|
/**
|
|
8339
10267
|
* Fetch a character.
|
|
8340
10268
|
*/
|
|
8341
10269
|
getCharacter(characterID, options) {
|
|
8342
|
-
return this._client.get(path `/videos/characters/${characterID}`,
|
|
10270
|
+
return this._client.get(path `/videos/characters/${characterID}`, {
|
|
10271
|
+
...options,
|
|
10272
|
+
__security: { bearerAuth: true },
|
|
10273
|
+
});
|
|
8343
10274
|
}
|
|
8344
10275
|
/**
|
|
8345
10276
|
* Create a remix of a completed video using a refreshed prompt.
|
|
8346
10277
|
*/
|
|
8347
10278
|
remix(videoID, body, options) {
|
|
8348
|
-
return this._client.post(path `/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
10279
|
+
return this._client.post(path `/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
8349
10280
|
}
|
|
8350
10281
|
}
|
|
8351
10282
|
|
|
@@ -8452,7 +10383,8 @@ class OpenAI {
|
|
|
8452
10383
|
/**
|
|
8453
10384
|
* API Client for interfacing with the OpenAI API.
|
|
8454
10385
|
*
|
|
8455
|
-
* @param {string | undefined} [opts.apiKey=process.env['OPENAI_API_KEY'] ??
|
|
10386
|
+
* @param {string | null | undefined} [opts.apiKey=process.env['OPENAI_API_KEY'] ?? null]
|
|
10387
|
+
* @param {string | null | undefined} [opts.adminAPIKey=process.env['OPENAI_ADMIN_KEY'] ?? null]
|
|
8456
10388
|
* @param {string | null | undefined} [opts.organization=process.env['OPENAI_ORG_ID'] ?? null]
|
|
8457
10389
|
* @param {string | null | undefined} [opts.project=process.env['OPENAI_PROJECT_ID'] ?? null]
|
|
8458
10390
|
* @param {string | null | undefined} [opts.webhookSecret=process.env['OPENAI_WEBHOOK_SECRET'] ?? null]
|
|
@@ -8465,7 +10397,7 @@ class OpenAI {
|
|
|
8465
10397
|
* @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
8466
10398
|
* @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.
|
|
8467
10399
|
*/
|
|
8468
|
-
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 } = {}) {
|
|
10400
|
+
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 } = {}) {
|
|
8469
10401
|
_OpenAI_instances.add(this);
|
|
8470
10402
|
_OpenAI_encoder.set(this, void 0);
|
|
8471
10403
|
/**
|
|
@@ -8507,6 +10439,7 @@ class OpenAI {
|
|
|
8507
10439
|
* Use Uploads to upload large files in multiple parts.
|
|
8508
10440
|
*/
|
|
8509
10441
|
this.uploads = new Uploads(this);
|
|
10442
|
+
this.admin = new Admin(this);
|
|
8510
10443
|
this.responses = new Responses(this);
|
|
8511
10444
|
this.realtime = new Realtime(this);
|
|
8512
10445
|
/**
|
|
@@ -8520,17 +10453,9 @@ class OpenAI {
|
|
|
8520
10453
|
this.containers = new Containers(this);
|
|
8521
10454
|
this.skills = new Skills(this);
|
|
8522
10455
|
this.videos = new Videos(this);
|
|
8523
|
-
if (workloadIdentity) {
|
|
8524
|
-
if (apiKey && apiKey !== WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER) {
|
|
8525
|
-
throw new OpenAIError('The `apiKey` and `workloadIdentity` arguments are mutually exclusive; only one can be passed at a time.');
|
|
8526
|
-
}
|
|
8527
|
-
apiKey = WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER;
|
|
8528
|
-
}
|
|
8529
|
-
else if (apiKey === undefined) {
|
|
8530
|
-
throw new OpenAIError('Missing credentials. Please pass an `apiKey`, `workloadIdentity`, or set the `OPENAI_API_KEY` environment variable.');
|
|
8531
|
-
}
|
|
8532
10456
|
const options = {
|
|
8533
10457
|
apiKey,
|
|
10458
|
+
adminAPIKey,
|
|
8534
10459
|
organization,
|
|
8535
10460
|
project,
|
|
8536
10461
|
webhookSecret,
|
|
@@ -8538,6 +10463,12 @@ class OpenAI {
|
|
|
8538
10463
|
...opts,
|
|
8539
10464
|
baseURL: baseURL || `https://api.openai.com/v1`,
|
|
8540
10465
|
};
|
|
10466
|
+
if (apiKey && workloadIdentity) {
|
|
10467
|
+
throw new OpenAIError('The `apiKey` and `workloadIdentity` options are mutually exclusive');
|
|
10468
|
+
}
|
|
10469
|
+
if (!apiKey && !adminAPIKey && !workloadIdentity) {
|
|
10470
|
+
throw new OpenAIError('Missing credentials. Please pass an `apiKey`, `workloadIdentity`, `adminAPIKey`, or set the `OPENAI_API_KEY` or `OPENAI_ADMIN_KEY` environment variable.');
|
|
10471
|
+
}
|
|
8541
10472
|
if (!options.dangerouslyAllowBrowser && isRunningInBrowser()) {
|
|
8542
10473
|
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");
|
|
8543
10474
|
}
|
|
@@ -8555,11 +10486,23 @@ class OpenAI {
|
|
|
8555
10486
|
this.maxRetries = options.maxRetries ?? 2;
|
|
8556
10487
|
this.fetch = options.fetch ?? getDefaultFetch();
|
|
8557
10488
|
__classPrivateFieldSet(this, _OpenAI_encoder, FallbackEncoder);
|
|
10489
|
+
const customHeadersEnv = readEnv('OPENAI_CUSTOM_HEADERS');
|
|
10490
|
+
if (customHeadersEnv) {
|
|
10491
|
+
const parsed = {};
|
|
10492
|
+
for (const line of customHeadersEnv.split('\n')) {
|
|
10493
|
+
const colon = line.indexOf(':');
|
|
10494
|
+
if (colon >= 0) {
|
|
10495
|
+
parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
|
|
10496
|
+
}
|
|
10497
|
+
}
|
|
10498
|
+
options.defaultHeaders = buildHeaders([parsed, options.defaultHeaders]);
|
|
10499
|
+
}
|
|
8558
10500
|
this._options = options;
|
|
8559
10501
|
if (workloadIdentity) {
|
|
8560
10502
|
this._workloadIdentityAuth = new WorkloadIdentityAuth(workloadIdentity, this.fetch);
|
|
8561
10503
|
}
|
|
8562
|
-
this.apiKey = typeof apiKey === 'string' ? apiKey :
|
|
10504
|
+
this.apiKey = typeof apiKey === 'string' ? apiKey : null;
|
|
10505
|
+
this.adminAPIKey = adminAPIKey;
|
|
8563
10506
|
this.organization = organization;
|
|
8564
10507
|
this.project = project;
|
|
8565
10508
|
this.webhookSecret = webhookSecret;
|
|
@@ -8577,7 +10520,8 @@ class OpenAI {
|
|
|
8577
10520
|
logLevel: this.logLevel,
|
|
8578
10521
|
fetch: this.fetch,
|
|
8579
10522
|
fetchOptions: this.fetchOptions,
|
|
8580
|
-
apiKey: this.apiKey,
|
|
10523
|
+
apiKey: this._options.apiKey,
|
|
10524
|
+
adminAPIKey: this.adminAPIKey,
|
|
8581
10525
|
workloadIdentity: this._options.workloadIdentity,
|
|
8582
10526
|
organization: this.organization,
|
|
8583
10527
|
project: this.project,
|
|
@@ -8589,12 +10533,45 @@ class OpenAI {
|
|
|
8589
10533
|
defaultQuery() {
|
|
8590
10534
|
return this._options.defaultQuery;
|
|
8591
10535
|
}
|
|
8592
|
-
validateHeaders({ values, nulls }
|
|
8593
|
-
|
|
10536
|
+
validateHeaders({ values, nulls }, schemes = {
|
|
10537
|
+
bearerAuth: true,
|
|
10538
|
+
adminAPIKeyAuth: true,
|
|
10539
|
+
}) {
|
|
10540
|
+
if (values.get('authorization') || values.get('api-key')) {
|
|
10541
|
+
return;
|
|
10542
|
+
}
|
|
10543
|
+
if (nulls.has('authorization') || nulls.has('api-key')) {
|
|
10544
|
+
return;
|
|
10545
|
+
}
|
|
10546
|
+
if (this._workloadIdentityAuth && schemes.bearerAuth) {
|
|
10547
|
+
return;
|
|
10548
|
+
}
|
|
10549
|
+
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');
|
|
8594
10550
|
}
|
|
8595
|
-
async authHeaders(opts
|
|
10551
|
+
async authHeaders(opts, schemes = {
|
|
10552
|
+
bearerAuth: true,
|
|
10553
|
+
adminAPIKeyAuth: true,
|
|
10554
|
+
}) {
|
|
10555
|
+
return buildHeaders([
|
|
10556
|
+
schemes.bearerAuth ? await this.bearerAuth(opts) : null,
|
|
10557
|
+
schemes.adminAPIKeyAuth ? await this.adminAPIKeyAuth(opts) : null,
|
|
10558
|
+
]);
|
|
10559
|
+
}
|
|
10560
|
+
async bearerAuth(opts) {
|
|
10561
|
+
if (this._workloadIdentityAuth) {
|
|
10562
|
+
return buildHeaders([{ Authorization: `Bearer ${await this._workloadIdentityAuth.getToken()}` }]);
|
|
10563
|
+
}
|
|
10564
|
+
if (this.apiKey == null) {
|
|
10565
|
+
return undefined;
|
|
10566
|
+
}
|
|
8596
10567
|
return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]);
|
|
8597
10568
|
}
|
|
10569
|
+
async adminAPIKeyAuth(opts) {
|
|
10570
|
+
if (this.adminAPIKey == null) {
|
|
10571
|
+
return undefined;
|
|
10572
|
+
}
|
|
10573
|
+
return buildHeaders([{ Authorization: `Bearer ${this.adminAPIKey}` }]);
|
|
10574
|
+
}
|
|
8598
10575
|
stringifyQuery(query) {
|
|
8599
10576
|
return stringifyQuery(query);
|
|
8600
10577
|
}
|
|
@@ -8647,7 +10624,10 @@ class OpenAI {
|
|
|
8647
10624
|
* Used as a callback for mutating the given `FinalRequestOptions` object.
|
|
8648
10625
|
*/
|
|
8649
10626
|
async prepareOptions(options) {
|
|
8650
|
-
|
|
10627
|
+
const security = options.__security ?? { bearerAuth: true };
|
|
10628
|
+
if (security.bearerAuth) {
|
|
10629
|
+
await this._callApiKey();
|
|
10630
|
+
}
|
|
8651
10631
|
}
|
|
8652
10632
|
/**
|
|
8653
10633
|
* Used as a callback for mutating the given `RequestInit` object.
|
|
@@ -8704,8 +10684,9 @@ class OpenAI {
|
|
|
8704
10684
|
if (options.signal?.aborted) {
|
|
8705
10685
|
throw new APIUserAbortError();
|
|
8706
10686
|
}
|
|
10687
|
+
const security = options.__security ?? { bearerAuth: true };
|
|
8707
10688
|
const controller = new AbortController();
|
|
8708
|
-
const response = await this.fetchWithAuth(url, req, timeout, controller).catch(castToError);
|
|
10689
|
+
const response = await this.fetchWithAuth(url, req, timeout, controller, security).catch(castToError);
|
|
8709
10690
|
const headersTime = Date.now();
|
|
8710
10691
|
if (response instanceof globalThis.Error) {
|
|
8711
10692
|
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
@@ -8751,6 +10732,7 @@ class OpenAI {
|
|
|
8751
10732
|
if (!response.ok) {
|
|
8752
10733
|
if (response.status === 401 &&
|
|
8753
10734
|
this._workloadIdentityAuth &&
|
|
10735
|
+
security.bearerAuth &&
|
|
8754
10736
|
!options.__metadata?.['hasStreamingBody'] &&
|
|
8755
10737
|
!options.__metadata?.['workloadIdentityTokenRefreshed']) {
|
|
8756
10738
|
await CancelReadableStream(response.body);
|
|
@@ -8813,8 +10795,11 @@ class OpenAI {
|
|
|
8813
10795
|
const request = this.makeRequest(options, null, undefined);
|
|
8814
10796
|
return new PagePromise(this, request, Page);
|
|
8815
10797
|
}
|
|
8816
|
-
async fetchWithAuth(url, init, timeout, controller
|
|
8817
|
-
|
|
10798
|
+
async fetchWithAuth(url, init, timeout, controller, schemes = {
|
|
10799
|
+
bearerAuth: true,
|
|
10800
|
+
adminAPIKeyAuth: true,
|
|
10801
|
+
}) {
|
|
10802
|
+
if (this._workloadIdentityAuth && schemes.bearerAuth) {
|
|
8818
10803
|
const headers = init.headers;
|
|
8819
10804
|
const authHeader = headers.get('Authorization');
|
|
8820
10805
|
if (!authHeader || authHeader === `Bearer ${WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER}`) {
|
|
@@ -8959,12 +10944,12 @@ class OpenAI {
|
|
|
8959
10944
|
'OpenAI-Organization': this.organization,
|
|
8960
10945
|
'OpenAI-Project': this.project,
|
|
8961
10946
|
},
|
|
8962
|
-
await this.authHeaders(options),
|
|
10947
|
+
await this.authHeaders(options, options.__security ?? { bearerAuth: true }),
|
|
8963
10948
|
this._options.defaultHeaders,
|
|
8964
10949
|
bodyHeaders,
|
|
8965
10950
|
options.headers,
|
|
8966
10951
|
]);
|
|
8967
|
-
this.validateHeaders(headers);
|
|
10952
|
+
this.validateHeaders(headers, options.__security ?? { bearerAuth: true });
|
|
8968
10953
|
return headers.values;
|
|
8969
10954
|
}
|
|
8970
10955
|
_makeAbort(controller) {
|
|
@@ -9061,6 +11046,7 @@ OpenAI.Webhooks = Webhooks;
|
|
|
9061
11046
|
OpenAI.Beta = Beta;
|
|
9062
11047
|
OpenAI.Batches = Batches;
|
|
9063
11048
|
OpenAI.Uploads = Uploads;
|
|
11049
|
+
OpenAI.Admin = Admin;
|
|
9064
11050
|
OpenAI.Responses = Responses;
|
|
9065
11051
|
OpenAI.Realtime = Realtime;
|
|
9066
11052
|
OpenAI.Conversations = Conversations;
|
|
@@ -11620,7 +13606,6 @@ function zodTextFormat(zodObject, name, props) {
|
|
|
11620
13606
|
}, (content) => zodObject.parse(JSON.parse(content)));
|
|
11621
13607
|
}
|
|
11622
13608
|
|
|
11623
|
-
// llm-openai-config.ts
|
|
11624
13609
|
const DEFAULT_MODEL = 'gpt-5-mini';
|
|
11625
13610
|
const GPT_5_HIGH_CONTEXT_THRESHOLD_TOKENS = 272_000;
|
|
11626
13611
|
const GPT_5_HIGH_CONTEXT_INPUT_MULTIPLIER = 2;
|
|
@@ -11701,25 +13686,144 @@ const deepseekModelCosts = {
|
|
|
11701
13686
|
function shouldUseGPT5HighContextPricing(model, inputTokens) {
|
|
11702
13687
|
return (model === 'gpt-5.4' || model === 'gpt-5.5') && inputTokens > GPT_5_HIGH_CONTEXT_THRESHOLD_TOKENS;
|
|
11703
13688
|
}
|
|
11704
|
-
|
|
11705
|
-
const
|
|
11706
|
-
|
|
11707
|
-
'gpt-image-
|
|
13689
|
+
const DEFAULT_IMAGE_PRICING_QUALITY = 'high';
|
|
13690
|
+
const DEFAULT_IMAGE_PRICING_SIZE = '1024x1024';
|
|
13691
|
+
const PRICED_OPENAI_IMAGE_MODELS = [
|
|
13692
|
+
'gpt-image-2',
|
|
13693
|
+
'gpt-image-2-2026-04-21',
|
|
13694
|
+
'gpt-image-1.5',
|
|
13695
|
+
'gpt-image-1',
|
|
13696
|
+
'gpt-image-1-mini',
|
|
13697
|
+
];
|
|
13698
|
+
const OPENAI_IMAGE_PRICING_SIZES = ['1024x1024', '1024x1536', '1536x1024'];
|
|
13699
|
+
/**
|
|
13700
|
+
* Estimated image output costs in USD per image for common GPT Image sizes.
|
|
13701
|
+
* Last updated May 2026 from the OpenAI image generation guide. Text and image
|
|
13702
|
+
* input token costs for prompts and edit inputs are not included.
|
|
13703
|
+
*/
|
|
13704
|
+
const openAiImageCostByQualityAndSize = {
|
|
13705
|
+
'gpt-image-2': {
|
|
13706
|
+
low: {
|
|
13707
|
+
'1024x1024': 0.006,
|
|
13708
|
+
'1024x1536': 0.005,
|
|
13709
|
+
'1536x1024': 0.005,
|
|
13710
|
+
},
|
|
13711
|
+
medium: {
|
|
13712
|
+
'1024x1024': 0.053,
|
|
13713
|
+
'1024x1536': 0.041,
|
|
13714
|
+
'1536x1024': 0.041,
|
|
13715
|
+
},
|
|
13716
|
+
high: {
|
|
13717
|
+
'1024x1024': 0.211,
|
|
13718
|
+
'1024x1536': 0.165,
|
|
13719
|
+
'1536x1024': 0.165,
|
|
13720
|
+
},
|
|
13721
|
+
},
|
|
13722
|
+
'gpt-image-2-2026-04-21': {
|
|
13723
|
+
low: {
|
|
13724
|
+
'1024x1024': 0.006,
|
|
13725
|
+
'1024x1536': 0.005,
|
|
13726
|
+
'1536x1024': 0.005,
|
|
13727
|
+
},
|
|
13728
|
+
medium: {
|
|
13729
|
+
'1024x1024': 0.053,
|
|
13730
|
+
'1024x1536': 0.041,
|
|
13731
|
+
'1536x1024': 0.041,
|
|
13732
|
+
},
|
|
13733
|
+
high: {
|
|
13734
|
+
'1024x1024': 0.211,
|
|
13735
|
+
'1024x1536': 0.165,
|
|
13736
|
+
'1536x1024': 0.165,
|
|
13737
|
+
},
|
|
13738
|
+
},
|
|
13739
|
+
'gpt-image-1.5': {
|
|
13740
|
+
low: {
|
|
13741
|
+
'1024x1024': 0.009,
|
|
13742
|
+
'1024x1536': 0.013,
|
|
13743
|
+
'1536x1024': 0.013,
|
|
13744
|
+
},
|
|
13745
|
+
medium: {
|
|
13746
|
+
'1024x1024': 0.034,
|
|
13747
|
+
'1024x1536': 0.05,
|
|
13748
|
+
'1536x1024': 0.05,
|
|
13749
|
+
},
|
|
13750
|
+
high: {
|
|
13751
|
+
'1024x1024': 0.133,
|
|
13752
|
+
'1024x1536': 0.2,
|
|
13753
|
+
'1536x1024': 0.2,
|
|
13754
|
+
},
|
|
13755
|
+
},
|
|
13756
|
+
'gpt-image-1': {
|
|
13757
|
+
low: {
|
|
13758
|
+
'1024x1024': 0.011,
|
|
13759
|
+
'1024x1536': 0.016,
|
|
13760
|
+
'1536x1024': 0.016,
|
|
13761
|
+
},
|
|
13762
|
+
medium: {
|
|
13763
|
+
'1024x1024': 0.042,
|
|
13764
|
+
'1024x1536': 0.063,
|
|
13765
|
+
'1536x1024': 0.063,
|
|
13766
|
+
},
|
|
13767
|
+
high: {
|
|
13768
|
+
'1024x1024': 0.167,
|
|
13769
|
+
'1024x1536': 0.25,
|
|
13770
|
+
'1536x1024': 0.25,
|
|
13771
|
+
},
|
|
13772
|
+
},
|
|
13773
|
+
'gpt-image-1-mini': {
|
|
13774
|
+
low: {
|
|
13775
|
+
'1024x1024': 0.005,
|
|
13776
|
+
'1024x1536': 0.006,
|
|
13777
|
+
'1536x1024': 0.006,
|
|
13778
|
+
},
|
|
13779
|
+
medium: {
|
|
13780
|
+
'1024x1024': 0.011,
|
|
13781
|
+
'1024x1536': 0.015,
|
|
13782
|
+
'1536x1024': 0.015,
|
|
13783
|
+
},
|
|
13784
|
+
high: {
|
|
13785
|
+
'1024x1024': 0.036,
|
|
13786
|
+
'1024x1536': 0.052,
|
|
13787
|
+
'1536x1024': 0.052,
|
|
13788
|
+
},
|
|
13789
|
+
},
|
|
11708
13790
|
};
|
|
13791
|
+
function isPricedOpenAIImageModel(model) {
|
|
13792
|
+
return PRICED_OPENAI_IMAGE_MODELS.includes(model);
|
|
13793
|
+
}
|
|
13794
|
+
function isOpenAIImagePricingSize(size) {
|
|
13795
|
+
return OPENAI_IMAGE_PRICING_SIZES.includes(size);
|
|
13796
|
+
}
|
|
13797
|
+
function resolveImagePricingQuality(quality) {
|
|
13798
|
+
if (quality === 'low' || quality === 'medium' || quality === 'high') {
|
|
13799
|
+
return quality;
|
|
13800
|
+
}
|
|
13801
|
+
return DEFAULT_IMAGE_PRICING_QUALITY;
|
|
13802
|
+
}
|
|
13803
|
+
function resolveImagePricingSize(size) {
|
|
13804
|
+
if (typeof size === 'string' && isOpenAIImagePricingSize(size)) {
|
|
13805
|
+
return size;
|
|
13806
|
+
}
|
|
13807
|
+
return DEFAULT_IMAGE_PRICING_SIZE;
|
|
13808
|
+
}
|
|
11709
13809
|
/**
|
|
11710
13810
|
* Calculates the cost of generating images using OpenAI's Images API.
|
|
11711
13811
|
*
|
|
11712
13812
|
* @param model The image generation model name.
|
|
11713
13813
|
* @param imageCount The number of images generated.
|
|
13814
|
+
* @param quality The requested image quality.
|
|
13815
|
+
* @param size The requested image size.
|
|
11714
13816
|
* @returns The cost of generating the images in USD.
|
|
11715
13817
|
*/
|
|
11716
|
-
function calculateImageCost(model, imageCount) {
|
|
13818
|
+
function calculateImageCost(model, imageCount, quality, size) {
|
|
11717
13819
|
if (typeof model !== 'string' || typeof imageCount !== 'number' || imageCount <= 0) {
|
|
11718
13820
|
return 0;
|
|
11719
13821
|
}
|
|
11720
|
-
|
|
11721
|
-
if (!costPerImage)
|
|
13822
|
+
if (!isPricedOpenAIImageModel(model))
|
|
11722
13823
|
return 0;
|
|
13824
|
+
const pricingQuality = resolveImagePricingQuality(quality);
|
|
13825
|
+
const pricingSize = resolveImagePricingSize(size);
|
|
13826
|
+
const costPerImage = openAiImageCostByQualityAndSize[model][pricingQuality][pricingSize];
|
|
11723
13827
|
return imageCount * costPerImage;
|
|
11724
13828
|
}
|
|
11725
13829
|
/**
|
|
@@ -12418,7 +14522,7 @@ async function makeLLMCall(input, options = {}) {
|
|
|
12418
14522
|
return await makeResponsesAPICall(processedInput, responsesOptions);
|
|
12419
14523
|
}
|
|
12420
14524
|
|
|
12421
|
-
const DEFAULT_IMAGE_MODEL = 'gpt-image-
|
|
14525
|
+
const DEFAULT_IMAGE_MODEL = 'gpt-image-2';
|
|
12422
14526
|
const resolveImageModel = (model) => model ?? DEFAULT_IMAGE_MODEL;
|
|
12423
14527
|
const MULTIMODAL_VISION_MODELS = new Set(OPENAI_MODELS);
|
|
12424
14528
|
/**
|
|
@@ -12507,7 +14611,7 @@ async function makeImagesCall(prompt, options = {}) {
|
|
|
12507
14611
|
throw new Error('No images returned from OpenAI Images API');
|
|
12508
14612
|
}
|
|
12509
14613
|
// Calculate cost
|
|
12510
|
-
const cost = calculateImageCost(imageModel, count || 1);
|
|
14614
|
+
const cost = calculateImageCost(imageModel, count || 1, quality, size);
|
|
12511
14615
|
// Return the response with enhanced usage information
|
|
12512
14616
|
const enhancedResponse = {
|
|
12513
14617
|
...response,
|
|
@@ -21562,5 +23666,5 @@ const disco = {
|
|
|
21562
23666
|
},
|
|
21563
23667
|
};
|
|
21564
23668
|
|
|
21565
|
-
export { AlpacaMarketDataAPI, AlpacaTradingAPI, OPENAI_MODELS, disco, isOpenAIModel, isOpenRouterModel, supportsTemperature };
|
|
23669
|
+
export { AlpacaMarketDataAPI, AlpacaTradingAPI, OPENAI_IMAGE_MODELS, OPENAI_MODELS, OPENROUTER_MODELS, disco, isOpenAIImageModel, isOpenAIModel, isOpenRouterModel, supportsTemperature };
|
|
21566
23670
|
//# sourceMappingURL=index.mjs.map
|