@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-frontend.mjs
CHANGED
|
@@ -21,38 +21,63 @@ const OPENAI_MODELS = [
|
|
|
21
21
|
function isOpenAIModel(model) {
|
|
22
22
|
return OPENAI_MODELS.includes(model);
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Represents OpenAI image models.
|
|
26
|
+
*/
|
|
27
|
+
const OPENAI_IMAGE_MODELS = [
|
|
28
|
+
'gpt-image-2',
|
|
29
|
+
'gpt-image-2-2026-04-21',
|
|
30
|
+
'gpt-image-1.5',
|
|
31
|
+
'gpt-image-1',
|
|
32
|
+
'gpt-image-1-mini',
|
|
33
|
+
'chatgpt-image-latest',
|
|
34
|
+
'dall-e-2',
|
|
35
|
+
'dall-e-3',
|
|
36
|
+
];
|
|
37
|
+
/**
|
|
38
|
+
* Type guard to check if a model is a supported OpenAI image model.
|
|
39
|
+
*/
|
|
40
|
+
function isOpenAIImageModel(model) {
|
|
41
|
+
return OPENAI_IMAGE_MODELS.includes(model);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Represents OpenRouter models
|
|
45
|
+
*/
|
|
46
|
+
const OPENROUTER_MODELS = [
|
|
47
|
+
'openai/gpt-5',
|
|
48
|
+
'openai/gpt-5-mini',
|
|
49
|
+
'openai/gpt-5.4-mini',
|
|
50
|
+
'openai/gpt-5-nano',
|
|
51
|
+
'openai/gpt-5.1',
|
|
52
|
+
'openai/gpt-5.4',
|
|
53
|
+
'openai/gpt-5.4-pro',
|
|
54
|
+
'openai/gpt-5.5',
|
|
55
|
+
'openai/gpt-5.5-pro',
|
|
56
|
+
'openai/gpt-5.2',
|
|
57
|
+
'openai/gpt-5.2-pro',
|
|
58
|
+
'openai/gpt-5.1-codex',
|
|
59
|
+
'openai/gpt-5.1-codex-max',
|
|
60
|
+
'openai/gpt-oss-120b',
|
|
61
|
+
'z.ai/glm-4.5',
|
|
62
|
+
'z.ai/glm-4.5-air',
|
|
63
|
+
'google/gemini-2.5-flash',
|
|
64
|
+
'google/gemini-2.5-flash-lite',
|
|
65
|
+
'deepseek/deepseek-r1-0528',
|
|
66
|
+
'deepseek/deepseek-chat-v3-0324',
|
|
67
|
+
];
|
|
24
68
|
/**
|
|
25
69
|
* Type guard to check if a model is an OpenRouter model
|
|
26
70
|
*/
|
|
27
71
|
function isOpenRouterModel(model) {
|
|
28
|
-
|
|
29
|
-
'openai/gpt-5',
|
|
30
|
-
'openai/gpt-5-mini',
|
|
31
|
-
'openai/gpt-5.4-mini',
|
|
32
|
-
'openai/gpt-5-nano',
|
|
33
|
-
'openai/gpt-5.1',
|
|
34
|
-
'openai/gpt-5.4',
|
|
35
|
-
'openai/gpt-5.4-pro',
|
|
36
|
-
'openai/gpt-5.5',
|
|
37
|
-
'openai/gpt-5.5-pro',
|
|
38
|
-
'openai/gpt-5.2',
|
|
39
|
-
'openai/gpt-5.2-pro',
|
|
40
|
-
'openai/gpt-5.1-codex',
|
|
41
|
-
'openai/gpt-5.1-codex-max',
|
|
42
|
-
'openai/gpt-oss-120b',
|
|
43
|
-
'z.ai/glm-4.5',
|
|
44
|
-
'z.ai/glm-4.5-air',
|
|
45
|
-
'google/gemini-2.5-flash',
|
|
46
|
-
'google/gemini-2.5-flash-lite',
|
|
47
|
-
'deepseek/deepseek-r1-0528',
|
|
48
|
-
'deepseek/deepseek-chat-v3-0324',
|
|
49
|
-
];
|
|
50
|
-
return openRouterModels.includes(model);
|
|
72
|
+
return OPENROUTER_MODELS.includes(model);
|
|
51
73
|
}
|
|
52
74
|
|
|
53
75
|
var Types = /*#__PURE__*/Object.freeze({
|
|
54
76
|
__proto__: null,
|
|
77
|
+
OPENAI_IMAGE_MODELS: OPENAI_IMAGE_MODELS,
|
|
55
78
|
OPENAI_MODELS: OPENAI_MODELS,
|
|
79
|
+
OPENROUTER_MODELS: OPENROUTER_MODELS,
|
|
80
|
+
isOpenAIImageModel: isOpenAIImageModel,
|
|
56
81
|
isOpenAIModel: isOpenAIModel,
|
|
57
82
|
isOpenRouterModel: isOpenRouterModel
|
|
58
83
|
});
|
|
@@ -319,7 +344,7 @@ const safeJSON = (text) => {
|
|
|
319
344
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
320
345
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
321
346
|
|
|
322
|
-
const VERSION = '6.
|
|
347
|
+
const VERSION = '6.37.0'; // x-release-please-version
|
|
323
348
|
|
|
324
349
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
325
350
|
const isRunningInBrowser = () => {
|
|
@@ -1139,6 +1164,8 @@ const formatRequestDetails = (details) => {
|
|
|
1139
1164
|
details.headers = Object.fromEntries((details.headers instanceof Headers ? [...details.headers] : Object.entries(details.headers)).map(([name, value]) => [
|
|
1140
1165
|
name,
|
|
1141
1166
|
(name.toLowerCase() === 'authorization' ||
|
|
1167
|
+
name.toLowerCase() === 'api-key' ||
|
|
1168
|
+
name.toLowerCase() === 'x-api-key' ||
|
|
1142
1169
|
name.toLowerCase() === 'cookie' ||
|
|
1143
1170
|
name.toLowerCase() === 'set-cookie') ?
|
|
1144
1171
|
'***'
|
|
@@ -1699,6 +1726,36 @@ class ConversationCursorPage extends AbstractPage {
|
|
|
1699
1726
|
};
|
|
1700
1727
|
}
|
|
1701
1728
|
}
|
|
1729
|
+
class NextCursorPage extends AbstractPage {
|
|
1730
|
+
constructor(client, response, body, options) {
|
|
1731
|
+
super(client, response, body, options);
|
|
1732
|
+
this.data = body.data || [];
|
|
1733
|
+
this.has_more = body.has_more || false;
|
|
1734
|
+
this.next = body.next || null;
|
|
1735
|
+
}
|
|
1736
|
+
getPaginatedItems() {
|
|
1737
|
+
return this.data ?? [];
|
|
1738
|
+
}
|
|
1739
|
+
hasNextPage() {
|
|
1740
|
+
if (this.has_more === false) {
|
|
1741
|
+
return false;
|
|
1742
|
+
}
|
|
1743
|
+
return super.hasNextPage();
|
|
1744
|
+
}
|
|
1745
|
+
nextPageRequestOptions() {
|
|
1746
|
+
const cursor = this.next;
|
|
1747
|
+
if (!cursor) {
|
|
1748
|
+
return null;
|
|
1749
|
+
}
|
|
1750
|
+
return {
|
|
1751
|
+
...this.options,
|
|
1752
|
+
query: {
|
|
1753
|
+
...maybeObj(this.options.query),
|
|
1754
|
+
after: cursor,
|
|
1755
|
+
},
|
|
1756
|
+
};
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1702
1759
|
|
|
1703
1760
|
const SUBJECT_TOKEN_TYPES = {
|
|
1704
1761
|
jwt: 'urn:ietf:params:oauth:token-type:jwt',
|
|
@@ -2101,7 +2158,7 @@ let Messages$1 = class Messages extends APIResource {
|
|
|
2101
2158
|
* ```
|
|
2102
2159
|
*/
|
|
2103
2160
|
list(completionID, query = {}, options) {
|
|
2104
|
-
return this._client.getAPIList(path `/chat/completions/${completionID}/messages`, (CursorPage), { query, ...options });
|
|
2161
|
+
return this._client.getAPIList(path `/chat/completions/${completionID}/messages`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
2105
2162
|
}
|
|
2106
2163
|
};
|
|
2107
2164
|
|
|
@@ -3447,123 +3504,1775 @@ class ChatCompletionStreamingRunner extends ChatCompletionStream {
|
|
|
3447
3504
|
runner._run(() => runner._fromReadableStream(stream));
|
|
3448
3505
|
return runner;
|
|
3449
3506
|
}
|
|
3450
|
-
static runTools(client, params, options) {
|
|
3451
|
-
const runner = new ChatCompletionStreamingRunner(
|
|
3452
|
-
// @ts-expect-error TODO these types are incompatible
|
|
3453
|
-
params);
|
|
3454
|
-
const opts = {
|
|
3507
|
+
static runTools(client, params, options) {
|
|
3508
|
+
const runner = new ChatCompletionStreamingRunner(
|
|
3509
|
+
// @ts-expect-error TODO these types are incompatible
|
|
3510
|
+
params);
|
|
3511
|
+
const opts = {
|
|
3512
|
+
...options,
|
|
3513
|
+
headers: { ...options?.headers, 'X-Stainless-Helper-Method': 'runTools' },
|
|
3514
|
+
};
|
|
3515
|
+
runner._run(() => runner._runTools(client, params, opts));
|
|
3516
|
+
return runner;
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
|
|
3520
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3521
|
+
/**
|
|
3522
|
+
* Given a list of messages comprising a conversation, the model will return a response.
|
|
3523
|
+
*/
|
|
3524
|
+
let Completions$1 = class Completions extends APIResource {
|
|
3525
|
+
constructor() {
|
|
3526
|
+
super(...arguments);
|
|
3527
|
+
this.messages = new Messages$1(this._client);
|
|
3528
|
+
}
|
|
3529
|
+
create(body, options) {
|
|
3530
|
+
return this._client.post('/chat/completions', {
|
|
3531
|
+
body,
|
|
3532
|
+
...options,
|
|
3533
|
+
stream: body.stream ?? false,
|
|
3534
|
+
__security: { bearerAuth: true },
|
|
3535
|
+
});
|
|
3536
|
+
}
|
|
3537
|
+
/**
|
|
3538
|
+
* Get a stored chat completion. Only Chat Completions that have been created with
|
|
3539
|
+
* the `store` parameter set to `true` will be returned.
|
|
3540
|
+
*
|
|
3541
|
+
* @example
|
|
3542
|
+
* ```ts
|
|
3543
|
+
* const chatCompletion =
|
|
3544
|
+
* await client.chat.completions.retrieve('completion_id');
|
|
3545
|
+
* ```
|
|
3546
|
+
*/
|
|
3547
|
+
retrieve(completionID, options) {
|
|
3548
|
+
return this._client.get(path `/chat/completions/${completionID}`, {
|
|
3549
|
+
...options,
|
|
3550
|
+
__security: { bearerAuth: true },
|
|
3551
|
+
});
|
|
3552
|
+
}
|
|
3553
|
+
/**
|
|
3554
|
+
* Modify a stored chat completion. Only Chat Completions that have been created
|
|
3555
|
+
* with the `store` parameter set to `true` can be modified. Currently, the only
|
|
3556
|
+
* supported modification is to update the `metadata` field.
|
|
3557
|
+
*
|
|
3558
|
+
* @example
|
|
3559
|
+
* ```ts
|
|
3560
|
+
* const chatCompletion = await client.chat.completions.update(
|
|
3561
|
+
* 'completion_id',
|
|
3562
|
+
* { metadata: { foo: 'string' } },
|
|
3563
|
+
* );
|
|
3564
|
+
* ```
|
|
3565
|
+
*/
|
|
3566
|
+
update(completionID, body, options) {
|
|
3567
|
+
return this._client.post(path `/chat/completions/${completionID}`, {
|
|
3568
|
+
body,
|
|
3569
|
+
...options,
|
|
3570
|
+
__security: { bearerAuth: true },
|
|
3571
|
+
});
|
|
3572
|
+
}
|
|
3573
|
+
/**
|
|
3574
|
+
* List stored Chat Completions. Only Chat Completions that have been stored with
|
|
3575
|
+
* the `store` parameter set to `true` will be returned.
|
|
3576
|
+
*
|
|
3577
|
+
* @example
|
|
3578
|
+
* ```ts
|
|
3579
|
+
* // Automatically fetches more pages as needed.
|
|
3580
|
+
* for await (const chatCompletion of client.chat.completions.list()) {
|
|
3581
|
+
* // ...
|
|
3582
|
+
* }
|
|
3583
|
+
* ```
|
|
3584
|
+
*/
|
|
3585
|
+
list(query = {}, options) {
|
|
3586
|
+
return this._client.getAPIList('/chat/completions', (CursorPage), {
|
|
3587
|
+
query,
|
|
3588
|
+
...options,
|
|
3589
|
+
__security: { bearerAuth: true },
|
|
3590
|
+
});
|
|
3591
|
+
}
|
|
3592
|
+
/**
|
|
3593
|
+
* Delete a stored chat completion. Only Chat Completions that have been created
|
|
3594
|
+
* with the `store` parameter set to `true` can be deleted.
|
|
3595
|
+
*
|
|
3596
|
+
* @example
|
|
3597
|
+
* ```ts
|
|
3598
|
+
* const chatCompletionDeleted =
|
|
3599
|
+
* await client.chat.completions.delete('completion_id');
|
|
3600
|
+
* ```
|
|
3601
|
+
*/
|
|
3602
|
+
delete(completionID, options) {
|
|
3603
|
+
return this._client.delete(path `/chat/completions/${completionID}`, {
|
|
3604
|
+
...options,
|
|
3605
|
+
__security: { bearerAuth: true },
|
|
3606
|
+
});
|
|
3607
|
+
}
|
|
3608
|
+
parse(body, options) {
|
|
3609
|
+
validateInputTools(body.tools);
|
|
3610
|
+
return this._client.chat.completions
|
|
3611
|
+
.create(body, {
|
|
3612
|
+
...options,
|
|
3613
|
+
headers: {
|
|
3614
|
+
...options?.headers,
|
|
3615
|
+
'X-Stainless-Helper-Method': 'chat.completions.parse',
|
|
3616
|
+
},
|
|
3617
|
+
})
|
|
3618
|
+
._thenUnwrap((completion) => parseChatCompletion(completion, body));
|
|
3619
|
+
}
|
|
3620
|
+
runTools(body, options) {
|
|
3621
|
+
if (body.stream) {
|
|
3622
|
+
return ChatCompletionStreamingRunner.runTools(this._client, body, options);
|
|
3623
|
+
}
|
|
3624
|
+
return ChatCompletionRunner.runTools(this._client, body, options);
|
|
3625
|
+
}
|
|
3626
|
+
/**
|
|
3627
|
+
* Creates a chat completion stream
|
|
3628
|
+
*/
|
|
3629
|
+
stream(body, options) {
|
|
3630
|
+
return ChatCompletionStream.createChatCompletion(this._client, body, options);
|
|
3631
|
+
}
|
|
3632
|
+
};
|
|
3633
|
+
Completions$1.Messages = Messages$1;
|
|
3634
|
+
|
|
3635
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3636
|
+
class Chat extends APIResource {
|
|
3637
|
+
constructor() {
|
|
3638
|
+
super(...arguments);
|
|
3639
|
+
this.completions = new Completions$1(this._client);
|
|
3640
|
+
}
|
|
3641
|
+
}
|
|
3642
|
+
Chat.Completions = Completions$1;
|
|
3643
|
+
|
|
3644
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3645
|
+
class AdminAPIKeys extends APIResource {
|
|
3646
|
+
/**
|
|
3647
|
+
* Create an organization admin API key
|
|
3648
|
+
*
|
|
3649
|
+
* @example
|
|
3650
|
+
* ```ts
|
|
3651
|
+
* const adminAPIKey =
|
|
3652
|
+
* await client.admin.organization.adminAPIKeys.create({
|
|
3653
|
+
* name: 'New Admin Key',
|
|
3654
|
+
* });
|
|
3655
|
+
* ```
|
|
3656
|
+
*/
|
|
3657
|
+
create(body, options) {
|
|
3658
|
+
return this._client.post('/organization/admin_api_keys', {
|
|
3659
|
+
body,
|
|
3660
|
+
...options,
|
|
3661
|
+
__security: { adminAPIKeyAuth: true },
|
|
3662
|
+
});
|
|
3663
|
+
}
|
|
3664
|
+
/**
|
|
3665
|
+
* Retrieve a single organization API key
|
|
3666
|
+
*
|
|
3667
|
+
* @example
|
|
3668
|
+
* ```ts
|
|
3669
|
+
* const adminAPIKey =
|
|
3670
|
+
* await client.admin.organization.adminAPIKeys.retrieve(
|
|
3671
|
+
* 'key_id',
|
|
3672
|
+
* );
|
|
3673
|
+
* ```
|
|
3674
|
+
*/
|
|
3675
|
+
retrieve(keyID, options) {
|
|
3676
|
+
return this._client.get(path `/organization/admin_api_keys/${keyID}`, {
|
|
3677
|
+
...options,
|
|
3678
|
+
__security: { adminAPIKeyAuth: true },
|
|
3679
|
+
});
|
|
3680
|
+
}
|
|
3681
|
+
/**
|
|
3682
|
+
* List organization API keys
|
|
3683
|
+
*
|
|
3684
|
+
* @example
|
|
3685
|
+
* ```ts
|
|
3686
|
+
* // Automatically fetches more pages as needed.
|
|
3687
|
+
* for await (const adminAPIKey of client.admin.organization.adminAPIKeys.list()) {
|
|
3688
|
+
* // ...
|
|
3689
|
+
* }
|
|
3690
|
+
* ```
|
|
3691
|
+
*/
|
|
3692
|
+
list(query = {}, options) {
|
|
3693
|
+
return this._client.getAPIList('/organization/admin_api_keys', (CursorPage), {
|
|
3694
|
+
query,
|
|
3695
|
+
...options,
|
|
3696
|
+
__security: { adminAPIKeyAuth: true },
|
|
3697
|
+
});
|
|
3698
|
+
}
|
|
3699
|
+
/**
|
|
3700
|
+
* Delete an organization admin API key
|
|
3701
|
+
*
|
|
3702
|
+
* @example
|
|
3703
|
+
* ```ts
|
|
3704
|
+
* const adminAPIKey =
|
|
3705
|
+
* await client.admin.organization.adminAPIKeys.delete(
|
|
3706
|
+
* 'key_id',
|
|
3707
|
+
* );
|
|
3708
|
+
* ```
|
|
3709
|
+
*/
|
|
3710
|
+
delete(keyID, options) {
|
|
3711
|
+
return this._client.delete(path `/organization/admin_api_keys/${keyID}`, {
|
|
3712
|
+
...options,
|
|
3713
|
+
__security: { adminAPIKeyAuth: true },
|
|
3714
|
+
});
|
|
3715
|
+
}
|
|
3716
|
+
}
|
|
3717
|
+
|
|
3718
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3719
|
+
/**
|
|
3720
|
+
* List user actions and configuration changes within this organization.
|
|
3721
|
+
*/
|
|
3722
|
+
class AuditLogs extends APIResource {
|
|
3723
|
+
/**
|
|
3724
|
+
* List user actions and configuration changes within this organization.
|
|
3725
|
+
*
|
|
3726
|
+
* @example
|
|
3727
|
+
* ```ts
|
|
3728
|
+
* // Automatically fetches more pages as needed.
|
|
3729
|
+
* for await (const auditLogListResponse of client.admin.organization.auditLogs.list()) {
|
|
3730
|
+
* // ...
|
|
3731
|
+
* }
|
|
3732
|
+
* ```
|
|
3733
|
+
*/
|
|
3734
|
+
list(query = {}, options) {
|
|
3735
|
+
return this._client.getAPIList('/organization/audit_logs', (ConversationCursorPage), {
|
|
3736
|
+
query,
|
|
3737
|
+
...options,
|
|
3738
|
+
__security: { adminAPIKeyAuth: true },
|
|
3739
|
+
});
|
|
3740
|
+
}
|
|
3741
|
+
}
|
|
3742
|
+
|
|
3743
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3744
|
+
let Certificates$1 = class Certificates extends APIResource {
|
|
3745
|
+
/**
|
|
3746
|
+
* Upload a certificate to the organization. This does **not** automatically
|
|
3747
|
+
* activate the certificate.
|
|
3748
|
+
*
|
|
3749
|
+
* Organizations can upload up to 50 certificates.
|
|
3750
|
+
*
|
|
3751
|
+
* @example
|
|
3752
|
+
* ```ts
|
|
3753
|
+
* const certificate =
|
|
3754
|
+
* await client.admin.organization.certificates.create({
|
|
3755
|
+
* certificate: 'certificate',
|
|
3756
|
+
* });
|
|
3757
|
+
* ```
|
|
3758
|
+
*/
|
|
3759
|
+
create(body, options) {
|
|
3760
|
+
return this._client.post('/organization/certificates', {
|
|
3761
|
+
body,
|
|
3762
|
+
...options,
|
|
3763
|
+
__security: { adminAPIKeyAuth: true },
|
|
3764
|
+
});
|
|
3765
|
+
}
|
|
3766
|
+
/**
|
|
3767
|
+
* Get a certificate that has been uploaded to the organization.
|
|
3768
|
+
*
|
|
3769
|
+
* You can get a certificate regardless of whether it is active or not.
|
|
3770
|
+
*
|
|
3771
|
+
* @example
|
|
3772
|
+
* ```ts
|
|
3773
|
+
* const certificate =
|
|
3774
|
+
* await client.admin.organization.certificates.retrieve(
|
|
3775
|
+
* 'certificate_id',
|
|
3776
|
+
* );
|
|
3777
|
+
* ```
|
|
3778
|
+
*/
|
|
3779
|
+
retrieve(certificateID, query = {}, options) {
|
|
3780
|
+
return this._client.get(path `/organization/certificates/${certificateID}`, {
|
|
3781
|
+
query,
|
|
3782
|
+
...options,
|
|
3783
|
+
__security: { adminAPIKeyAuth: true },
|
|
3784
|
+
});
|
|
3785
|
+
}
|
|
3786
|
+
/**
|
|
3787
|
+
* Modify a certificate. Note that only the name can be modified.
|
|
3788
|
+
*
|
|
3789
|
+
* @example
|
|
3790
|
+
* ```ts
|
|
3791
|
+
* const certificate =
|
|
3792
|
+
* await client.admin.organization.certificates.update(
|
|
3793
|
+
* 'certificate_id',
|
|
3794
|
+
* );
|
|
3795
|
+
* ```
|
|
3796
|
+
*/
|
|
3797
|
+
update(certificateID, body, options) {
|
|
3798
|
+
return this._client.post(path `/organization/certificates/${certificateID}`, {
|
|
3799
|
+
body,
|
|
3800
|
+
...options,
|
|
3801
|
+
__security: { adminAPIKeyAuth: true },
|
|
3802
|
+
});
|
|
3803
|
+
}
|
|
3804
|
+
/**
|
|
3805
|
+
* List uploaded certificates for this organization.
|
|
3806
|
+
*
|
|
3807
|
+
* @example
|
|
3808
|
+
* ```ts
|
|
3809
|
+
* // Automatically fetches more pages as needed.
|
|
3810
|
+
* for await (const certificateListResponse of client.admin.organization.certificates.list()) {
|
|
3811
|
+
* // ...
|
|
3812
|
+
* }
|
|
3813
|
+
* ```
|
|
3814
|
+
*/
|
|
3815
|
+
list(query = {}, options) {
|
|
3816
|
+
return this._client.getAPIList('/organization/certificates', (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
3817
|
+
}
|
|
3818
|
+
/**
|
|
3819
|
+
* Delete a certificate from the organization.
|
|
3820
|
+
*
|
|
3821
|
+
* The certificate must be inactive for the organization and all projects.
|
|
3822
|
+
*
|
|
3823
|
+
* @example
|
|
3824
|
+
* ```ts
|
|
3825
|
+
* const certificate =
|
|
3826
|
+
* await client.admin.organization.certificates.delete(
|
|
3827
|
+
* 'certificate_id',
|
|
3828
|
+
* );
|
|
3829
|
+
* ```
|
|
3830
|
+
*/
|
|
3831
|
+
delete(certificateID, options) {
|
|
3832
|
+
return this._client.delete(path `/organization/certificates/${certificateID}`, {
|
|
3833
|
+
...options,
|
|
3834
|
+
__security: { adminAPIKeyAuth: true },
|
|
3835
|
+
});
|
|
3836
|
+
}
|
|
3837
|
+
/**
|
|
3838
|
+
* Activate certificates at the organization level.
|
|
3839
|
+
*
|
|
3840
|
+
* You can atomically and idempotently activate up to 10 certificates at a time.
|
|
3841
|
+
*
|
|
3842
|
+
* @example
|
|
3843
|
+
* ```ts
|
|
3844
|
+
* // Automatically fetches more pages as needed.
|
|
3845
|
+
* for await (const certificateActivateResponse of client.admin.organization.certificates.activate(
|
|
3846
|
+
* { certificate_ids: ['cert_abc'] },
|
|
3847
|
+
* )) {
|
|
3848
|
+
* // ...
|
|
3849
|
+
* }
|
|
3850
|
+
* ```
|
|
3851
|
+
*/
|
|
3852
|
+
activate(body, options) {
|
|
3853
|
+
return this._client.getAPIList('/organization/certificates/activate', (Page), {
|
|
3854
|
+
body,
|
|
3855
|
+
method: 'post',
|
|
3856
|
+
...options,
|
|
3857
|
+
__security: { adminAPIKeyAuth: true },
|
|
3858
|
+
});
|
|
3859
|
+
}
|
|
3860
|
+
/**
|
|
3861
|
+
* Deactivate certificates at the organization level.
|
|
3862
|
+
*
|
|
3863
|
+
* You can atomically and idempotently deactivate up to 10 certificates at a time.
|
|
3864
|
+
*
|
|
3865
|
+
* @example
|
|
3866
|
+
* ```ts
|
|
3867
|
+
* // Automatically fetches more pages as needed.
|
|
3868
|
+
* for await (const certificateDeactivateResponse of client.admin.organization.certificates.deactivate(
|
|
3869
|
+
* { certificate_ids: ['cert_abc'] },
|
|
3870
|
+
* )) {
|
|
3871
|
+
* // ...
|
|
3872
|
+
* }
|
|
3873
|
+
* ```
|
|
3874
|
+
*/
|
|
3875
|
+
deactivate(body, options) {
|
|
3876
|
+
return this._client.getAPIList('/organization/certificates/deactivate', (Page), { body, method: 'post', ...options, __security: { adminAPIKeyAuth: true } });
|
|
3877
|
+
}
|
|
3878
|
+
};
|
|
3879
|
+
|
|
3880
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3881
|
+
class Invites extends APIResource {
|
|
3882
|
+
/**
|
|
3883
|
+
* Create an invite for a user to the organization. The invite must be accepted by
|
|
3884
|
+
* the user before they have access to the organization.
|
|
3885
|
+
*
|
|
3886
|
+
* @example
|
|
3887
|
+
* ```ts
|
|
3888
|
+
* const invite =
|
|
3889
|
+
* await client.admin.organization.invites.create({
|
|
3890
|
+
* email: 'email',
|
|
3891
|
+
* role: 'reader',
|
|
3892
|
+
* });
|
|
3893
|
+
* ```
|
|
3894
|
+
*/
|
|
3895
|
+
create(body, options) {
|
|
3896
|
+
return this._client.post('/organization/invites', {
|
|
3897
|
+
body,
|
|
3898
|
+
...options,
|
|
3899
|
+
__security: { adminAPIKeyAuth: true },
|
|
3900
|
+
});
|
|
3901
|
+
}
|
|
3902
|
+
/**
|
|
3903
|
+
* Retrieves an invite.
|
|
3904
|
+
*
|
|
3905
|
+
* @example
|
|
3906
|
+
* ```ts
|
|
3907
|
+
* const invite =
|
|
3908
|
+
* await client.admin.organization.invites.retrieve(
|
|
3909
|
+
* 'invite_id',
|
|
3910
|
+
* );
|
|
3911
|
+
* ```
|
|
3912
|
+
*/
|
|
3913
|
+
retrieve(inviteID, options) {
|
|
3914
|
+
return this._client.get(path `/organization/invites/${inviteID}`, {
|
|
3915
|
+
...options,
|
|
3916
|
+
__security: { adminAPIKeyAuth: true },
|
|
3917
|
+
});
|
|
3918
|
+
}
|
|
3919
|
+
/**
|
|
3920
|
+
* Returns a list of invites in the organization.
|
|
3921
|
+
*
|
|
3922
|
+
* @example
|
|
3923
|
+
* ```ts
|
|
3924
|
+
* // Automatically fetches more pages as needed.
|
|
3925
|
+
* for await (const invite of client.admin.organization.invites.list()) {
|
|
3926
|
+
* // ...
|
|
3927
|
+
* }
|
|
3928
|
+
* ```
|
|
3929
|
+
*/
|
|
3930
|
+
list(query = {}, options) {
|
|
3931
|
+
return this._client.getAPIList('/organization/invites', (ConversationCursorPage), {
|
|
3932
|
+
query,
|
|
3933
|
+
...options,
|
|
3934
|
+
__security: { adminAPIKeyAuth: true },
|
|
3935
|
+
});
|
|
3936
|
+
}
|
|
3937
|
+
/**
|
|
3938
|
+
* Delete an invite. If the invite has already been accepted, it cannot be deleted.
|
|
3939
|
+
*
|
|
3940
|
+
* @example
|
|
3941
|
+
* ```ts
|
|
3942
|
+
* const invite =
|
|
3943
|
+
* await client.admin.organization.invites.delete(
|
|
3944
|
+
* 'invite_id',
|
|
3945
|
+
* );
|
|
3946
|
+
* ```
|
|
3947
|
+
*/
|
|
3948
|
+
delete(inviteID, options) {
|
|
3949
|
+
return this._client.delete(path `/organization/invites/${inviteID}`, {
|
|
3950
|
+
...options,
|
|
3951
|
+
__security: { adminAPIKeyAuth: true },
|
|
3952
|
+
});
|
|
3953
|
+
}
|
|
3954
|
+
}
|
|
3955
|
+
|
|
3956
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3957
|
+
let Roles$5 = class Roles extends APIResource {
|
|
3958
|
+
/**
|
|
3959
|
+
* Creates a custom role for the organization.
|
|
3960
|
+
*
|
|
3961
|
+
* @example
|
|
3962
|
+
* ```ts
|
|
3963
|
+
* const role = await client.admin.organization.roles.create({
|
|
3964
|
+
* permissions: ['string'],
|
|
3965
|
+
* role_name: 'role_name',
|
|
3966
|
+
* });
|
|
3967
|
+
* ```
|
|
3968
|
+
*/
|
|
3969
|
+
create(body, options) {
|
|
3970
|
+
return this._client.post('/organization/roles', {
|
|
3971
|
+
body,
|
|
3972
|
+
...options,
|
|
3973
|
+
__security: { adminAPIKeyAuth: true },
|
|
3974
|
+
});
|
|
3975
|
+
}
|
|
3976
|
+
/**
|
|
3977
|
+
* Updates an existing organization role.
|
|
3978
|
+
*
|
|
3979
|
+
* @example
|
|
3980
|
+
* ```ts
|
|
3981
|
+
* const role = await client.admin.organization.roles.update(
|
|
3982
|
+
* 'role_id',
|
|
3983
|
+
* );
|
|
3984
|
+
* ```
|
|
3985
|
+
*/
|
|
3986
|
+
update(roleID, body, options) {
|
|
3987
|
+
return this._client.post(path `/organization/roles/${roleID}`, {
|
|
3988
|
+
body,
|
|
3989
|
+
...options,
|
|
3990
|
+
__security: { adminAPIKeyAuth: true },
|
|
3991
|
+
});
|
|
3992
|
+
}
|
|
3993
|
+
/**
|
|
3994
|
+
* Lists the roles configured for the organization.
|
|
3995
|
+
*
|
|
3996
|
+
* @example
|
|
3997
|
+
* ```ts
|
|
3998
|
+
* // Automatically fetches more pages as needed.
|
|
3999
|
+
* for await (const role of client.admin.organization.roles.list()) {
|
|
4000
|
+
* // ...
|
|
4001
|
+
* }
|
|
4002
|
+
* ```
|
|
4003
|
+
*/
|
|
4004
|
+
list(query = {}, options) {
|
|
4005
|
+
return this._client.getAPIList('/organization/roles', (NextCursorPage), {
|
|
4006
|
+
query,
|
|
4007
|
+
...options,
|
|
4008
|
+
__security: { adminAPIKeyAuth: true },
|
|
4009
|
+
});
|
|
4010
|
+
}
|
|
4011
|
+
/**
|
|
4012
|
+
* Deletes a custom role from the organization.
|
|
4013
|
+
*
|
|
4014
|
+
* @example
|
|
4015
|
+
* ```ts
|
|
4016
|
+
* const role = await client.admin.organization.roles.delete(
|
|
4017
|
+
* 'role_id',
|
|
4018
|
+
* );
|
|
4019
|
+
* ```
|
|
4020
|
+
*/
|
|
4021
|
+
delete(roleID, options) {
|
|
4022
|
+
return this._client.delete(path `/organization/roles/${roleID}`, {
|
|
4023
|
+
...options,
|
|
4024
|
+
__security: { adminAPIKeyAuth: true },
|
|
4025
|
+
});
|
|
4026
|
+
}
|
|
4027
|
+
};
|
|
4028
|
+
|
|
4029
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4030
|
+
class Usage extends APIResource {
|
|
4031
|
+
/**
|
|
4032
|
+
* Get audio speeches usage details for the organization.
|
|
4033
|
+
*
|
|
4034
|
+
* @example
|
|
4035
|
+
* ```ts
|
|
4036
|
+
* const response =
|
|
4037
|
+
* await client.admin.organization.usage.audioSpeeches({
|
|
4038
|
+
* start_time: 0,
|
|
4039
|
+
* });
|
|
4040
|
+
* ```
|
|
4041
|
+
*/
|
|
4042
|
+
audioSpeeches(query, options) {
|
|
4043
|
+
return this._client.get('/organization/usage/audio_speeches', {
|
|
4044
|
+
query,
|
|
4045
|
+
...options,
|
|
4046
|
+
__security: { adminAPIKeyAuth: true },
|
|
4047
|
+
});
|
|
4048
|
+
}
|
|
4049
|
+
/**
|
|
4050
|
+
* Get audio transcriptions usage details for the organization.
|
|
4051
|
+
*
|
|
4052
|
+
* @example
|
|
4053
|
+
* ```ts
|
|
4054
|
+
* const response =
|
|
4055
|
+
* await client.admin.organization.usage.audioTranscriptions(
|
|
4056
|
+
* { start_time: 0 },
|
|
4057
|
+
* );
|
|
4058
|
+
* ```
|
|
4059
|
+
*/
|
|
4060
|
+
audioTranscriptions(query, options) {
|
|
4061
|
+
return this._client.get('/organization/usage/audio_transcriptions', {
|
|
4062
|
+
query,
|
|
4063
|
+
...options,
|
|
4064
|
+
__security: { adminAPIKeyAuth: true },
|
|
4065
|
+
});
|
|
4066
|
+
}
|
|
4067
|
+
/**
|
|
4068
|
+
* Get code interpreter sessions usage details for the organization.
|
|
4069
|
+
*
|
|
4070
|
+
* @example
|
|
4071
|
+
* ```ts
|
|
4072
|
+
* const response =
|
|
4073
|
+
* await client.admin.organization.usage.codeInterpreterSessions(
|
|
4074
|
+
* { start_time: 0 },
|
|
4075
|
+
* );
|
|
4076
|
+
* ```
|
|
4077
|
+
*/
|
|
4078
|
+
codeInterpreterSessions(query, options) {
|
|
4079
|
+
return this._client.get('/organization/usage/code_interpreter_sessions', {
|
|
4080
|
+
query,
|
|
4081
|
+
...options,
|
|
4082
|
+
__security: { adminAPIKeyAuth: true },
|
|
4083
|
+
});
|
|
4084
|
+
}
|
|
4085
|
+
/**
|
|
4086
|
+
* Get completions usage details for the organization.
|
|
4087
|
+
*
|
|
4088
|
+
* @example
|
|
4089
|
+
* ```ts
|
|
4090
|
+
* const response =
|
|
4091
|
+
* await client.admin.organization.usage.completions({
|
|
4092
|
+
* start_time: 0,
|
|
4093
|
+
* });
|
|
4094
|
+
* ```
|
|
4095
|
+
*/
|
|
4096
|
+
completions(query, options) {
|
|
4097
|
+
return this._client.get('/organization/usage/completions', {
|
|
4098
|
+
query,
|
|
4099
|
+
...options,
|
|
4100
|
+
__security: { adminAPIKeyAuth: true },
|
|
4101
|
+
});
|
|
4102
|
+
}
|
|
4103
|
+
/**
|
|
4104
|
+
* Get costs details for the organization.
|
|
4105
|
+
*
|
|
4106
|
+
* @example
|
|
4107
|
+
* ```ts
|
|
4108
|
+
* const response =
|
|
4109
|
+
* await client.admin.organization.usage.costs({
|
|
4110
|
+
* start_time: 0,
|
|
4111
|
+
* });
|
|
4112
|
+
* ```
|
|
4113
|
+
*/
|
|
4114
|
+
costs(query, options) {
|
|
4115
|
+
return this._client.get('/organization/costs', {
|
|
4116
|
+
query,
|
|
4117
|
+
...options,
|
|
4118
|
+
__security: { adminAPIKeyAuth: true },
|
|
4119
|
+
});
|
|
4120
|
+
}
|
|
4121
|
+
/**
|
|
4122
|
+
* Get embeddings usage details for the organization.
|
|
4123
|
+
*
|
|
4124
|
+
* @example
|
|
4125
|
+
* ```ts
|
|
4126
|
+
* const response =
|
|
4127
|
+
* await client.admin.organization.usage.embeddings({
|
|
4128
|
+
* start_time: 0,
|
|
4129
|
+
* });
|
|
4130
|
+
* ```
|
|
4131
|
+
*/
|
|
4132
|
+
embeddings(query, options) {
|
|
4133
|
+
return this._client.get('/organization/usage/embeddings', {
|
|
4134
|
+
query,
|
|
4135
|
+
...options,
|
|
4136
|
+
__security: { adminAPIKeyAuth: true },
|
|
4137
|
+
});
|
|
4138
|
+
}
|
|
4139
|
+
/**
|
|
4140
|
+
* Get images usage details for the organization.
|
|
4141
|
+
*
|
|
4142
|
+
* @example
|
|
4143
|
+
* ```ts
|
|
4144
|
+
* const response =
|
|
4145
|
+
* await client.admin.organization.usage.images({
|
|
4146
|
+
* start_time: 0,
|
|
4147
|
+
* });
|
|
4148
|
+
* ```
|
|
4149
|
+
*/
|
|
4150
|
+
images(query, options) {
|
|
4151
|
+
return this._client.get('/organization/usage/images', {
|
|
4152
|
+
query,
|
|
4153
|
+
...options,
|
|
4154
|
+
__security: { adminAPIKeyAuth: true },
|
|
4155
|
+
});
|
|
4156
|
+
}
|
|
4157
|
+
/**
|
|
4158
|
+
* Get moderations usage details for the organization.
|
|
4159
|
+
*
|
|
4160
|
+
* @example
|
|
4161
|
+
* ```ts
|
|
4162
|
+
* const response =
|
|
4163
|
+
* await client.admin.organization.usage.moderations({
|
|
4164
|
+
* start_time: 0,
|
|
4165
|
+
* });
|
|
4166
|
+
* ```
|
|
4167
|
+
*/
|
|
4168
|
+
moderations(query, options) {
|
|
4169
|
+
return this._client.get('/organization/usage/moderations', {
|
|
4170
|
+
query,
|
|
4171
|
+
...options,
|
|
4172
|
+
__security: { adminAPIKeyAuth: true },
|
|
4173
|
+
});
|
|
4174
|
+
}
|
|
4175
|
+
/**
|
|
4176
|
+
* Get vector stores usage details for the organization.
|
|
4177
|
+
*
|
|
4178
|
+
* @example
|
|
4179
|
+
* ```ts
|
|
4180
|
+
* const response =
|
|
4181
|
+
* await client.admin.organization.usage.vectorStores({
|
|
4182
|
+
* start_time: 0,
|
|
4183
|
+
* });
|
|
4184
|
+
* ```
|
|
4185
|
+
*/
|
|
4186
|
+
vectorStores(query, options) {
|
|
4187
|
+
return this._client.get('/organization/usage/vector_stores', {
|
|
4188
|
+
query,
|
|
4189
|
+
...options,
|
|
4190
|
+
__security: { adminAPIKeyAuth: true },
|
|
4191
|
+
});
|
|
4192
|
+
}
|
|
4193
|
+
}
|
|
4194
|
+
|
|
4195
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4196
|
+
let Roles$4 = class Roles extends APIResource {
|
|
4197
|
+
/**
|
|
4198
|
+
* Assigns an organization role to a group within the organization.
|
|
4199
|
+
*
|
|
4200
|
+
* @example
|
|
4201
|
+
* ```ts
|
|
4202
|
+
* const role =
|
|
4203
|
+
* await client.admin.organization.groups.roles.create(
|
|
4204
|
+
* 'group_id',
|
|
4205
|
+
* { role_id: 'role_id' },
|
|
4206
|
+
* );
|
|
4207
|
+
* ```
|
|
4208
|
+
*/
|
|
4209
|
+
create(groupID, body, options) {
|
|
4210
|
+
return this._client.post(path `/organization/groups/${groupID}/roles`, {
|
|
4211
|
+
body,
|
|
4212
|
+
...options,
|
|
4213
|
+
__security: { adminAPIKeyAuth: true },
|
|
4214
|
+
});
|
|
4215
|
+
}
|
|
4216
|
+
/**
|
|
4217
|
+
* Lists the organization roles assigned to a group within the organization.
|
|
4218
|
+
*
|
|
4219
|
+
* @example
|
|
4220
|
+
* ```ts
|
|
4221
|
+
* // Automatically fetches more pages as needed.
|
|
4222
|
+
* for await (const roleListResponse of client.admin.organization.groups.roles.list(
|
|
4223
|
+
* 'group_id',
|
|
4224
|
+
* )) {
|
|
4225
|
+
* // ...
|
|
4226
|
+
* }
|
|
4227
|
+
* ```
|
|
4228
|
+
*/
|
|
4229
|
+
list(groupID, query = {}, options) {
|
|
4230
|
+
return this._client.getAPIList(path `/organization/groups/${groupID}/roles`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
4231
|
+
}
|
|
4232
|
+
/**
|
|
4233
|
+
* Unassigns an organization role from a group within the organization.
|
|
4234
|
+
*
|
|
4235
|
+
* @example
|
|
4236
|
+
* ```ts
|
|
4237
|
+
* const role =
|
|
4238
|
+
* await client.admin.organization.groups.roles.delete(
|
|
4239
|
+
* 'role_id',
|
|
4240
|
+
* { group_id: 'group_id' },
|
|
4241
|
+
* );
|
|
4242
|
+
* ```
|
|
4243
|
+
*/
|
|
4244
|
+
delete(roleID, params, options) {
|
|
4245
|
+
const { group_id } = params;
|
|
4246
|
+
return this._client.delete(path `/organization/groups/${group_id}/roles/${roleID}`, {
|
|
4247
|
+
...options,
|
|
4248
|
+
__security: { adminAPIKeyAuth: true },
|
|
4249
|
+
});
|
|
4250
|
+
}
|
|
4251
|
+
};
|
|
4252
|
+
|
|
4253
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4254
|
+
let Users$2 = class Users extends APIResource {
|
|
4255
|
+
/**
|
|
4256
|
+
* Adds a user to a group.
|
|
4257
|
+
*
|
|
4258
|
+
* @example
|
|
4259
|
+
* ```ts
|
|
4260
|
+
* const user =
|
|
4261
|
+
* await client.admin.organization.groups.users.create(
|
|
4262
|
+
* 'group_id',
|
|
4263
|
+
* { user_id: 'user_id' },
|
|
4264
|
+
* );
|
|
4265
|
+
* ```
|
|
4266
|
+
*/
|
|
4267
|
+
create(groupID, body, options) {
|
|
4268
|
+
return this._client.post(path `/organization/groups/${groupID}/users`, {
|
|
4269
|
+
body,
|
|
4270
|
+
...options,
|
|
4271
|
+
__security: { adminAPIKeyAuth: true },
|
|
4272
|
+
});
|
|
4273
|
+
}
|
|
4274
|
+
/**
|
|
4275
|
+
* Lists the users assigned to a group.
|
|
4276
|
+
*
|
|
4277
|
+
* @example
|
|
4278
|
+
* ```ts
|
|
4279
|
+
* // Automatically fetches more pages as needed.
|
|
4280
|
+
* for await (const organizationGroupUser of client.admin.organization.groups.users.list(
|
|
4281
|
+
* 'group_id',
|
|
4282
|
+
* )) {
|
|
4283
|
+
* // ...
|
|
4284
|
+
* }
|
|
4285
|
+
* ```
|
|
4286
|
+
*/
|
|
4287
|
+
list(groupID, query = {}, options) {
|
|
4288
|
+
return this._client.getAPIList(path `/organization/groups/${groupID}/users`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
4289
|
+
}
|
|
4290
|
+
/**
|
|
4291
|
+
* Removes a user from a group.
|
|
4292
|
+
*
|
|
4293
|
+
* @example
|
|
4294
|
+
* ```ts
|
|
4295
|
+
* const user =
|
|
4296
|
+
* await client.admin.organization.groups.users.delete(
|
|
4297
|
+
* 'user_id',
|
|
4298
|
+
* { group_id: 'group_id' },
|
|
4299
|
+
* );
|
|
4300
|
+
* ```
|
|
4301
|
+
*/
|
|
4302
|
+
delete(userID, params, options) {
|
|
4303
|
+
const { group_id } = params;
|
|
4304
|
+
return this._client.delete(path `/organization/groups/${group_id}/users/${userID}`, {
|
|
4305
|
+
...options,
|
|
4306
|
+
__security: { adminAPIKeyAuth: true },
|
|
4307
|
+
});
|
|
4308
|
+
}
|
|
4309
|
+
};
|
|
4310
|
+
|
|
4311
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4312
|
+
let Groups$1 = class Groups extends APIResource {
|
|
4313
|
+
constructor() {
|
|
4314
|
+
super(...arguments);
|
|
4315
|
+
this.users = new Users$2(this._client);
|
|
4316
|
+
this.roles = new Roles$4(this._client);
|
|
4317
|
+
}
|
|
4318
|
+
/**
|
|
4319
|
+
* Creates a new group in the organization.
|
|
4320
|
+
*
|
|
4321
|
+
* @example
|
|
4322
|
+
* ```ts
|
|
4323
|
+
* const group = await client.admin.organization.groups.create(
|
|
4324
|
+
* { name: 'x' },
|
|
4325
|
+
* );
|
|
4326
|
+
* ```
|
|
4327
|
+
*/
|
|
4328
|
+
create(body, options) {
|
|
4329
|
+
return this._client.post('/organization/groups', {
|
|
4330
|
+
body,
|
|
4331
|
+
...options,
|
|
4332
|
+
__security: { adminAPIKeyAuth: true },
|
|
4333
|
+
});
|
|
4334
|
+
}
|
|
4335
|
+
/**
|
|
4336
|
+
* Updates a group's information.
|
|
4337
|
+
*
|
|
4338
|
+
* @example
|
|
4339
|
+
* ```ts
|
|
4340
|
+
* const group = await client.admin.organization.groups.update(
|
|
4341
|
+
* 'group_id',
|
|
4342
|
+
* { name: 'x' },
|
|
4343
|
+
* );
|
|
4344
|
+
* ```
|
|
4345
|
+
*/
|
|
4346
|
+
update(groupID, body, options) {
|
|
4347
|
+
return this._client.post(path `/organization/groups/${groupID}`, {
|
|
4348
|
+
body,
|
|
4349
|
+
...options,
|
|
4350
|
+
__security: { adminAPIKeyAuth: true },
|
|
4351
|
+
});
|
|
4352
|
+
}
|
|
4353
|
+
/**
|
|
4354
|
+
* Lists all groups in the organization.
|
|
4355
|
+
*
|
|
4356
|
+
* @example
|
|
4357
|
+
* ```ts
|
|
4358
|
+
* // Automatically fetches more pages as needed.
|
|
4359
|
+
* for await (const group of client.admin.organization.groups.list()) {
|
|
4360
|
+
* // ...
|
|
4361
|
+
* }
|
|
4362
|
+
* ```
|
|
4363
|
+
*/
|
|
4364
|
+
list(query = {}, options) {
|
|
4365
|
+
return this._client.getAPIList('/organization/groups', (NextCursorPage), {
|
|
4366
|
+
query,
|
|
4367
|
+
...options,
|
|
4368
|
+
__security: { adminAPIKeyAuth: true },
|
|
4369
|
+
});
|
|
4370
|
+
}
|
|
4371
|
+
/**
|
|
4372
|
+
* Deletes a group from the organization.
|
|
4373
|
+
*
|
|
4374
|
+
* @example
|
|
4375
|
+
* ```ts
|
|
4376
|
+
* const group = await client.admin.organization.groups.delete(
|
|
4377
|
+
* 'group_id',
|
|
4378
|
+
* );
|
|
4379
|
+
* ```
|
|
4380
|
+
*/
|
|
4381
|
+
delete(groupID, options) {
|
|
4382
|
+
return this._client.delete(path `/organization/groups/${groupID}`, {
|
|
4383
|
+
...options,
|
|
4384
|
+
__security: { adminAPIKeyAuth: true },
|
|
4385
|
+
});
|
|
4386
|
+
}
|
|
4387
|
+
};
|
|
4388
|
+
Groups$1.Users = Users$2;
|
|
4389
|
+
Groups$1.Roles = Roles$4;
|
|
4390
|
+
|
|
4391
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4392
|
+
class APIKeys extends APIResource {
|
|
4393
|
+
/**
|
|
4394
|
+
* Retrieves an API key in the project.
|
|
4395
|
+
*
|
|
4396
|
+
* @example
|
|
4397
|
+
* ```ts
|
|
4398
|
+
* const projectAPIKey =
|
|
4399
|
+
* await client.admin.organization.projects.apiKeys.retrieve(
|
|
4400
|
+
* 'api_key_id',
|
|
4401
|
+
* { project_id: 'project_id' },
|
|
4402
|
+
* );
|
|
4403
|
+
* ```
|
|
4404
|
+
*/
|
|
4405
|
+
retrieve(apiKeyID, params, options) {
|
|
4406
|
+
const { project_id } = params;
|
|
4407
|
+
return this._client.get(path `/organization/projects/${project_id}/api_keys/${apiKeyID}`, {
|
|
4408
|
+
...options,
|
|
4409
|
+
__security: { adminAPIKeyAuth: true },
|
|
4410
|
+
});
|
|
4411
|
+
}
|
|
4412
|
+
/**
|
|
4413
|
+
* Returns a list of API keys in the project.
|
|
4414
|
+
*
|
|
4415
|
+
* @example
|
|
4416
|
+
* ```ts
|
|
4417
|
+
* // Automatically fetches more pages as needed.
|
|
4418
|
+
* for await (const projectAPIKey of client.admin.organization.projects.apiKeys.list(
|
|
4419
|
+
* 'project_id',
|
|
4420
|
+
* )) {
|
|
4421
|
+
* // ...
|
|
4422
|
+
* }
|
|
4423
|
+
* ```
|
|
4424
|
+
*/
|
|
4425
|
+
list(projectID, query = {}, options) {
|
|
4426
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/api_keys`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
4427
|
+
}
|
|
4428
|
+
/**
|
|
4429
|
+
* Deletes an API key from the project.
|
|
4430
|
+
*
|
|
4431
|
+
* Returns confirmation of the key deletion, or an error if the key belonged to a
|
|
4432
|
+
* service account.
|
|
4433
|
+
*
|
|
4434
|
+
* @example
|
|
4435
|
+
* ```ts
|
|
4436
|
+
* const apiKey =
|
|
4437
|
+
* await client.admin.organization.projects.apiKeys.delete(
|
|
4438
|
+
* 'api_key_id',
|
|
4439
|
+
* { project_id: 'project_id' },
|
|
4440
|
+
* );
|
|
4441
|
+
* ```
|
|
4442
|
+
*/
|
|
4443
|
+
delete(apiKeyID, params, options) {
|
|
4444
|
+
const { project_id } = params;
|
|
4445
|
+
return this._client.delete(path `/organization/projects/${project_id}/api_keys/${apiKeyID}`, {
|
|
4446
|
+
...options,
|
|
4447
|
+
__security: { adminAPIKeyAuth: true },
|
|
4448
|
+
});
|
|
4449
|
+
}
|
|
4450
|
+
}
|
|
4451
|
+
|
|
4452
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4453
|
+
class Certificates extends APIResource {
|
|
4454
|
+
/**
|
|
4455
|
+
* List certificates for this project.
|
|
4456
|
+
*
|
|
4457
|
+
* @example
|
|
4458
|
+
* ```ts
|
|
4459
|
+
* // Automatically fetches more pages as needed.
|
|
4460
|
+
* for await (const certificateListResponse of client.admin.organization.projects.certificates.list(
|
|
4461
|
+
* 'project_id',
|
|
4462
|
+
* )) {
|
|
4463
|
+
* // ...
|
|
4464
|
+
* }
|
|
4465
|
+
* ```
|
|
4466
|
+
*/
|
|
4467
|
+
list(projectID, query = {}, options) {
|
|
4468
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/certificates`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
4469
|
+
}
|
|
4470
|
+
/**
|
|
4471
|
+
* Activate certificates at the project level.
|
|
4472
|
+
*
|
|
4473
|
+
* You can atomically and idempotently activate up to 10 certificates at a time.
|
|
4474
|
+
*
|
|
4475
|
+
* @example
|
|
4476
|
+
* ```ts
|
|
4477
|
+
* // Automatically fetches more pages as needed.
|
|
4478
|
+
* for await (const certificateActivateResponse of client.admin.organization.projects.certificates.activate(
|
|
4479
|
+
* 'project_id',
|
|
4480
|
+
* { certificate_ids: ['cert_abc'] },
|
|
4481
|
+
* )) {
|
|
4482
|
+
* // ...
|
|
4483
|
+
* }
|
|
4484
|
+
* ```
|
|
4485
|
+
*/
|
|
4486
|
+
activate(projectID, body, options) {
|
|
4487
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/certificates/activate`, (Page), { body, method: 'post', ...options, __security: { adminAPIKeyAuth: true } });
|
|
4488
|
+
}
|
|
4489
|
+
/**
|
|
4490
|
+
* Deactivate certificates at the project level. You can atomically and
|
|
4491
|
+
* idempotently deactivate up to 10 certificates at a time.
|
|
4492
|
+
*
|
|
4493
|
+
* @example
|
|
4494
|
+
* ```ts
|
|
4495
|
+
* // Automatically fetches more pages as needed.
|
|
4496
|
+
* for await (const certificateDeactivateResponse of client.admin.organization.projects.certificates.deactivate(
|
|
4497
|
+
* 'project_id',
|
|
4498
|
+
* { certificate_ids: ['cert_abc'] },
|
|
4499
|
+
* )) {
|
|
4500
|
+
* // ...
|
|
4501
|
+
* }
|
|
4502
|
+
* ```
|
|
4503
|
+
*/
|
|
4504
|
+
deactivate(projectID, body, options) {
|
|
4505
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/certificates/deactivate`, (Page), { body, method: 'post', ...options, __security: { adminAPIKeyAuth: true } });
|
|
4506
|
+
}
|
|
4507
|
+
}
|
|
4508
|
+
|
|
4509
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4510
|
+
class RateLimits extends APIResource {
|
|
4511
|
+
/**
|
|
4512
|
+
* Returns the rate limits per model for a project.
|
|
4513
|
+
*
|
|
4514
|
+
* @example
|
|
4515
|
+
* ```ts
|
|
4516
|
+
* // Automatically fetches more pages as needed.
|
|
4517
|
+
* for await (const projectRateLimit of client.admin.organization.projects.rateLimits.listRateLimits(
|
|
4518
|
+
* 'project_id',
|
|
4519
|
+
* )) {
|
|
4520
|
+
* // ...
|
|
4521
|
+
* }
|
|
4522
|
+
* ```
|
|
4523
|
+
*/
|
|
4524
|
+
listRateLimits(projectID, query = {}, options) {
|
|
4525
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/rate_limits`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
4526
|
+
}
|
|
4527
|
+
/**
|
|
4528
|
+
* Updates a project rate limit.
|
|
4529
|
+
*
|
|
4530
|
+
* @example
|
|
4531
|
+
* ```ts
|
|
4532
|
+
* const projectRateLimit =
|
|
4533
|
+
* await client.admin.organization.projects.rateLimits.updateRateLimit(
|
|
4534
|
+
* 'rate_limit_id',
|
|
4535
|
+
* { project_id: 'project_id' },
|
|
4536
|
+
* );
|
|
4537
|
+
* ```
|
|
4538
|
+
*/
|
|
4539
|
+
updateRateLimit(rateLimitID, params, options) {
|
|
4540
|
+
const { project_id, ...body } = params;
|
|
4541
|
+
return this._client.post(path `/organization/projects/${project_id}/rate_limits/${rateLimitID}`, {
|
|
4542
|
+
body,
|
|
4543
|
+
...options,
|
|
4544
|
+
__security: { adminAPIKeyAuth: true },
|
|
4545
|
+
});
|
|
4546
|
+
}
|
|
4547
|
+
}
|
|
4548
|
+
|
|
4549
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4550
|
+
let Roles$3 = class Roles extends APIResource {
|
|
4551
|
+
/**
|
|
4552
|
+
* Creates a custom role for a project.
|
|
4553
|
+
*
|
|
4554
|
+
* @example
|
|
4555
|
+
* ```ts
|
|
4556
|
+
* const role =
|
|
4557
|
+
* await client.admin.organization.projects.roles.create(
|
|
4558
|
+
* 'project_id',
|
|
4559
|
+
* { permissions: ['string'], role_name: 'role_name' },
|
|
4560
|
+
* );
|
|
4561
|
+
* ```
|
|
4562
|
+
*/
|
|
4563
|
+
create(projectID, body, options) {
|
|
4564
|
+
return this._client.post(path `/projects/${projectID}/roles`, {
|
|
4565
|
+
body,
|
|
4566
|
+
...options,
|
|
4567
|
+
__security: { adminAPIKeyAuth: true },
|
|
4568
|
+
});
|
|
4569
|
+
}
|
|
4570
|
+
/**
|
|
4571
|
+
* Updates an existing project role.
|
|
4572
|
+
*
|
|
4573
|
+
* @example
|
|
4574
|
+
* ```ts
|
|
4575
|
+
* const role =
|
|
4576
|
+
* await client.admin.organization.projects.roles.update(
|
|
4577
|
+
* 'role_id',
|
|
4578
|
+
* { project_id: 'project_id' },
|
|
4579
|
+
* );
|
|
4580
|
+
* ```
|
|
4581
|
+
*/
|
|
4582
|
+
update(roleID, params, options) {
|
|
4583
|
+
const { project_id, ...body } = params;
|
|
4584
|
+
return this._client.post(path `/projects/${project_id}/roles/${roleID}`, {
|
|
4585
|
+
body,
|
|
4586
|
+
...options,
|
|
4587
|
+
__security: { adminAPIKeyAuth: true },
|
|
4588
|
+
});
|
|
4589
|
+
}
|
|
4590
|
+
/**
|
|
4591
|
+
* Lists the roles configured for a project.
|
|
4592
|
+
*
|
|
4593
|
+
* @example
|
|
4594
|
+
* ```ts
|
|
4595
|
+
* // Automatically fetches more pages as needed.
|
|
4596
|
+
* for await (const role of client.admin.organization.projects.roles.list(
|
|
4597
|
+
* 'project_id',
|
|
4598
|
+
* )) {
|
|
4599
|
+
* // ...
|
|
4600
|
+
* }
|
|
4601
|
+
* ```
|
|
4602
|
+
*/
|
|
4603
|
+
list(projectID, query = {}, options) {
|
|
4604
|
+
return this._client.getAPIList(path `/projects/${projectID}/roles`, (NextCursorPage), {
|
|
4605
|
+
query,
|
|
4606
|
+
...options,
|
|
4607
|
+
__security: { adminAPIKeyAuth: true },
|
|
4608
|
+
});
|
|
4609
|
+
}
|
|
4610
|
+
/**
|
|
4611
|
+
* Deletes a custom role from a project.
|
|
4612
|
+
*
|
|
4613
|
+
* @example
|
|
4614
|
+
* ```ts
|
|
4615
|
+
* const role =
|
|
4616
|
+
* await client.admin.organization.projects.roles.delete(
|
|
4617
|
+
* 'role_id',
|
|
4618
|
+
* { project_id: 'project_id' },
|
|
4619
|
+
* );
|
|
4620
|
+
* ```
|
|
4621
|
+
*/
|
|
4622
|
+
delete(roleID, params, options) {
|
|
4623
|
+
const { project_id } = params;
|
|
4624
|
+
return this._client.delete(path `/projects/${project_id}/roles/${roleID}`, {
|
|
4625
|
+
...options,
|
|
4626
|
+
__security: { adminAPIKeyAuth: true },
|
|
4627
|
+
});
|
|
4628
|
+
}
|
|
4629
|
+
};
|
|
4630
|
+
|
|
4631
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4632
|
+
class ServiceAccounts extends APIResource {
|
|
4633
|
+
/**
|
|
4634
|
+
* Creates a new service account in the project. This also returns an unredacted
|
|
4635
|
+
* API key for the service account.
|
|
4636
|
+
*
|
|
4637
|
+
* @example
|
|
4638
|
+
* ```ts
|
|
4639
|
+
* const serviceAccount =
|
|
4640
|
+
* await client.admin.organization.projects.serviceAccounts.create(
|
|
4641
|
+
* 'project_id',
|
|
4642
|
+
* { name: 'name' },
|
|
4643
|
+
* );
|
|
4644
|
+
* ```
|
|
4645
|
+
*/
|
|
4646
|
+
create(projectID, body, options) {
|
|
4647
|
+
return this._client.post(path `/organization/projects/${projectID}/service_accounts`, {
|
|
4648
|
+
body,
|
|
4649
|
+
...options,
|
|
4650
|
+
__security: { adminAPIKeyAuth: true },
|
|
4651
|
+
});
|
|
4652
|
+
}
|
|
4653
|
+
/**
|
|
4654
|
+
* Retrieves a service account in the project.
|
|
4655
|
+
*
|
|
4656
|
+
* @example
|
|
4657
|
+
* ```ts
|
|
4658
|
+
* const projectServiceAccount =
|
|
4659
|
+
* await client.admin.organization.projects.serviceAccounts.retrieve(
|
|
4660
|
+
* 'service_account_id',
|
|
4661
|
+
* { project_id: 'project_id' },
|
|
4662
|
+
* );
|
|
4663
|
+
* ```
|
|
4664
|
+
*/
|
|
4665
|
+
retrieve(serviceAccountID, params, options) {
|
|
4666
|
+
const { project_id } = params;
|
|
4667
|
+
return this._client.get(path `/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, {
|
|
4668
|
+
...options,
|
|
4669
|
+
__security: { adminAPIKeyAuth: true },
|
|
4670
|
+
});
|
|
4671
|
+
}
|
|
4672
|
+
/**
|
|
4673
|
+
* Returns a list of service accounts in the project.
|
|
4674
|
+
*
|
|
4675
|
+
* @example
|
|
4676
|
+
* ```ts
|
|
4677
|
+
* // Automatically fetches more pages as needed.
|
|
4678
|
+
* for await (const projectServiceAccount of client.admin.organization.projects.serviceAccounts.list(
|
|
4679
|
+
* 'project_id',
|
|
4680
|
+
* )) {
|
|
4681
|
+
* // ...
|
|
4682
|
+
* }
|
|
4683
|
+
* ```
|
|
4684
|
+
*/
|
|
4685
|
+
list(projectID, query = {}, options) {
|
|
4686
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/service_accounts`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
4687
|
+
}
|
|
4688
|
+
/**
|
|
4689
|
+
* Deletes a service account from the project.
|
|
4690
|
+
*
|
|
4691
|
+
* Returns confirmation of service account deletion, or an error if the project is
|
|
4692
|
+
* archived (archived projects have no service accounts).
|
|
4693
|
+
*
|
|
4694
|
+
* @example
|
|
4695
|
+
* ```ts
|
|
4696
|
+
* const serviceAccount =
|
|
4697
|
+
* await client.admin.organization.projects.serviceAccounts.delete(
|
|
4698
|
+
* 'service_account_id',
|
|
4699
|
+
* { project_id: 'project_id' },
|
|
4700
|
+
* );
|
|
4701
|
+
* ```
|
|
4702
|
+
*/
|
|
4703
|
+
delete(serviceAccountID, params, options) {
|
|
4704
|
+
const { project_id } = params;
|
|
4705
|
+
return this._client.delete(path `/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, { ...options, __security: { adminAPIKeyAuth: true } });
|
|
4706
|
+
}
|
|
4707
|
+
}
|
|
4708
|
+
|
|
4709
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4710
|
+
let Roles$2 = class Roles extends APIResource {
|
|
4711
|
+
/**
|
|
4712
|
+
* Assigns a project role to a group within a project.
|
|
4713
|
+
*
|
|
4714
|
+
* @example
|
|
4715
|
+
* ```ts
|
|
4716
|
+
* const role =
|
|
4717
|
+
* await client.admin.organization.projects.groups.roles.create(
|
|
4718
|
+
* 'group_id',
|
|
4719
|
+
* { project_id: 'project_id', role_id: 'role_id' },
|
|
4720
|
+
* );
|
|
4721
|
+
* ```
|
|
4722
|
+
*/
|
|
4723
|
+
create(groupID, params, options) {
|
|
4724
|
+
const { project_id, ...body } = params;
|
|
4725
|
+
return this._client.post(path `/projects/${project_id}/groups/${groupID}/roles`, {
|
|
4726
|
+
body,
|
|
4727
|
+
...options,
|
|
4728
|
+
__security: { adminAPIKeyAuth: true },
|
|
4729
|
+
});
|
|
4730
|
+
}
|
|
4731
|
+
/**
|
|
4732
|
+
* Lists the project roles assigned to a group within a project.
|
|
4733
|
+
*
|
|
4734
|
+
* @example
|
|
4735
|
+
* ```ts
|
|
4736
|
+
* // Automatically fetches more pages as needed.
|
|
4737
|
+
* for await (const roleListResponse of client.admin.organization.projects.groups.roles.list(
|
|
4738
|
+
* 'group_id',
|
|
4739
|
+
* { project_id: 'project_id' },
|
|
4740
|
+
* )) {
|
|
4741
|
+
* // ...
|
|
4742
|
+
* }
|
|
4743
|
+
* ```
|
|
4744
|
+
*/
|
|
4745
|
+
list(groupID, params, options) {
|
|
4746
|
+
const { project_id, ...query } = params;
|
|
4747
|
+
return this._client.getAPIList(path `/projects/${project_id}/groups/${groupID}/roles`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
4748
|
+
}
|
|
4749
|
+
/**
|
|
4750
|
+
* Unassigns a project role from a group within a project.
|
|
4751
|
+
*
|
|
4752
|
+
* @example
|
|
4753
|
+
* ```ts
|
|
4754
|
+
* const role =
|
|
4755
|
+
* await client.admin.organization.projects.groups.roles.delete(
|
|
4756
|
+
* 'role_id',
|
|
4757
|
+
* { project_id: 'project_id', group_id: 'group_id' },
|
|
4758
|
+
* );
|
|
4759
|
+
* ```
|
|
4760
|
+
*/
|
|
4761
|
+
delete(roleID, params, options) {
|
|
4762
|
+
const { project_id, group_id } = params;
|
|
4763
|
+
return this._client.delete(path `/projects/${project_id}/groups/${group_id}/roles/${roleID}`, {
|
|
4764
|
+
...options,
|
|
4765
|
+
__security: { adminAPIKeyAuth: true },
|
|
4766
|
+
});
|
|
4767
|
+
}
|
|
4768
|
+
};
|
|
4769
|
+
|
|
4770
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4771
|
+
class Groups extends APIResource {
|
|
4772
|
+
constructor() {
|
|
4773
|
+
super(...arguments);
|
|
4774
|
+
this.roles = new Roles$2(this._client);
|
|
4775
|
+
}
|
|
4776
|
+
/**
|
|
4777
|
+
* Grants a group access to a project.
|
|
4778
|
+
*
|
|
4779
|
+
* @example
|
|
4780
|
+
* ```ts
|
|
4781
|
+
* const projectGroup =
|
|
4782
|
+
* await client.admin.organization.projects.groups.create(
|
|
4783
|
+
* 'project_id',
|
|
4784
|
+
* { group_id: 'group_id', role: 'role' },
|
|
4785
|
+
* );
|
|
4786
|
+
* ```
|
|
4787
|
+
*/
|
|
4788
|
+
create(projectID, body, options) {
|
|
4789
|
+
return this._client.post(path `/organization/projects/${projectID}/groups`, {
|
|
4790
|
+
body,
|
|
4791
|
+
...options,
|
|
4792
|
+
__security: { adminAPIKeyAuth: true },
|
|
4793
|
+
});
|
|
4794
|
+
}
|
|
4795
|
+
/**
|
|
4796
|
+
* Lists the groups that have access to a project.
|
|
4797
|
+
*
|
|
4798
|
+
* @example
|
|
4799
|
+
* ```ts
|
|
4800
|
+
* // Automatically fetches more pages as needed.
|
|
4801
|
+
* for await (const projectGroup of client.admin.organization.projects.groups.list(
|
|
4802
|
+
* 'project_id',
|
|
4803
|
+
* )) {
|
|
4804
|
+
* // ...
|
|
4805
|
+
* }
|
|
4806
|
+
* ```
|
|
4807
|
+
*/
|
|
4808
|
+
list(projectID, query = {}, options) {
|
|
4809
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/groups`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
4810
|
+
}
|
|
4811
|
+
/**
|
|
4812
|
+
* Revokes a group's access to a project.
|
|
4813
|
+
*
|
|
4814
|
+
* @example
|
|
4815
|
+
* ```ts
|
|
4816
|
+
* const group =
|
|
4817
|
+
* await client.admin.organization.projects.groups.delete(
|
|
4818
|
+
* 'group_id',
|
|
4819
|
+
* { project_id: 'project_id' },
|
|
4820
|
+
* );
|
|
4821
|
+
* ```
|
|
4822
|
+
*/
|
|
4823
|
+
delete(groupID, params, options) {
|
|
4824
|
+
const { project_id } = params;
|
|
4825
|
+
return this._client.delete(path `/organization/projects/${project_id}/groups/${groupID}`, {
|
|
4826
|
+
...options,
|
|
4827
|
+
__security: { adminAPIKeyAuth: true },
|
|
4828
|
+
});
|
|
4829
|
+
}
|
|
4830
|
+
}
|
|
4831
|
+
Groups.Roles = Roles$2;
|
|
4832
|
+
|
|
4833
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4834
|
+
let Roles$1 = class Roles extends APIResource {
|
|
4835
|
+
/**
|
|
4836
|
+
* Assigns a project role to a user within a project.
|
|
4837
|
+
*
|
|
4838
|
+
* @example
|
|
4839
|
+
* ```ts
|
|
4840
|
+
* const role =
|
|
4841
|
+
* await client.admin.organization.projects.users.roles.create(
|
|
4842
|
+
* 'user_id',
|
|
4843
|
+
* { project_id: 'project_id', role_id: 'role_id' },
|
|
4844
|
+
* );
|
|
4845
|
+
* ```
|
|
4846
|
+
*/
|
|
4847
|
+
create(userID, params, options) {
|
|
4848
|
+
const { project_id, ...body } = params;
|
|
4849
|
+
return this._client.post(path `/projects/${project_id}/users/${userID}/roles`, {
|
|
4850
|
+
body,
|
|
4851
|
+
...options,
|
|
4852
|
+
__security: { adminAPIKeyAuth: true },
|
|
4853
|
+
});
|
|
4854
|
+
}
|
|
4855
|
+
/**
|
|
4856
|
+
* Lists the project roles assigned to a user within a project.
|
|
4857
|
+
*
|
|
4858
|
+
* @example
|
|
4859
|
+
* ```ts
|
|
4860
|
+
* // Automatically fetches more pages as needed.
|
|
4861
|
+
* for await (const roleListResponse of client.admin.organization.projects.users.roles.list(
|
|
4862
|
+
* 'user_id',
|
|
4863
|
+
* { project_id: 'project_id' },
|
|
4864
|
+
* )) {
|
|
4865
|
+
* // ...
|
|
4866
|
+
* }
|
|
4867
|
+
* ```
|
|
4868
|
+
*/
|
|
4869
|
+
list(userID, params, options) {
|
|
4870
|
+
const { project_id, ...query } = params;
|
|
4871
|
+
return this._client.getAPIList(path `/projects/${project_id}/users/${userID}/roles`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
4872
|
+
}
|
|
4873
|
+
/**
|
|
4874
|
+
* Unassigns a project role from a user within a project.
|
|
4875
|
+
*
|
|
4876
|
+
* @example
|
|
4877
|
+
* ```ts
|
|
4878
|
+
* const role =
|
|
4879
|
+
* await client.admin.organization.projects.users.roles.delete(
|
|
4880
|
+
* 'role_id',
|
|
4881
|
+
* { project_id: 'project_id', user_id: 'user_id' },
|
|
4882
|
+
* );
|
|
4883
|
+
* ```
|
|
4884
|
+
*/
|
|
4885
|
+
delete(roleID, params, options) {
|
|
4886
|
+
const { project_id, user_id } = params;
|
|
4887
|
+
return this._client.delete(path `/projects/${project_id}/users/${user_id}/roles/${roleID}`, {
|
|
4888
|
+
...options,
|
|
4889
|
+
__security: { adminAPIKeyAuth: true },
|
|
4890
|
+
});
|
|
4891
|
+
}
|
|
4892
|
+
};
|
|
4893
|
+
|
|
4894
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
4895
|
+
let Users$1 = class Users extends APIResource {
|
|
4896
|
+
constructor() {
|
|
4897
|
+
super(...arguments);
|
|
4898
|
+
this.roles = new Roles$1(this._client);
|
|
4899
|
+
}
|
|
4900
|
+
/**
|
|
4901
|
+
* Adds a user to the project. Users must already be members of the organization to
|
|
4902
|
+
* be added to a project.
|
|
4903
|
+
*
|
|
4904
|
+
* @example
|
|
4905
|
+
* ```ts
|
|
4906
|
+
* const projectUser =
|
|
4907
|
+
* await client.admin.organization.projects.users.create(
|
|
4908
|
+
* 'project_id',
|
|
4909
|
+
* { role: 'role' },
|
|
4910
|
+
* );
|
|
4911
|
+
* ```
|
|
4912
|
+
*/
|
|
4913
|
+
create(projectID, body, options) {
|
|
4914
|
+
return this._client.post(path `/organization/projects/${projectID}/users`, {
|
|
4915
|
+
body,
|
|
4916
|
+
...options,
|
|
4917
|
+
__security: { adminAPIKeyAuth: true },
|
|
4918
|
+
});
|
|
4919
|
+
}
|
|
4920
|
+
/**
|
|
4921
|
+
* Retrieves a user in the project.
|
|
4922
|
+
*
|
|
4923
|
+
* @example
|
|
4924
|
+
* ```ts
|
|
4925
|
+
* const projectUser =
|
|
4926
|
+
* await client.admin.organization.projects.users.retrieve(
|
|
4927
|
+
* 'user_id',
|
|
4928
|
+
* { project_id: 'project_id' },
|
|
4929
|
+
* );
|
|
4930
|
+
* ```
|
|
4931
|
+
*/
|
|
4932
|
+
retrieve(userID, params, options) {
|
|
4933
|
+
const { project_id } = params;
|
|
4934
|
+
return this._client.get(path `/organization/projects/${project_id}/users/${userID}`, {
|
|
4935
|
+
...options,
|
|
4936
|
+
__security: { adminAPIKeyAuth: true },
|
|
4937
|
+
});
|
|
4938
|
+
}
|
|
4939
|
+
/**
|
|
4940
|
+
* Modifies a user's role in the project.
|
|
4941
|
+
*
|
|
4942
|
+
* @example
|
|
4943
|
+
* ```ts
|
|
4944
|
+
* const projectUser =
|
|
4945
|
+
* await client.admin.organization.projects.users.update(
|
|
4946
|
+
* 'user_id',
|
|
4947
|
+
* { project_id: 'project_id' },
|
|
4948
|
+
* );
|
|
4949
|
+
* ```
|
|
4950
|
+
*/
|
|
4951
|
+
update(userID, params, options) {
|
|
4952
|
+
const { project_id, ...body } = params;
|
|
4953
|
+
return this._client.post(path `/organization/projects/${project_id}/users/${userID}`, {
|
|
4954
|
+
body,
|
|
4955
|
+
...options,
|
|
4956
|
+
__security: { adminAPIKeyAuth: true },
|
|
4957
|
+
});
|
|
4958
|
+
}
|
|
4959
|
+
/**
|
|
4960
|
+
* Returns a list of users in the project.
|
|
4961
|
+
*
|
|
4962
|
+
* @example
|
|
4963
|
+
* ```ts
|
|
4964
|
+
* // Automatically fetches more pages as needed.
|
|
4965
|
+
* for await (const projectUser of client.admin.organization.projects.users.list(
|
|
4966
|
+
* 'project_id',
|
|
4967
|
+
* )) {
|
|
4968
|
+
* // ...
|
|
4969
|
+
* }
|
|
4970
|
+
* ```
|
|
4971
|
+
*/
|
|
4972
|
+
list(projectID, query = {}, options) {
|
|
4973
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/users`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
4974
|
+
}
|
|
4975
|
+
/**
|
|
4976
|
+
* Deletes a user from the project.
|
|
4977
|
+
*
|
|
4978
|
+
* Returns confirmation of project user deletion, or an error if the project is
|
|
4979
|
+
* archived (archived projects have no users).
|
|
4980
|
+
*
|
|
4981
|
+
* @example
|
|
4982
|
+
* ```ts
|
|
4983
|
+
* const user =
|
|
4984
|
+
* await client.admin.organization.projects.users.delete(
|
|
4985
|
+
* 'user_id',
|
|
4986
|
+
* { project_id: 'project_id' },
|
|
4987
|
+
* );
|
|
4988
|
+
* ```
|
|
4989
|
+
*/
|
|
4990
|
+
delete(userID, params, options) {
|
|
4991
|
+
const { project_id } = params;
|
|
4992
|
+
return this._client.delete(path `/organization/projects/${project_id}/users/${userID}`, {
|
|
4993
|
+
...options,
|
|
4994
|
+
__security: { adminAPIKeyAuth: true },
|
|
4995
|
+
});
|
|
4996
|
+
}
|
|
4997
|
+
};
|
|
4998
|
+
Users$1.Roles = Roles$1;
|
|
4999
|
+
|
|
5000
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5001
|
+
class Projects extends APIResource {
|
|
5002
|
+
constructor() {
|
|
5003
|
+
super(...arguments);
|
|
5004
|
+
this.users = new Users$1(this._client);
|
|
5005
|
+
this.serviceAccounts = new ServiceAccounts(this._client);
|
|
5006
|
+
this.apiKeys = new APIKeys(this._client);
|
|
5007
|
+
this.rateLimits = new RateLimits(this._client);
|
|
5008
|
+
this.groups = new Groups(this._client);
|
|
5009
|
+
this.roles = new Roles$3(this._client);
|
|
5010
|
+
this.certificates = new Certificates(this._client);
|
|
5011
|
+
}
|
|
5012
|
+
/**
|
|
5013
|
+
* Create a new project in the organization. Projects can be created and archived,
|
|
5014
|
+
* but cannot be deleted.
|
|
5015
|
+
*
|
|
5016
|
+
* @example
|
|
5017
|
+
* ```ts
|
|
5018
|
+
* const project =
|
|
5019
|
+
* await client.admin.organization.projects.create({
|
|
5020
|
+
* name: 'name',
|
|
5021
|
+
* });
|
|
5022
|
+
* ```
|
|
5023
|
+
*/
|
|
5024
|
+
create(body, options) {
|
|
5025
|
+
return this._client.post('/organization/projects', {
|
|
5026
|
+
body,
|
|
5027
|
+
...options,
|
|
5028
|
+
__security: { adminAPIKeyAuth: true },
|
|
5029
|
+
});
|
|
5030
|
+
}
|
|
5031
|
+
/**
|
|
5032
|
+
* Retrieves a project.
|
|
5033
|
+
*
|
|
5034
|
+
* @example
|
|
5035
|
+
* ```ts
|
|
5036
|
+
* const project =
|
|
5037
|
+
* await client.admin.organization.projects.retrieve(
|
|
5038
|
+
* 'project_id',
|
|
5039
|
+
* );
|
|
5040
|
+
* ```
|
|
5041
|
+
*/
|
|
5042
|
+
retrieve(projectID, options) {
|
|
5043
|
+
return this._client.get(path `/organization/projects/${projectID}`, {
|
|
5044
|
+
...options,
|
|
5045
|
+
__security: { adminAPIKeyAuth: true },
|
|
5046
|
+
});
|
|
5047
|
+
}
|
|
5048
|
+
/**
|
|
5049
|
+
* Modifies a project in the organization.
|
|
5050
|
+
*
|
|
5051
|
+
* @example
|
|
5052
|
+
* ```ts
|
|
5053
|
+
* const project =
|
|
5054
|
+
* await client.admin.organization.projects.update(
|
|
5055
|
+
* 'project_id',
|
|
5056
|
+
* );
|
|
5057
|
+
* ```
|
|
5058
|
+
*/
|
|
5059
|
+
update(projectID, body, options) {
|
|
5060
|
+
return this._client.post(path `/organization/projects/${projectID}`, {
|
|
5061
|
+
body,
|
|
5062
|
+
...options,
|
|
5063
|
+
__security: { adminAPIKeyAuth: true },
|
|
5064
|
+
});
|
|
5065
|
+
}
|
|
5066
|
+
/**
|
|
5067
|
+
* Returns a list of projects.
|
|
5068
|
+
*
|
|
5069
|
+
* @example
|
|
5070
|
+
* ```ts
|
|
5071
|
+
* // Automatically fetches more pages as needed.
|
|
5072
|
+
* for await (const project of client.admin.organization.projects.list()) {
|
|
5073
|
+
* // ...
|
|
5074
|
+
* }
|
|
5075
|
+
* ```
|
|
5076
|
+
*/
|
|
5077
|
+
list(query = {}, options) {
|
|
5078
|
+
return this._client.getAPIList('/organization/projects', (ConversationCursorPage), {
|
|
5079
|
+
query,
|
|
5080
|
+
...options,
|
|
5081
|
+
__security: { adminAPIKeyAuth: true },
|
|
5082
|
+
});
|
|
5083
|
+
}
|
|
5084
|
+
/**
|
|
5085
|
+
* Archives a project in the organization. Archived projects cannot be used or
|
|
5086
|
+
* updated.
|
|
5087
|
+
*
|
|
5088
|
+
* @example
|
|
5089
|
+
* ```ts
|
|
5090
|
+
* const project =
|
|
5091
|
+
* await client.admin.organization.projects.archive(
|
|
5092
|
+
* 'project_id',
|
|
5093
|
+
* );
|
|
5094
|
+
* ```
|
|
5095
|
+
*/
|
|
5096
|
+
archive(projectID, options) {
|
|
5097
|
+
return this._client.post(path `/organization/projects/${projectID}/archive`, {
|
|
5098
|
+
...options,
|
|
5099
|
+
__security: { adminAPIKeyAuth: true },
|
|
5100
|
+
});
|
|
5101
|
+
}
|
|
5102
|
+
}
|
|
5103
|
+
Projects.Users = Users$1;
|
|
5104
|
+
Projects.ServiceAccounts = ServiceAccounts;
|
|
5105
|
+
Projects.APIKeys = APIKeys;
|
|
5106
|
+
Projects.RateLimits = RateLimits;
|
|
5107
|
+
Projects.Groups = Groups;
|
|
5108
|
+
Projects.Roles = Roles$3;
|
|
5109
|
+
Projects.Certificates = Certificates;
|
|
5110
|
+
|
|
5111
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5112
|
+
class Roles extends APIResource {
|
|
5113
|
+
/**
|
|
5114
|
+
* Assigns an organization role to a user within the organization.
|
|
5115
|
+
*
|
|
5116
|
+
* @example
|
|
5117
|
+
* ```ts
|
|
5118
|
+
* const role =
|
|
5119
|
+
* await client.admin.organization.users.roles.create(
|
|
5120
|
+
* 'user_id',
|
|
5121
|
+
* { role_id: 'role_id' },
|
|
5122
|
+
* );
|
|
5123
|
+
* ```
|
|
5124
|
+
*/
|
|
5125
|
+
create(userID, body, options) {
|
|
5126
|
+
return this._client.post(path `/organization/users/${userID}/roles`, {
|
|
5127
|
+
body,
|
|
5128
|
+
...options,
|
|
5129
|
+
__security: { adminAPIKeyAuth: true },
|
|
5130
|
+
});
|
|
5131
|
+
}
|
|
5132
|
+
/**
|
|
5133
|
+
* Lists the organization roles assigned to a user within the organization.
|
|
5134
|
+
*
|
|
5135
|
+
* @example
|
|
5136
|
+
* ```ts
|
|
5137
|
+
* // Automatically fetches more pages as needed.
|
|
5138
|
+
* for await (const roleListResponse of client.admin.organization.users.roles.list(
|
|
5139
|
+
* 'user_id',
|
|
5140
|
+
* )) {
|
|
5141
|
+
* // ...
|
|
5142
|
+
* }
|
|
5143
|
+
* ```
|
|
5144
|
+
*/
|
|
5145
|
+
list(userID, query = {}, options) {
|
|
5146
|
+
return this._client.getAPIList(path `/organization/users/${userID}/roles`, (NextCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5147
|
+
}
|
|
5148
|
+
/**
|
|
5149
|
+
* Unassigns an organization role from a user within the organization.
|
|
5150
|
+
*
|
|
5151
|
+
* @example
|
|
5152
|
+
* ```ts
|
|
5153
|
+
* const role =
|
|
5154
|
+
* await client.admin.organization.users.roles.delete(
|
|
5155
|
+
* 'role_id',
|
|
5156
|
+
* { user_id: 'user_id' },
|
|
5157
|
+
* );
|
|
5158
|
+
* ```
|
|
5159
|
+
*/
|
|
5160
|
+
delete(roleID, params, options) {
|
|
5161
|
+
const { user_id } = params;
|
|
5162
|
+
return this._client.delete(path `/organization/users/${user_id}/roles/${roleID}`, {
|
|
3455
5163
|
...options,
|
|
3456
|
-
|
|
3457
|
-
};
|
|
3458
|
-
runner._run(() => runner._runTools(client, params, opts));
|
|
3459
|
-
return runner;
|
|
5164
|
+
__security: { adminAPIKeyAuth: true },
|
|
5165
|
+
});
|
|
3460
5166
|
}
|
|
3461
5167
|
}
|
|
3462
5168
|
|
|
3463
5169
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3464
|
-
|
|
3465
|
-
* Given a list of messages comprising a conversation, the model will return a response.
|
|
3466
|
-
*/
|
|
3467
|
-
let Completions$1 = class Completions extends APIResource {
|
|
5170
|
+
class Users extends APIResource {
|
|
3468
5171
|
constructor() {
|
|
3469
5172
|
super(...arguments);
|
|
3470
|
-
this.
|
|
3471
|
-
}
|
|
3472
|
-
create(body, options) {
|
|
3473
|
-
return this._client.post('/chat/completions', { body, ...options, stream: body.stream ?? false });
|
|
5173
|
+
this.roles = new Roles(this._client);
|
|
3474
5174
|
}
|
|
3475
5175
|
/**
|
|
3476
|
-
*
|
|
3477
|
-
* the `store` parameter set to `true` will be returned.
|
|
5176
|
+
* Retrieves a user by their identifier.
|
|
3478
5177
|
*
|
|
3479
5178
|
* @example
|
|
3480
5179
|
* ```ts
|
|
3481
|
-
* const
|
|
3482
|
-
* await client.
|
|
5180
|
+
* const organizationUser =
|
|
5181
|
+
* await client.admin.organization.users.retrieve('user_id');
|
|
3483
5182
|
* ```
|
|
3484
5183
|
*/
|
|
3485
|
-
retrieve(
|
|
3486
|
-
return this._client.get(path `/
|
|
5184
|
+
retrieve(userID, options) {
|
|
5185
|
+
return this._client.get(path `/organization/users/${userID}`, {
|
|
5186
|
+
...options,
|
|
5187
|
+
__security: { adminAPIKeyAuth: true },
|
|
5188
|
+
});
|
|
3487
5189
|
}
|
|
3488
5190
|
/**
|
|
3489
|
-
*
|
|
3490
|
-
* with the `store` parameter set to `true` can be modified. Currently, the only
|
|
3491
|
-
* supported modification is to update the `metadata` field.
|
|
5191
|
+
* Modifies a user's role in the organization.
|
|
3492
5192
|
*
|
|
3493
5193
|
* @example
|
|
3494
5194
|
* ```ts
|
|
3495
|
-
* const
|
|
3496
|
-
* '
|
|
3497
|
-
* { metadata: { foo: 'string' } },
|
|
3498
|
-
* );
|
|
5195
|
+
* const organizationUser =
|
|
5196
|
+
* await client.admin.organization.users.update('user_id');
|
|
3499
5197
|
* ```
|
|
3500
5198
|
*/
|
|
3501
|
-
update(
|
|
3502
|
-
return this._client.post(path `/
|
|
5199
|
+
update(userID, body, options) {
|
|
5200
|
+
return this._client.post(path `/organization/users/${userID}`, {
|
|
5201
|
+
body,
|
|
5202
|
+
...options,
|
|
5203
|
+
__security: { adminAPIKeyAuth: true },
|
|
5204
|
+
});
|
|
3503
5205
|
}
|
|
3504
5206
|
/**
|
|
3505
|
-
*
|
|
3506
|
-
* the `store` parameter set to `true` will be returned.
|
|
5207
|
+
* Lists all of the users in the organization.
|
|
3507
5208
|
*
|
|
3508
5209
|
* @example
|
|
3509
5210
|
* ```ts
|
|
3510
5211
|
* // Automatically fetches more pages as needed.
|
|
3511
|
-
* for await (const
|
|
5212
|
+
* for await (const organizationUser of client.admin.organization.users.list()) {
|
|
3512
5213
|
* // ...
|
|
3513
5214
|
* }
|
|
3514
5215
|
* ```
|
|
3515
5216
|
*/
|
|
3516
5217
|
list(query = {}, options) {
|
|
3517
|
-
return this._client.getAPIList('/
|
|
5218
|
+
return this._client.getAPIList('/organization/users', (ConversationCursorPage), {
|
|
5219
|
+
query,
|
|
5220
|
+
...options,
|
|
5221
|
+
__security: { adminAPIKeyAuth: true },
|
|
5222
|
+
});
|
|
3518
5223
|
}
|
|
3519
5224
|
/**
|
|
3520
|
-
*
|
|
3521
|
-
* with the `store` parameter set to `true` can be deleted.
|
|
5225
|
+
* Deletes a user from the organization.
|
|
3522
5226
|
*
|
|
3523
5227
|
* @example
|
|
3524
5228
|
* ```ts
|
|
3525
|
-
* const
|
|
3526
|
-
*
|
|
5229
|
+
* const user = await client.admin.organization.users.delete(
|
|
5230
|
+
* 'user_id',
|
|
5231
|
+
* );
|
|
3527
5232
|
* ```
|
|
3528
5233
|
*/
|
|
3529
|
-
delete(
|
|
3530
|
-
return this._client.delete(path `/
|
|
3531
|
-
}
|
|
3532
|
-
parse(body, options) {
|
|
3533
|
-
validateInputTools(body.tools);
|
|
3534
|
-
return this._client.chat.completions
|
|
3535
|
-
.create(body, {
|
|
5234
|
+
delete(userID, options) {
|
|
5235
|
+
return this._client.delete(path `/organization/users/${userID}`, {
|
|
3536
5236
|
...options,
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
'X-Stainless-Helper-Method': 'chat.completions.parse',
|
|
3540
|
-
},
|
|
3541
|
-
})
|
|
3542
|
-
._thenUnwrap((completion) => parseChatCompletion(completion, body));
|
|
3543
|
-
}
|
|
3544
|
-
runTools(body, options) {
|
|
3545
|
-
if (body.stream) {
|
|
3546
|
-
return ChatCompletionStreamingRunner.runTools(this._client, body, options);
|
|
3547
|
-
}
|
|
3548
|
-
return ChatCompletionRunner.runTools(this._client, body, options);
|
|
3549
|
-
}
|
|
3550
|
-
/**
|
|
3551
|
-
* Creates a chat completion stream
|
|
3552
|
-
*/
|
|
3553
|
-
stream(body, options) {
|
|
3554
|
-
return ChatCompletionStream.createChatCompletion(this._client, body, options);
|
|
5237
|
+
__security: { adminAPIKeyAuth: true },
|
|
5238
|
+
});
|
|
3555
5239
|
}
|
|
3556
|
-
}
|
|
3557
|
-
|
|
5240
|
+
}
|
|
5241
|
+
Users.Roles = Roles;
|
|
3558
5242
|
|
|
3559
5243
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3560
|
-
class
|
|
5244
|
+
class Organization extends APIResource {
|
|
3561
5245
|
constructor() {
|
|
3562
5246
|
super(...arguments);
|
|
3563
|
-
this.
|
|
5247
|
+
this.auditLogs = new AuditLogs(this._client);
|
|
5248
|
+
this.adminAPIKeys = new AdminAPIKeys(this._client);
|
|
5249
|
+
this.usage = new Usage(this._client);
|
|
5250
|
+
this.invites = new Invites(this._client);
|
|
5251
|
+
this.users = new Users(this._client);
|
|
5252
|
+
this.groups = new Groups$1(this._client);
|
|
5253
|
+
this.roles = new Roles$5(this._client);
|
|
5254
|
+
this.certificates = new Certificates$1(this._client);
|
|
5255
|
+
this.projects = new Projects(this._client);
|
|
5256
|
+
}
|
|
5257
|
+
}
|
|
5258
|
+
Organization.AuditLogs = AuditLogs;
|
|
5259
|
+
Organization.AdminAPIKeys = AdminAPIKeys;
|
|
5260
|
+
Organization.Usage = Usage;
|
|
5261
|
+
Organization.Invites = Invites;
|
|
5262
|
+
Organization.Users = Users;
|
|
5263
|
+
Organization.Groups = Groups$1;
|
|
5264
|
+
Organization.Roles = Roles$5;
|
|
5265
|
+
Organization.Certificates = Certificates$1;
|
|
5266
|
+
Organization.Projects = Projects;
|
|
5267
|
+
|
|
5268
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5269
|
+
class Admin extends APIResource {
|
|
5270
|
+
constructor() {
|
|
5271
|
+
super(...arguments);
|
|
5272
|
+
this.organization = new Organization(this._client);
|
|
3564
5273
|
}
|
|
3565
5274
|
}
|
|
3566
|
-
|
|
5275
|
+
Admin.Organization = Organization;
|
|
3567
5276
|
|
|
3568
5277
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3569
5278
|
const brand_privateNullableHeaders = /* @__PURE__ */ Symbol('brand.privateNullableHeaders');
|
|
@@ -3660,6 +5369,7 @@ class Speech extends APIResource {
|
|
|
3660
5369
|
body,
|
|
3661
5370
|
...options,
|
|
3662
5371
|
headers: buildHeaders([{ Accept: 'application/octet-stream' }, options?.headers]),
|
|
5372
|
+
__security: { bearerAuth: true },
|
|
3663
5373
|
__binaryResponse: true,
|
|
3664
5374
|
});
|
|
3665
5375
|
}
|
|
@@ -3676,6 +5386,7 @@ class Transcriptions extends APIResource {
|
|
|
3676
5386
|
...options,
|
|
3677
5387
|
stream: body.stream ?? false,
|
|
3678
5388
|
__metadata: { model: body.model },
|
|
5389
|
+
__security: { bearerAuth: true },
|
|
3679
5390
|
}, this._client));
|
|
3680
5391
|
}
|
|
3681
5392
|
}
|
|
@@ -3686,7 +5397,7 @@ class Transcriptions extends APIResource {
|
|
|
3686
5397
|
*/
|
|
3687
5398
|
class Translations extends APIResource {
|
|
3688
5399
|
create(body, options) {
|
|
3689
|
-
return this._client.post('/audio/translations', multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model } }, this._client));
|
|
5400
|
+
return this._client.post('/audio/translations', multipartFormRequestOptions({ body, ...options, __metadata: { model: body.model }, __security: { bearerAuth: true } }, this._client));
|
|
3690
5401
|
}
|
|
3691
5402
|
}
|
|
3692
5403
|
|
|
@@ -3712,19 +5423,23 @@ class Batches extends APIResource {
|
|
|
3712
5423
|
* Creates and executes a batch from an uploaded file of requests
|
|
3713
5424
|
*/
|
|
3714
5425
|
create(body, options) {
|
|
3715
|
-
return this._client.post('/batches', { body, ...options });
|
|
5426
|
+
return this._client.post('/batches', { body, ...options, __security: { bearerAuth: true } });
|
|
3716
5427
|
}
|
|
3717
5428
|
/**
|
|
3718
5429
|
* Retrieves a batch.
|
|
3719
5430
|
*/
|
|
3720
5431
|
retrieve(batchID, options) {
|
|
3721
|
-
return this._client.get(path `/batches/${batchID}`, options);
|
|
5432
|
+
return this._client.get(path `/batches/${batchID}`, { ...options, __security: { bearerAuth: true } });
|
|
3722
5433
|
}
|
|
3723
5434
|
/**
|
|
3724
5435
|
* List your organization's batches.
|
|
3725
5436
|
*/
|
|
3726
5437
|
list(query = {}, options) {
|
|
3727
|
-
return this._client.getAPIList('/batches', (CursorPage), {
|
|
5438
|
+
return this._client.getAPIList('/batches', (CursorPage), {
|
|
5439
|
+
query,
|
|
5440
|
+
...options,
|
|
5441
|
+
__security: { bearerAuth: true },
|
|
5442
|
+
});
|
|
3728
5443
|
}
|
|
3729
5444
|
/**
|
|
3730
5445
|
* Cancels an in-progress batch. The batch will be in status `cancelling` for up to
|
|
@@ -3732,7 +5447,10 @@ class Batches extends APIResource {
|
|
|
3732
5447
|
* (if any) available in the output file.
|
|
3733
5448
|
*/
|
|
3734
5449
|
cancel(batchID, options) {
|
|
3735
|
-
return this._client.post(path `/batches/${batchID}/cancel`,
|
|
5450
|
+
return this._client.post(path `/batches/${batchID}/cancel`, {
|
|
5451
|
+
...options,
|
|
5452
|
+
__security: { bearerAuth: true },
|
|
5453
|
+
});
|
|
3736
5454
|
}
|
|
3737
5455
|
}
|
|
3738
5456
|
|
|
@@ -3751,6 +5469,7 @@ class Assistants extends APIResource {
|
|
|
3751
5469
|
body,
|
|
3752
5470
|
...options,
|
|
3753
5471
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5472
|
+
__security: { bearerAuth: true },
|
|
3754
5473
|
});
|
|
3755
5474
|
}
|
|
3756
5475
|
/**
|
|
@@ -3762,6 +5481,7 @@ class Assistants extends APIResource {
|
|
|
3762
5481
|
return this._client.get(path `/assistants/${assistantID}`, {
|
|
3763
5482
|
...options,
|
|
3764
5483
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5484
|
+
__security: { bearerAuth: true },
|
|
3765
5485
|
});
|
|
3766
5486
|
}
|
|
3767
5487
|
/**
|
|
@@ -3774,6 +5494,7 @@ class Assistants extends APIResource {
|
|
|
3774
5494
|
body,
|
|
3775
5495
|
...options,
|
|
3776
5496
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5497
|
+
__security: { bearerAuth: true },
|
|
3777
5498
|
});
|
|
3778
5499
|
}
|
|
3779
5500
|
/**
|
|
@@ -3786,6 +5507,7 @@ class Assistants extends APIResource {
|
|
|
3786
5507
|
query,
|
|
3787
5508
|
...options,
|
|
3788
5509
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5510
|
+
__security: { bearerAuth: true },
|
|
3789
5511
|
});
|
|
3790
5512
|
}
|
|
3791
5513
|
/**
|
|
@@ -3797,6 +5519,7 @@ class Assistants extends APIResource {
|
|
|
3797
5519
|
return this._client.delete(path `/assistants/${assistantID}`, {
|
|
3798
5520
|
...options,
|
|
3799
5521
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5522
|
+
__security: { bearerAuth: true },
|
|
3800
5523
|
});
|
|
3801
5524
|
}
|
|
3802
5525
|
}
|
|
@@ -3823,6 +5546,7 @@ let Sessions$1 = class Sessions extends APIResource {
|
|
|
3823
5546
|
body,
|
|
3824
5547
|
...options,
|
|
3825
5548
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5549
|
+
__security: { bearerAuth: true },
|
|
3826
5550
|
});
|
|
3827
5551
|
}
|
|
3828
5552
|
};
|
|
@@ -3849,6 +5573,7 @@ class TranscriptionSessions extends APIResource {
|
|
|
3849
5573
|
body,
|
|
3850
5574
|
...options,
|
|
3851
5575
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5576
|
+
__security: { bearerAuth: true },
|
|
3852
5577
|
});
|
|
3853
5578
|
}
|
|
3854
5579
|
}
|
|
@@ -3886,6 +5611,7 @@ class Sessions extends APIResource {
|
|
|
3886
5611
|
body,
|
|
3887
5612
|
...options,
|
|
3888
5613
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
5614
|
+
__security: { bearerAuth: true },
|
|
3889
5615
|
});
|
|
3890
5616
|
}
|
|
3891
5617
|
/**
|
|
@@ -3903,6 +5629,7 @@ class Sessions extends APIResource {
|
|
|
3903
5629
|
return this._client.post(path `/chatkit/sessions/${sessionID}/cancel`, {
|
|
3904
5630
|
...options,
|
|
3905
5631
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
5632
|
+
__security: { bearerAuth: true },
|
|
3906
5633
|
});
|
|
3907
5634
|
}
|
|
3908
5635
|
}
|
|
@@ -3922,6 +5649,7 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
3922
5649
|
return this._client.get(path `/chatkit/threads/${threadID}`, {
|
|
3923
5650
|
...options,
|
|
3924
5651
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
5652
|
+
__security: { bearerAuth: true },
|
|
3925
5653
|
});
|
|
3926
5654
|
}
|
|
3927
5655
|
/**
|
|
@@ -3940,6 +5668,7 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
3940
5668
|
query,
|
|
3941
5669
|
...options,
|
|
3942
5670
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
5671
|
+
__security: { bearerAuth: true },
|
|
3943
5672
|
});
|
|
3944
5673
|
}
|
|
3945
5674
|
/**
|
|
@@ -3956,6 +5685,7 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
3956
5685
|
return this._client.delete(path `/chatkit/threads/${threadID}`, {
|
|
3957
5686
|
...options,
|
|
3958
5687
|
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
5688
|
+
__security: { bearerAuth: true },
|
|
3959
5689
|
});
|
|
3960
5690
|
}
|
|
3961
5691
|
/**
|
|
@@ -3972,7 +5702,12 @@ let Threads$1 = class Threads extends APIResource {
|
|
|
3972
5702
|
* ```
|
|
3973
5703
|
*/
|
|
3974
5704
|
listItems(threadID, query = {}, options) {
|
|
3975
|
-
return this._client.getAPIList(path `/chatkit/threads/${threadID}/items`, (ConversationCursorPage), {
|
|
5705
|
+
return this._client.getAPIList(path `/chatkit/threads/${threadID}/items`, (ConversationCursorPage), {
|
|
5706
|
+
query,
|
|
5707
|
+
...options,
|
|
5708
|
+
headers: buildHeaders([{ 'OpenAI-Beta': 'chatkit_beta=v1' }, options?.headers]),
|
|
5709
|
+
__security: { bearerAuth: true },
|
|
5710
|
+
});
|
|
3976
5711
|
}
|
|
3977
5712
|
};
|
|
3978
5713
|
|
|
@@ -4004,6 +5739,7 @@ class Messages extends APIResource {
|
|
|
4004
5739
|
body,
|
|
4005
5740
|
...options,
|
|
4006
5741
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5742
|
+
__security: { bearerAuth: true },
|
|
4007
5743
|
});
|
|
4008
5744
|
}
|
|
4009
5745
|
/**
|
|
@@ -4016,6 +5752,7 @@ class Messages extends APIResource {
|
|
|
4016
5752
|
return this._client.get(path `/threads/${thread_id}/messages/${messageID}`, {
|
|
4017
5753
|
...options,
|
|
4018
5754
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5755
|
+
__security: { bearerAuth: true },
|
|
4019
5756
|
});
|
|
4020
5757
|
}
|
|
4021
5758
|
/**
|
|
@@ -4029,6 +5766,7 @@ class Messages extends APIResource {
|
|
|
4029
5766
|
body,
|
|
4030
5767
|
...options,
|
|
4031
5768
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5769
|
+
__security: { bearerAuth: true },
|
|
4032
5770
|
});
|
|
4033
5771
|
}
|
|
4034
5772
|
/**
|
|
@@ -4041,6 +5779,7 @@ class Messages extends APIResource {
|
|
|
4041
5779
|
query,
|
|
4042
5780
|
...options,
|
|
4043
5781
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5782
|
+
__security: { bearerAuth: true },
|
|
4044
5783
|
});
|
|
4045
5784
|
}
|
|
4046
5785
|
/**
|
|
@@ -4053,6 +5792,7 @@ class Messages extends APIResource {
|
|
|
4053
5792
|
return this._client.delete(path `/threads/${thread_id}/messages/${messageID}`, {
|
|
4054
5793
|
...options,
|
|
4055
5794
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5795
|
+
__security: { bearerAuth: true },
|
|
4056
5796
|
});
|
|
4057
5797
|
}
|
|
4058
5798
|
}
|
|
@@ -4075,6 +5815,7 @@ class Steps extends APIResource {
|
|
|
4075
5815
|
query,
|
|
4076
5816
|
...options,
|
|
4077
5817
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5818
|
+
__security: { bearerAuth: true },
|
|
4078
5819
|
});
|
|
4079
5820
|
}
|
|
4080
5821
|
/**
|
|
@@ -4088,6 +5829,7 @@ class Steps extends APIResource {
|
|
|
4088
5829
|
query,
|
|
4089
5830
|
...options,
|
|
4090
5831
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
5832
|
+
__security: { bearerAuth: true },
|
|
4091
5833
|
});
|
|
4092
5834
|
}
|
|
4093
5835
|
}
|
|
@@ -4691,6 +6433,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
4691
6433
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
4692
6434
|
stream: params.stream ?? false,
|
|
4693
6435
|
__synthesizeEventData: true,
|
|
6436
|
+
__security: { bearerAuth: true },
|
|
4694
6437
|
});
|
|
4695
6438
|
}
|
|
4696
6439
|
/**
|
|
@@ -4703,6 +6446,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
4703
6446
|
return this._client.get(path `/threads/${thread_id}/runs/${runID}`, {
|
|
4704
6447
|
...options,
|
|
4705
6448
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6449
|
+
__security: { bearerAuth: true },
|
|
4706
6450
|
});
|
|
4707
6451
|
}
|
|
4708
6452
|
/**
|
|
@@ -4716,6 +6460,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
4716
6460
|
body,
|
|
4717
6461
|
...options,
|
|
4718
6462
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6463
|
+
__security: { bearerAuth: true },
|
|
4719
6464
|
});
|
|
4720
6465
|
}
|
|
4721
6466
|
/**
|
|
@@ -4728,6 +6473,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
4728
6473
|
query,
|
|
4729
6474
|
...options,
|
|
4730
6475
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6476
|
+
__security: { bearerAuth: true },
|
|
4731
6477
|
});
|
|
4732
6478
|
}
|
|
4733
6479
|
/**
|
|
@@ -4740,6 +6486,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
4740
6486
|
return this._client.post(path `/threads/${thread_id}/runs/${runID}/cancel`, {
|
|
4741
6487
|
...options,
|
|
4742
6488
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6489
|
+
__security: { bearerAuth: true },
|
|
4743
6490
|
});
|
|
4744
6491
|
}
|
|
4745
6492
|
/**
|
|
@@ -4822,6 +6569,7 @@ let Runs$1 = class Runs extends APIResource {
|
|
|
4822
6569
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
4823
6570
|
stream: params.stream ?? false,
|
|
4824
6571
|
__synthesizeEventData: true,
|
|
6572
|
+
__security: { bearerAuth: true },
|
|
4825
6573
|
});
|
|
4826
6574
|
}
|
|
4827
6575
|
/**
|
|
@@ -4866,6 +6614,7 @@ class Threads extends APIResource {
|
|
|
4866
6614
|
body,
|
|
4867
6615
|
...options,
|
|
4868
6616
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6617
|
+
__security: { bearerAuth: true },
|
|
4869
6618
|
});
|
|
4870
6619
|
}
|
|
4871
6620
|
/**
|
|
@@ -4877,6 +6626,7 @@ class Threads extends APIResource {
|
|
|
4877
6626
|
return this._client.get(path `/threads/${threadID}`, {
|
|
4878
6627
|
...options,
|
|
4879
6628
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6629
|
+
__security: { bearerAuth: true },
|
|
4880
6630
|
});
|
|
4881
6631
|
}
|
|
4882
6632
|
/**
|
|
@@ -4889,6 +6639,7 @@ class Threads extends APIResource {
|
|
|
4889
6639
|
body,
|
|
4890
6640
|
...options,
|
|
4891
6641
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6642
|
+
__security: { bearerAuth: true },
|
|
4892
6643
|
});
|
|
4893
6644
|
}
|
|
4894
6645
|
/**
|
|
@@ -4900,6 +6651,7 @@ class Threads extends APIResource {
|
|
|
4900
6651
|
return this._client.delete(path `/threads/${threadID}`, {
|
|
4901
6652
|
...options,
|
|
4902
6653
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
6654
|
+
__security: { bearerAuth: true },
|
|
4903
6655
|
});
|
|
4904
6656
|
}
|
|
4905
6657
|
createAndRun(body, options) {
|
|
@@ -4909,6 +6661,7 @@ class Threads extends APIResource {
|
|
|
4909
6661
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
4910
6662
|
stream: body.stream ?? false,
|
|
4911
6663
|
__synthesizeEventData: true,
|
|
6664
|
+
__security: { bearerAuth: true },
|
|
4912
6665
|
});
|
|
4913
6666
|
}
|
|
4914
6667
|
/**
|
|
@@ -4951,7 +6704,12 @@ Beta.Threads = Threads;
|
|
|
4951
6704
|
*/
|
|
4952
6705
|
class Completions extends APIResource {
|
|
4953
6706
|
create(body, options) {
|
|
4954
|
-
return this._client.post('/completions', {
|
|
6707
|
+
return this._client.post('/completions', {
|
|
6708
|
+
body,
|
|
6709
|
+
...options,
|
|
6710
|
+
stream: body.stream ?? false,
|
|
6711
|
+
__security: { bearerAuth: true },
|
|
6712
|
+
});
|
|
4955
6713
|
}
|
|
4956
6714
|
}
|
|
4957
6715
|
|
|
@@ -4965,6 +6723,7 @@ let Content$2 = class Content extends APIResource {
|
|
|
4965
6723
|
return this._client.get(path `/containers/${container_id}/files/${fileID}/content`, {
|
|
4966
6724
|
...options,
|
|
4967
6725
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
6726
|
+
__security: { bearerAuth: true },
|
|
4968
6727
|
__binaryResponse: true,
|
|
4969
6728
|
});
|
|
4970
6729
|
}
|
|
@@ -4983,14 +6742,17 @@ let Files$2 = class Files extends APIResource {
|
|
|
4983
6742
|
* a JSON request with a file ID.
|
|
4984
6743
|
*/
|
|
4985
6744
|
create(containerID, body, options) {
|
|
4986
|
-
return this._client.post(path `/containers/${containerID}/files`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
6745
|
+
return this._client.post(path `/containers/${containerID}/files`, maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
4987
6746
|
}
|
|
4988
6747
|
/**
|
|
4989
6748
|
* Retrieve Container File
|
|
4990
6749
|
*/
|
|
4991
6750
|
retrieve(fileID, params, options) {
|
|
4992
6751
|
const { container_id } = params;
|
|
4993
|
-
return this._client.get(path `/containers/${container_id}/files/${fileID}`,
|
|
6752
|
+
return this._client.get(path `/containers/${container_id}/files/${fileID}`, {
|
|
6753
|
+
...options,
|
|
6754
|
+
__security: { bearerAuth: true },
|
|
6755
|
+
});
|
|
4994
6756
|
}
|
|
4995
6757
|
/**
|
|
4996
6758
|
* List Container files
|
|
@@ -4999,6 +6761,7 @@ let Files$2 = class Files extends APIResource {
|
|
|
4999
6761
|
return this._client.getAPIList(path `/containers/${containerID}/files`, (CursorPage), {
|
|
5000
6762
|
query,
|
|
5001
6763
|
...options,
|
|
6764
|
+
__security: { bearerAuth: true },
|
|
5002
6765
|
});
|
|
5003
6766
|
}
|
|
5004
6767
|
/**
|
|
@@ -5009,6 +6772,7 @@ let Files$2 = class Files extends APIResource {
|
|
|
5009
6772
|
return this._client.delete(path `/containers/${container_id}/files/${fileID}`, {
|
|
5010
6773
|
...options,
|
|
5011
6774
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
6775
|
+
__security: { bearerAuth: true },
|
|
5012
6776
|
});
|
|
5013
6777
|
}
|
|
5014
6778
|
};
|
|
@@ -5024,19 +6788,26 @@ class Containers extends APIResource {
|
|
|
5024
6788
|
* Create Container
|
|
5025
6789
|
*/
|
|
5026
6790
|
create(body, options) {
|
|
5027
|
-
return this._client.post('/containers', { body, ...options });
|
|
6791
|
+
return this._client.post('/containers', { body, ...options, __security: { bearerAuth: true } });
|
|
5028
6792
|
}
|
|
5029
6793
|
/**
|
|
5030
6794
|
* Retrieve Container
|
|
5031
6795
|
*/
|
|
5032
6796
|
retrieve(containerID, options) {
|
|
5033
|
-
return this._client.get(path `/containers/${containerID}`,
|
|
6797
|
+
return this._client.get(path `/containers/${containerID}`, {
|
|
6798
|
+
...options,
|
|
6799
|
+
__security: { bearerAuth: true },
|
|
6800
|
+
});
|
|
5034
6801
|
}
|
|
5035
6802
|
/**
|
|
5036
6803
|
* List Containers
|
|
5037
6804
|
*/
|
|
5038
6805
|
list(query = {}, options) {
|
|
5039
|
-
return this._client.getAPIList('/containers', (CursorPage), {
|
|
6806
|
+
return this._client.getAPIList('/containers', (CursorPage), {
|
|
6807
|
+
query,
|
|
6808
|
+
...options,
|
|
6809
|
+
__security: { bearerAuth: true },
|
|
6810
|
+
});
|
|
5040
6811
|
}
|
|
5041
6812
|
/**
|
|
5042
6813
|
* Delete Container
|
|
@@ -5045,6 +6816,7 @@ class Containers extends APIResource {
|
|
|
5045
6816
|
return this._client.delete(path `/containers/${containerID}`, {
|
|
5046
6817
|
...options,
|
|
5047
6818
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
6819
|
+
__security: { bearerAuth: true },
|
|
5048
6820
|
});
|
|
5049
6821
|
}
|
|
5050
6822
|
}
|
|
@@ -5064,6 +6836,7 @@ class Items extends APIResource {
|
|
|
5064
6836
|
query: { include },
|
|
5065
6837
|
body,
|
|
5066
6838
|
...options,
|
|
6839
|
+
__security: { bearerAuth: true },
|
|
5067
6840
|
});
|
|
5068
6841
|
}
|
|
5069
6842
|
/**
|
|
@@ -5071,20 +6844,27 @@ class Items extends APIResource {
|
|
|
5071
6844
|
*/
|
|
5072
6845
|
retrieve(itemID, params, options) {
|
|
5073
6846
|
const { conversation_id, ...query } = params;
|
|
5074
|
-
return this._client.get(path `/conversations/${conversation_id}/items/${itemID}`, {
|
|
6847
|
+
return this._client.get(path `/conversations/${conversation_id}/items/${itemID}`, {
|
|
6848
|
+
query,
|
|
6849
|
+
...options,
|
|
6850
|
+
__security: { bearerAuth: true },
|
|
6851
|
+
});
|
|
5075
6852
|
}
|
|
5076
6853
|
/**
|
|
5077
6854
|
* List all items for a conversation with the given ID.
|
|
5078
6855
|
*/
|
|
5079
6856
|
list(conversationID, query = {}, options) {
|
|
5080
|
-
return this._client.getAPIList(path `/conversations/${conversationID}/items`, (ConversationCursorPage), { query, ...options });
|
|
6857
|
+
return this._client.getAPIList(path `/conversations/${conversationID}/items`, (ConversationCursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
5081
6858
|
}
|
|
5082
6859
|
/**
|
|
5083
6860
|
* Delete an item from a conversation with the given IDs.
|
|
5084
6861
|
*/
|
|
5085
6862
|
delete(itemID, params, options) {
|
|
5086
6863
|
const { conversation_id } = params;
|
|
5087
|
-
return this._client.delete(path `/conversations/${conversation_id}/items/${itemID}`,
|
|
6864
|
+
return this._client.delete(path `/conversations/${conversation_id}/items/${itemID}`, {
|
|
6865
|
+
...options,
|
|
6866
|
+
__security: { bearerAuth: true },
|
|
6867
|
+
});
|
|
5088
6868
|
}
|
|
5089
6869
|
}
|
|
5090
6870
|
|
|
@@ -5101,25 +6881,35 @@ class Conversations extends APIResource {
|
|
|
5101
6881
|
* Create a conversation.
|
|
5102
6882
|
*/
|
|
5103
6883
|
create(body = {}, options) {
|
|
5104
|
-
return this._client.post('/conversations', { body, ...options });
|
|
6884
|
+
return this._client.post('/conversations', { body, ...options, __security: { bearerAuth: true } });
|
|
5105
6885
|
}
|
|
5106
6886
|
/**
|
|
5107
6887
|
* Get a conversation
|
|
5108
6888
|
*/
|
|
5109
6889
|
retrieve(conversationID, options) {
|
|
5110
|
-
return this._client.get(path `/conversations/${conversationID}`,
|
|
6890
|
+
return this._client.get(path `/conversations/${conversationID}`, {
|
|
6891
|
+
...options,
|
|
6892
|
+
__security: { bearerAuth: true },
|
|
6893
|
+
});
|
|
5111
6894
|
}
|
|
5112
6895
|
/**
|
|
5113
6896
|
* Update a conversation
|
|
5114
6897
|
*/
|
|
5115
6898
|
update(conversationID, body, options) {
|
|
5116
|
-
return this._client.post(path `/conversations/${conversationID}`, {
|
|
6899
|
+
return this._client.post(path `/conversations/${conversationID}`, {
|
|
6900
|
+
body,
|
|
6901
|
+
...options,
|
|
6902
|
+
__security: { bearerAuth: true },
|
|
6903
|
+
});
|
|
5117
6904
|
}
|
|
5118
6905
|
/**
|
|
5119
6906
|
* Delete a conversation. Items in the conversation will not be deleted.
|
|
5120
6907
|
*/
|
|
5121
6908
|
delete(conversationID, options) {
|
|
5122
|
-
return this._client.delete(path `/conversations/${conversationID}`,
|
|
6909
|
+
return this._client.delete(path `/conversations/${conversationID}`, {
|
|
6910
|
+
...options,
|
|
6911
|
+
__security: { bearerAuth: true },
|
|
6912
|
+
});
|
|
5123
6913
|
}
|
|
5124
6914
|
}
|
|
5125
6915
|
Conversations.Items = Items;
|
|
@@ -5155,6 +6945,7 @@ class Embeddings extends APIResource {
|
|
|
5155
6945
|
encoding_format: encoding_format,
|
|
5156
6946
|
},
|
|
5157
6947
|
...options,
|
|
6948
|
+
__security: { bearerAuth: true },
|
|
5158
6949
|
});
|
|
5159
6950
|
// if the user specified an encoding_format, return the response as-is
|
|
5160
6951
|
if (hasUserProvidedEncodingFormat) {
|
|
@@ -5187,14 +6978,17 @@ class OutputItems extends APIResource {
|
|
|
5187
6978
|
*/
|
|
5188
6979
|
retrieve(outputItemID, params, options) {
|
|
5189
6980
|
const { eval_id, run_id } = params;
|
|
5190
|
-
return this._client.get(path `/evals/${eval_id}/runs/${run_id}/output_items/${outputItemID}`,
|
|
6981
|
+
return this._client.get(path `/evals/${eval_id}/runs/${run_id}/output_items/${outputItemID}`, {
|
|
6982
|
+
...options,
|
|
6983
|
+
__security: { bearerAuth: true },
|
|
6984
|
+
});
|
|
5191
6985
|
}
|
|
5192
6986
|
/**
|
|
5193
6987
|
* Get a list of output items for an evaluation run.
|
|
5194
6988
|
*/
|
|
5195
6989
|
list(runID, params, options) {
|
|
5196
6990
|
const { eval_id, ...query } = params;
|
|
5197
|
-
return this._client.getAPIList(path `/evals/${eval_id}/runs/${runID}/output_items`, (CursorPage), { query, ...options });
|
|
6991
|
+
return this._client.getAPIList(path `/evals/${eval_id}/runs/${runID}/output_items`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
5198
6992
|
}
|
|
5199
6993
|
}
|
|
5200
6994
|
|
|
@@ -5213,14 +7007,21 @@ class Runs extends APIResource {
|
|
|
5213
7007
|
* schema specified in the config of the evaluation.
|
|
5214
7008
|
*/
|
|
5215
7009
|
create(evalID, body, options) {
|
|
5216
|
-
return this._client.post(path `/evals/${evalID}/runs`, {
|
|
7010
|
+
return this._client.post(path `/evals/${evalID}/runs`, {
|
|
7011
|
+
body,
|
|
7012
|
+
...options,
|
|
7013
|
+
__security: { bearerAuth: true },
|
|
7014
|
+
});
|
|
5217
7015
|
}
|
|
5218
7016
|
/**
|
|
5219
7017
|
* Get an evaluation run by ID.
|
|
5220
7018
|
*/
|
|
5221
7019
|
retrieve(runID, params, options) {
|
|
5222
7020
|
const { eval_id } = params;
|
|
5223
|
-
return this._client.get(path `/evals/${eval_id}/runs/${runID}`,
|
|
7021
|
+
return this._client.get(path `/evals/${eval_id}/runs/${runID}`, {
|
|
7022
|
+
...options,
|
|
7023
|
+
__security: { bearerAuth: true },
|
|
7024
|
+
});
|
|
5224
7025
|
}
|
|
5225
7026
|
/**
|
|
5226
7027
|
* Get a list of runs for an evaluation.
|
|
@@ -5229,6 +7030,7 @@ class Runs extends APIResource {
|
|
|
5229
7030
|
return this._client.getAPIList(path `/evals/${evalID}/runs`, (CursorPage), {
|
|
5230
7031
|
query,
|
|
5231
7032
|
...options,
|
|
7033
|
+
__security: { bearerAuth: true },
|
|
5232
7034
|
});
|
|
5233
7035
|
}
|
|
5234
7036
|
/**
|
|
@@ -5236,14 +7038,20 @@ class Runs extends APIResource {
|
|
|
5236
7038
|
*/
|
|
5237
7039
|
delete(runID, params, options) {
|
|
5238
7040
|
const { eval_id } = params;
|
|
5239
|
-
return this._client.delete(path `/evals/${eval_id}/runs/${runID}`,
|
|
7041
|
+
return this._client.delete(path `/evals/${eval_id}/runs/${runID}`, {
|
|
7042
|
+
...options,
|
|
7043
|
+
__security: { bearerAuth: true },
|
|
7044
|
+
});
|
|
5240
7045
|
}
|
|
5241
7046
|
/**
|
|
5242
7047
|
* Cancel an ongoing evaluation run.
|
|
5243
7048
|
*/
|
|
5244
7049
|
cancel(runID, params, options) {
|
|
5245
7050
|
const { eval_id } = params;
|
|
5246
|
-
return this._client.post(path `/evals/${eval_id}/runs/${runID}`,
|
|
7051
|
+
return this._client.post(path `/evals/${eval_id}/runs/${runID}`, {
|
|
7052
|
+
...options,
|
|
7053
|
+
__security: { bearerAuth: true },
|
|
7054
|
+
});
|
|
5247
7055
|
}
|
|
5248
7056
|
}
|
|
5249
7057
|
Runs.OutputItems = OutputItems;
|
|
@@ -5266,31 +7074,35 @@ class Evals extends APIResource {
|
|
|
5266
7074
|
* the [Evals guide](https://platform.openai.com/docs/guides/evals).
|
|
5267
7075
|
*/
|
|
5268
7076
|
create(body, options) {
|
|
5269
|
-
return this._client.post('/evals', { body, ...options });
|
|
7077
|
+
return this._client.post('/evals', { body, ...options, __security: { bearerAuth: true } });
|
|
5270
7078
|
}
|
|
5271
7079
|
/**
|
|
5272
7080
|
* Get an evaluation by ID.
|
|
5273
7081
|
*/
|
|
5274
7082
|
retrieve(evalID, options) {
|
|
5275
|
-
return this._client.get(path `/evals/${evalID}`, options);
|
|
7083
|
+
return this._client.get(path `/evals/${evalID}`, { ...options, __security: { bearerAuth: true } });
|
|
5276
7084
|
}
|
|
5277
7085
|
/**
|
|
5278
7086
|
* Update certain properties of an evaluation.
|
|
5279
7087
|
*/
|
|
5280
7088
|
update(evalID, body, options) {
|
|
5281
|
-
return this._client.post(path `/evals/${evalID}`, { body, ...options });
|
|
7089
|
+
return this._client.post(path `/evals/${evalID}`, { body, ...options, __security: { bearerAuth: true } });
|
|
5282
7090
|
}
|
|
5283
7091
|
/**
|
|
5284
7092
|
* List evaluations for a project.
|
|
5285
7093
|
*/
|
|
5286
7094
|
list(query = {}, options) {
|
|
5287
|
-
return this._client.getAPIList('/evals', (CursorPage), {
|
|
7095
|
+
return this._client.getAPIList('/evals', (CursorPage), {
|
|
7096
|
+
query,
|
|
7097
|
+
...options,
|
|
7098
|
+
__security: { bearerAuth: true },
|
|
7099
|
+
});
|
|
5288
7100
|
}
|
|
5289
7101
|
/**
|
|
5290
7102
|
* Delete an evaluation.
|
|
5291
7103
|
*/
|
|
5292
7104
|
delete(evalID, options) {
|
|
5293
|
-
return this._client.delete(path `/evals/${evalID}`, options);
|
|
7105
|
+
return this._client.delete(path `/evals/${evalID}`, { ...options, __security: { bearerAuth: true } });
|
|
5294
7106
|
}
|
|
5295
7107
|
}
|
|
5296
7108
|
Evals.Runs = Runs;
|
|
@@ -5303,7 +7115,8 @@ let Files$1 = class Files extends APIResource {
|
|
|
5303
7115
|
/**
|
|
5304
7116
|
* Upload a file that can be used across various endpoints. Individual files can be
|
|
5305
7117
|
* up to 512 MB, and each project can store up to 2.5 TB of files in total. There
|
|
5306
|
-
* is no organization-wide storage limit.
|
|
7118
|
+
* is no organization-wide storage limit. Uploads to this endpoint are rate-limited
|
|
7119
|
+
* to 1,000 requests per minute per authenticated user.
|
|
5307
7120
|
*
|
|
5308
7121
|
* - The Assistants API supports files up to 2 million tokens and of specific file
|
|
5309
7122
|
* types. See the
|
|
@@ -5318,30 +7131,40 @@ let Files$1 = class Files extends APIResource {
|
|
|
5318
7131
|
* - The Batch API only supports `.jsonl` files up to 200 MB in size. The input
|
|
5319
7132
|
* also has a specific required
|
|
5320
7133
|
* [format](https://platform.openai.com/docs/api-reference/batch/request-input).
|
|
7134
|
+
* - For Retrieval or `file_search` ingestion, upload files here first. If you need
|
|
7135
|
+
* to attach multiple uploaded files to the same vector store, use
|
|
7136
|
+
* [`/vector_stores/{vector_store_id}/file_batches`](https://platform.openai.com/docs/api-reference/vector-stores-file-batches/createBatch)
|
|
7137
|
+
* instead of attaching them one by one. Vector store attachment has separate
|
|
7138
|
+
* limits from file upload, including 2,000 attached files per minute per
|
|
7139
|
+
* organization.
|
|
5321
7140
|
*
|
|
5322
7141
|
* Please [contact us](https://help.openai.com/) if you need to increase these
|
|
5323
7142
|
* storage limits.
|
|
5324
7143
|
*/
|
|
5325
7144
|
create(body, options) {
|
|
5326
|
-
return this._client.post('/files', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
7145
|
+
return this._client.post('/files', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
5327
7146
|
}
|
|
5328
7147
|
/**
|
|
5329
7148
|
* Returns information about a specific file.
|
|
5330
7149
|
*/
|
|
5331
7150
|
retrieve(fileID, options) {
|
|
5332
|
-
return this._client.get(path `/files/${fileID}`, options);
|
|
7151
|
+
return this._client.get(path `/files/${fileID}`, { ...options, __security: { bearerAuth: true } });
|
|
5333
7152
|
}
|
|
5334
7153
|
/**
|
|
5335
7154
|
* Returns a list of files.
|
|
5336
7155
|
*/
|
|
5337
7156
|
list(query = {}, options) {
|
|
5338
|
-
return this._client.getAPIList('/files', (CursorPage), {
|
|
7157
|
+
return this._client.getAPIList('/files', (CursorPage), {
|
|
7158
|
+
query,
|
|
7159
|
+
...options,
|
|
7160
|
+
__security: { bearerAuth: true },
|
|
7161
|
+
});
|
|
5339
7162
|
}
|
|
5340
7163
|
/**
|
|
5341
7164
|
* Delete a file and remove it from all vector stores.
|
|
5342
7165
|
*/
|
|
5343
7166
|
delete(fileID, options) {
|
|
5344
|
-
return this._client.delete(path `/files/${fileID}`, options);
|
|
7167
|
+
return this._client.delete(path `/files/${fileID}`, { ...options, __security: { bearerAuth: true } });
|
|
5345
7168
|
}
|
|
5346
7169
|
/**
|
|
5347
7170
|
* Returns the contents of the specified file.
|
|
@@ -5350,6 +7173,7 @@ let Files$1 = class Files extends APIResource {
|
|
|
5350
7173
|
return this._client.get(path `/files/${fileID}/content`, {
|
|
5351
7174
|
...options,
|
|
5352
7175
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
7176
|
+
__security: { bearerAuth: true },
|
|
5353
7177
|
__binaryResponse: true,
|
|
5354
7178
|
});
|
|
5355
7179
|
}
|
|
@@ -5400,7 +7224,11 @@ let Graders$1 = class Graders extends APIResource {
|
|
|
5400
7224
|
* ```
|
|
5401
7225
|
*/
|
|
5402
7226
|
run(body, options) {
|
|
5403
|
-
return this._client.post('/fine_tuning/alpha/graders/run', {
|
|
7227
|
+
return this._client.post('/fine_tuning/alpha/graders/run', {
|
|
7228
|
+
body,
|
|
7229
|
+
...options,
|
|
7230
|
+
__security: { bearerAuth: true },
|
|
7231
|
+
});
|
|
5404
7232
|
}
|
|
5405
7233
|
/**
|
|
5406
7234
|
* Validate a grader.
|
|
@@ -5420,7 +7248,11 @@ let Graders$1 = class Graders extends APIResource {
|
|
|
5420
7248
|
* ```
|
|
5421
7249
|
*/
|
|
5422
7250
|
validate(body, options) {
|
|
5423
|
-
return this._client.post('/fine_tuning/alpha/graders/validate', {
|
|
7251
|
+
return this._client.post('/fine_tuning/alpha/graders/validate', {
|
|
7252
|
+
body,
|
|
7253
|
+
...options,
|
|
7254
|
+
__security: { bearerAuth: true },
|
|
7255
|
+
});
|
|
5424
7256
|
}
|
|
5425
7257
|
};
|
|
5426
7258
|
|
|
@@ -5456,7 +7288,7 @@ class Permissions extends APIResource {
|
|
|
5456
7288
|
* ```
|
|
5457
7289
|
*/
|
|
5458
7290
|
create(fineTunedModelCheckpoint, body, options) {
|
|
5459
|
-
return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (Page), { body, method: 'post', ...options });
|
|
7291
|
+
return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (Page), { body, method: 'post', ...options, __security: { adminAPIKeyAuth: true } });
|
|
5460
7292
|
}
|
|
5461
7293
|
/**
|
|
5462
7294
|
* **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
|
|
@@ -5470,6 +7302,7 @@ class Permissions extends APIResource {
|
|
|
5470
7302
|
return this._client.get(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, {
|
|
5471
7303
|
query,
|
|
5472
7304
|
...options,
|
|
7305
|
+
__security: { adminAPIKeyAuth: true },
|
|
5473
7306
|
});
|
|
5474
7307
|
}
|
|
5475
7308
|
/**
|
|
@@ -5489,7 +7322,7 @@ class Permissions extends APIResource {
|
|
|
5489
7322
|
* ```
|
|
5490
7323
|
*/
|
|
5491
7324
|
list(fineTunedModelCheckpoint, query = {}, options) {
|
|
5492
|
-
return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (ConversationCursorPage), { query, ...options });
|
|
7325
|
+
return this._client.getAPIList(path `/fine_tuning/checkpoints/${fineTunedModelCheckpoint}/permissions`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5493
7326
|
}
|
|
5494
7327
|
/**
|
|
5495
7328
|
* **NOTE:** This endpoint requires an [admin API key](../admin-api-keys).
|
|
@@ -5511,7 +7344,7 @@ class Permissions extends APIResource {
|
|
|
5511
7344
|
*/
|
|
5512
7345
|
delete(permissionID, params, options) {
|
|
5513
7346
|
const { fine_tuned_model_checkpoint } = params;
|
|
5514
|
-
return this._client.delete(path `/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, options);
|
|
7347
|
+
return this._client.delete(path `/fine_tuning/checkpoints/${fine_tuned_model_checkpoint}/permissions/${permissionID}`, { ...options, __security: { adminAPIKeyAuth: true } });
|
|
5515
7348
|
}
|
|
5516
7349
|
}
|
|
5517
7350
|
|
|
@@ -5543,7 +7376,7 @@ class Checkpoints extends APIResource {
|
|
|
5543
7376
|
* ```
|
|
5544
7377
|
*/
|
|
5545
7378
|
list(fineTuningJobID, query = {}, options) {
|
|
5546
|
-
return this._client.getAPIList(path `/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, (CursorPage), { query, ...options });
|
|
7379
|
+
return this._client.getAPIList(path `/fine_tuning/jobs/${fineTuningJobID}/checkpoints`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
5547
7380
|
}
|
|
5548
7381
|
}
|
|
5549
7382
|
|
|
@@ -5574,7 +7407,7 @@ class Jobs extends APIResource {
|
|
|
5574
7407
|
* ```
|
|
5575
7408
|
*/
|
|
5576
7409
|
create(body, options) {
|
|
5577
|
-
return this._client.post('/fine_tuning/jobs', { body, ...options });
|
|
7410
|
+
return this._client.post('/fine_tuning/jobs', { body, ...options, __security: { bearerAuth: true } });
|
|
5578
7411
|
}
|
|
5579
7412
|
/**
|
|
5580
7413
|
* Get info about a fine-tuning job.
|
|
@@ -5589,7 +7422,10 @@ class Jobs extends APIResource {
|
|
|
5589
7422
|
* ```
|
|
5590
7423
|
*/
|
|
5591
7424
|
retrieve(fineTuningJobID, options) {
|
|
5592
|
-
return this._client.get(path `/fine_tuning/jobs/${fineTuningJobID}`,
|
|
7425
|
+
return this._client.get(path `/fine_tuning/jobs/${fineTuningJobID}`, {
|
|
7426
|
+
...options,
|
|
7427
|
+
__security: { bearerAuth: true },
|
|
7428
|
+
});
|
|
5593
7429
|
}
|
|
5594
7430
|
/**
|
|
5595
7431
|
* List your organization's fine-tuning jobs
|
|
@@ -5603,7 +7439,11 @@ class Jobs extends APIResource {
|
|
|
5603
7439
|
* ```
|
|
5604
7440
|
*/
|
|
5605
7441
|
list(query = {}, options) {
|
|
5606
|
-
return this._client.getAPIList('/fine_tuning/jobs', (CursorPage), {
|
|
7442
|
+
return this._client.getAPIList('/fine_tuning/jobs', (CursorPage), {
|
|
7443
|
+
query,
|
|
7444
|
+
...options,
|
|
7445
|
+
__security: { bearerAuth: true },
|
|
7446
|
+
});
|
|
5607
7447
|
}
|
|
5608
7448
|
/**
|
|
5609
7449
|
* Immediately cancel a fine-tune job.
|
|
@@ -5616,7 +7456,10 @@ class Jobs extends APIResource {
|
|
|
5616
7456
|
* ```
|
|
5617
7457
|
*/
|
|
5618
7458
|
cancel(fineTuningJobID, options) {
|
|
5619
|
-
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/cancel`,
|
|
7459
|
+
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/cancel`, {
|
|
7460
|
+
...options,
|
|
7461
|
+
__security: { bearerAuth: true },
|
|
7462
|
+
});
|
|
5620
7463
|
}
|
|
5621
7464
|
/**
|
|
5622
7465
|
* Get status updates for a fine-tuning job.
|
|
@@ -5632,7 +7475,7 @@ class Jobs extends APIResource {
|
|
|
5632
7475
|
* ```
|
|
5633
7476
|
*/
|
|
5634
7477
|
listEvents(fineTuningJobID, query = {}, options) {
|
|
5635
|
-
return this._client.getAPIList(path `/fine_tuning/jobs/${fineTuningJobID}/events`, (CursorPage), { query, ...options });
|
|
7478
|
+
return this._client.getAPIList(path `/fine_tuning/jobs/${fineTuningJobID}/events`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
5636
7479
|
}
|
|
5637
7480
|
/**
|
|
5638
7481
|
* Pause a fine-tune job.
|
|
@@ -5645,7 +7488,10 @@ class Jobs extends APIResource {
|
|
|
5645
7488
|
* ```
|
|
5646
7489
|
*/
|
|
5647
7490
|
pause(fineTuningJobID, options) {
|
|
5648
|
-
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/pause`,
|
|
7491
|
+
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/pause`, {
|
|
7492
|
+
...options,
|
|
7493
|
+
__security: { bearerAuth: true },
|
|
7494
|
+
});
|
|
5649
7495
|
}
|
|
5650
7496
|
/**
|
|
5651
7497
|
* Resume a fine-tune job.
|
|
@@ -5658,7 +7504,10 @@ class Jobs extends APIResource {
|
|
|
5658
7504
|
* ```
|
|
5659
7505
|
*/
|
|
5660
7506
|
resume(fineTuningJobID, options) {
|
|
5661
|
-
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/resume`,
|
|
7507
|
+
return this._client.post(path `/fine_tuning/jobs/${fineTuningJobID}/resume`, {
|
|
7508
|
+
...options,
|
|
7509
|
+
__security: { bearerAuth: true },
|
|
7510
|
+
});
|
|
5662
7511
|
}
|
|
5663
7512
|
}
|
|
5664
7513
|
Jobs.Checkpoints = Checkpoints;
|
|
@@ -5707,13 +7556,18 @@ class Images extends APIResource {
|
|
|
5707
7556
|
* ```
|
|
5708
7557
|
*/
|
|
5709
7558
|
createVariation(body, options) {
|
|
5710
|
-
return this._client.post('/images/variations', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
7559
|
+
return this._client.post('/images/variations', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
5711
7560
|
}
|
|
5712
7561
|
edit(body, options) {
|
|
5713
|
-
return this._client.post('/images/edits', multipartFormRequestOptions({ body, ...options, stream: body.stream ?? false }, this._client));
|
|
7562
|
+
return this._client.post('/images/edits', multipartFormRequestOptions({ body, ...options, stream: body.stream ?? false, __security: { bearerAuth: true } }, this._client));
|
|
5714
7563
|
}
|
|
5715
7564
|
generate(body, options) {
|
|
5716
|
-
return this._client.post('/images/generations', {
|
|
7565
|
+
return this._client.post('/images/generations', {
|
|
7566
|
+
body,
|
|
7567
|
+
...options,
|
|
7568
|
+
stream: body.stream ?? false,
|
|
7569
|
+
__security: { bearerAuth: true },
|
|
7570
|
+
});
|
|
5717
7571
|
}
|
|
5718
7572
|
}
|
|
5719
7573
|
|
|
@@ -5727,21 +7581,21 @@ class Models extends APIResource {
|
|
|
5727
7581
|
* the owner and permissioning.
|
|
5728
7582
|
*/
|
|
5729
7583
|
retrieve(model, options) {
|
|
5730
|
-
return this._client.get(path `/models/${model}`, options);
|
|
7584
|
+
return this._client.get(path `/models/${model}`, { ...options, __security: { bearerAuth: true } });
|
|
5731
7585
|
}
|
|
5732
7586
|
/**
|
|
5733
7587
|
* Lists the currently available models, and provides basic information about each
|
|
5734
7588
|
* one such as the owner and availability.
|
|
5735
7589
|
*/
|
|
5736
7590
|
list(options) {
|
|
5737
|
-
return this._client.getAPIList('/models', (Page), options);
|
|
7591
|
+
return this._client.getAPIList('/models', (Page), { ...options, __security: { bearerAuth: true } });
|
|
5738
7592
|
}
|
|
5739
7593
|
/**
|
|
5740
7594
|
* Delete a fine-tuned model. You must have the Owner role in your organization to
|
|
5741
7595
|
* delete a model.
|
|
5742
7596
|
*/
|
|
5743
7597
|
delete(model, options) {
|
|
5744
|
-
return this._client.delete(path `/models/${model}`, options);
|
|
7598
|
+
return this._client.delete(path `/models/${model}`, { ...options, __security: { bearerAuth: true } });
|
|
5745
7599
|
}
|
|
5746
7600
|
}
|
|
5747
7601
|
|
|
@@ -5755,7 +7609,7 @@ class Moderations extends APIResource {
|
|
|
5755
7609
|
* the [moderation guide](https://platform.openai.com/docs/guides/moderation).
|
|
5756
7610
|
*/
|
|
5757
7611
|
create(body, options) {
|
|
5758
|
-
return this._client.post('/moderations', { body, ...options });
|
|
7612
|
+
return this._client.post('/moderations', { body, ...options, __security: { bearerAuth: true } });
|
|
5759
7613
|
}
|
|
5760
7614
|
}
|
|
5761
7615
|
|
|
@@ -5777,6 +7631,7 @@ class Calls extends APIResource {
|
|
|
5777
7631
|
body,
|
|
5778
7632
|
...options,
|
|
5779
7633
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
7634
|
+
__security: { bearerAuth: true },
|
|
5780
7635
|
});
|
|
5781
7636
|
}
|
|
5782
7637
|
/**
|
|
@@ -5791,6 +7646,7 @@ class Calls extends APIResource {
|
|
|
5791
7646
|
return this._client.post(path `/realtime/calls/${callID}/hangup`, {
|
|
5792
7647
|
...options,
|
|
5793
7648
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
7649
|
+
__security: { bearerAuth: true },
|
|
5794
7650
|
});
|
|
5795
7651
|
}
|
|
5796
7652
|
/**
|
|
@@ -5808,6 +7664,7 @@ class Calls extends APIResource {
|
|
|
5808
7664
|
body,
|
|
5809
7665
|
...options,
|
|
5810
7666
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
7667
|
+
__security: { bearerAuth: true },
|
|
5811
7668
|
});
|
|
5812
7669
|
}
|
|
5813
7670
|
/**
|
|
@@ -5823,6 +7680,7 @@ class Calls extends APIResource {
|
|
|
5823
7680
|
body,
|
|
5824
7681
|
...options,
|
|
5825
7682
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
7683
|
+
__security: { bearerAuth: true },
|
|
5826
7684
|
});
|
|
5827
7685
|
}
|
|
5828
7686
|
}
|
|
@@ -5853,7 +7711,11 @@ class ClientSecrets extends APIResource {
|
|
|
5853
7711
|
* ```
|
|
5854
7712
|
*/
|
|
5855
7713
|
create(body, options) {
|
|
5856
|
-
return this._client.post('/realtime/client_secrets', {
|
|
7714
|
+
return this._client.post('/realtime/client_secrets', {
|
|
7715
|
+
body,
|
|
7716
|
+
...options,
|
|
7717
|
+
__security: { bearerAuth: true },
|
|
7718
|
+
});
|
|
5857
7719
|
}
|
|
5858
7720
|
}
|
|
5859
7721
|
|
|
@@ -6264,7 +8126,7 @@ class InputItems extends APIResource {
|
|
|
6264
8126
|
* ```
|
|
6265
8127
|
*/
|
|
6266
8128
|
list(responseID, query = {}, options) {
|
|
6267
|
-
return this._client.getAPIList(path `/responses/${responseID}/input_items`, (CursorPage), { query, ...options });
|
|
8129
|
+
return this._client.getAPIList(path `/responses/${responseID}/input_items`, (CursorPage), { query, ...options, __security: { bearerAuth: true } });
|
|
6268
8130
|
}
|
|
6269
8131
|
}
|
|
6270
8132
|
|
|
@@ -6282,7 +8144,11 @@ class InputTokens extends APIResource {
|
|
|
6282
8144
|
* ```
|
|
6283
8145
|
*/
|
|
6284
8146
|
count(body = {}, options) {
|
|
6285
|
-
return this._client.post('/responses/input_tokens', {
|
|
8147
|
+
return this._client.post('/responses/input_tokens', {
|
|
8148
|
+
body,
|
|
8149
|
+
...options,
|
|
8150
|
+
__security: { bearerAuth: true },
|
|
8151
|
+
});
|
|
6286
8152
|
}
|
|
6287
8153
|
}
|
|
6288
8154
|
|
|
@@ -6294,7 +8160,12 @@ class Responses extends APIResource {
|
|
|
6294
8160
|
this.inputTokens = new InputTokens(this._client);
|
|
6295
8161
|
}
|
|
6296
8162
|
create(body, options) {
|
|
6297
|
-
return this._client.post('/responses', {
|
|
8163
|
+
return this._client.post('/responses', {
|
|
8164
|
+
body,
|
|
8165
|
+
...options,
|
|
8166
|
+
stream: body.stream ?? false,
|
|
8167
|
+
__security: { bearerAuth: true },
|
|
8168
|
+
})._thenUnwrap((rsp) => {
|
|
6298
8169
|
if ('object' in rsp && rsp.object === 'response') {
|
|
6299
8170
|
addOutputText(rsp);
|
|
6300
8171
|
}
|
|
@@ -6306,6 +8177,7 @@ class Responses extends APIResource {
|
|
|
6306
8177
|
query,
|
|
6307
8178
|
...options,
|
|
6308
8179
|
stream: query?.stream ?? false,
|
|
8180
|
+
__security: { bearerAuth: true },
|
|
6309
8181
|
})._thenUnwrap((rsp) => {
|
|
6310
8182
|
if ('object' in rsp && rsp.object === 'response') {
|
|
6311
8183
|
addOutputText(rsp);
|
|
@@ -6327,6 +8199,7 @@ class Responses extends APIResource {
|
|
|
6327
8199
|
return this._client.delete(path `/responses/${responseID}`, {
|
|
6328
8200
|
...options,
|
|
6329
8201
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
8202
|
+
__security: { bearerAuth: true },
|
|
6330
8203
|
});
|
|
6331
8204
|
}
|
|
6332
8205
|
parse(body, options) {
|
|
@@ -6353,7 +8226,10 @@ class Responses extends APIResource {
|
|
|
6353
8226
|
* ```
|
|
6354
8227
|
*/
|
|
6355
8228
|
cancel(responseID, options) {
|
|
6356
|
-
return this._client.post(path `/responses/${responseID}/cancel`,
|
|
8229
|
+
return this._client.post(path `/responses/${responseID}/cancel`, {
|
|
8230
|
+
...options,
|
|
8231
|
+
__security: { bearerAuth: true },
|
|
8232
|
+
});
|
|
6357
8233
|
}
|
|
6358
8234
|
/**
|
|
6359
8235
|
* Compact a conversation. Returns a compacted response object.
|
|
@@ -6371,7 +8247,7 @@ class Responses extends APIResource {
|
|
|
6371
8247
|
* ```
|
|
6372
8248
|
*/
|
|
6373
8249
|
compact(body, options) {
|
|
6374
|
-
return this._client.post('/responses/compact', { body, ...options });
|
|
8250
|
+
return this._client.post('/responses/compact', { body, ...options, __security: { bearerAuth: true } });
|
|
6375
8251
|
}
|
|
6376
8252
|
}
|
|
6377
8253
|
Responses.InputItems = InputItems;
|
|
@@ -6386,6 +8262,7 @@ let Content$1 = class Content extends APIResource {
|
|
|
6386
8262
|
return this._client.get(path `/skills/${skillID}/content`, {
|
|
6387
8263
|
...options,
|
|
6388
8264
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
8265
|
+
__security: { bearerAuth: true },
|
|
6389
8266
|
__binaryResponse: true,
|
|
6390
8267
|
});
|
|
6391
8268
|
}
|
|
@@ -6401,6 +8278,7 @@ class Content extends APIResource {
|
|
|
6401
8278
|
return this._client.get(path `/skills/${skill_id}/versions/${version}/content`, {
|
|
6402
8279
|
...options,
|
|
6403
8280
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
8281
|
+
__security: { bearerAuth: true },
|
|
6404
8282
|
__binaryResponse: true,
|
|
6405
8283
|
});
|
|
6406
8284
|
}
|
|
@@ -6416,14 +8294,17 @@ class Versions extends APIResource {
|
|
|
6416
8294
|
* Create a new immutable skill version.
|
|
6417
8295
|
*/
|
|
6418
8296
|
create(skillID, body = {}, options) {
|
|
6419
|
-
return this._client.post(path `/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
8297
|
+
return this._client.post(path `/skills/${skillID}/versions`, maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
6420
8298
|
}
|
|
6421
8299
|
/**
|
|
6422
8300
|
* Get a specific skill version.
|
|
6423
8301
|
*/
|
|
6424
8302
|
retrieve(version, params, options) {
|
|
6425
8303
|
const { skill_id } = params;
|
|
6426
|
-
return this._client.get(path `/skills/${skill_id}/versions/${version}`,
|
|
8304
|
+
return this._client.get(path `/skills/${skill_id}/versions/${version}`, {
|
|
8305
|
+
...options,
|
|
8306
|
+
__security: { bearerAuth: true },
|
|
8307
|
+
});
|
|
6427
8308
|
}
|
|
6428
8309
|
/**
|
|
6429
8310
|
* List skill versions for a skill.
|
|
@@ -6432,6 +8313,7 @@ class Versions extends APIResource {
|
|
|
6432
8313
|
return this._client.getAPIList(path `/skills/${skillID}/versions`, (CursorPage), {
|
|
6433
8314
|
query,
|
|
6434
8315
|
...options,
|
|
8316
|
+
__security: { bearerAuth: true },
|
|
6435
8317
|
});
|
|
6436
8318
|
}
|
|
6437
8319
|
/**
|
|
@@ -6439,7 +8321,10 @@ class Versions extends APIResource {
|
|
|
6439
8321
|
*/
|
|
6440
8322
|
delete(version, params, options) {
|
|
6441
8323
|
const { skill_id } = params;
|
|
6442
|
-
return this._client.delete(path `/skills/${skill_id}/versions/${version}`,
|
|
8324
|
+
return this._client.delete(path `/skills/${skill_id}/versions/${version}`, {
|
|
8325
|
+
...options,
|
|
8326
|
+
__security: { bearerAuth: true },
|
|
8327
|
+
});
|
|
6443
8328
|
}
|
|
6444
8329
|
}
|
|
6445
8330
|
Versions.Content = Content;
|
|
@@ -6455,31 +8340,39 @@ class Skills extends APIResource {
|
|
|
6455
8340
|
* Create a new skill.
|
|
6456
8341
|
*/
|
|
6457
8342
|
create(body = {}, options) {
|
|
6458
|
-
return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
8343
|
+
return this._client.post('/skills', maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
6459
8344
|
}
|
|
6460
8345
|
/**
|
|
6461
8346
|
* Get a skill by its ID.
|
|
6462
8347
|
*/
|
|
6463
8348
|
retrieve(skillID, options) {
|
|
6464
|
-
return this._client.get(path `/skills/${skillID}`, options);
|
|
8349
|
+
return this._client.get(path `/skills/${skillID}`, { ...options, __security: { bearerAuth: true } });
|
|
6465
8350
|
}
|
|
6466
8351
|
/**
|
|
6467
8352
|
* Update the default version pointer for a skill.
|
|
6468
8353
|
*/
|
|
6469
8354
|
update(skillID, body, options) {
|
|
6470
|
-
return this._client.post(path `/skills/${skillID}`, {
|
|
8355
|
+
return this._client.post(path `/skills/${skillID}`, {
|
|
8356
|
+
body,
|
|
8357
|
+
...options,
|
|
8358
|
+
__security: { bearerAuth: true },
|
|
8359
|
+
});
|
|
6471
8360
|
}
|
|
6472
8361
|
/**
|
|
6473
8362
|
* List all skills for the current project.
|
|
6474
8363
|
*/
|
|
6475
8364
|
list(query = {}, options) {
|
|
6476
|
-
return this._client.getAPIList('/skills', (CursorPage), {
|
|
8365
|
+
return this._client.getAPIList('/skills', (CursorPage), {
|
|
8366
|
+
query,
|
|
8367
|
+
...options,
|
|
8368
|
+
__security: { bearerAuth: true },
|
|
8369
|
+
});
|
|
6477
8370
|
}
|
|
6478
8371
|
/**
|
|
6479
8372
|
* Delete a skill by its ID.
|
|
6480
8373
|
*/
|
|
6481
8374
|
delete(skillID, options) {
|
|
6482
|
-
return this._client.delete(path `/skills/${skillID}`, options);
|
|
8375
|
+
return this._client.delete(path `/skills/${skillID}`, { ...options, __security: { bearerAuth: true } });
|
|
6483
8376
|
}
|
|
6484
8377
|
}
|
|
6485
8378
|
Skills.Content = Content$1;
|
|
@@ -6504,7 +8397,7 @@ class Parts extends APIResource {
|
|
|
6504
8397
|
* [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete).
|
|
6505
8398
|
*/
|
|
6506
8399
|
create(uploadID, body, options) {
|
|
6507
|
-
return this._client.post(path `/uploads/${uploadID}/parts`, multipartFormRequestOptions({ body, ...options }, this._client));
|
|
8400
|
+
return this._client.post(path `/uploads/${uploadID}/parts`, multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
6508
8401
|
}
|
|
6509
8402
|
}
|
|
6510
8403
|
|
|
@@ -6541,7 +8434,7 @@ class Uploads extends APIResource {
|
|
|
6541
8434
|
* Returns the Upload object with status `pending`.
|
|
6542
8435
|
*/
|
|
6543
8436
|
create(body, options) {
|
|
6544
|
-
return this._client.post('/uploads', { body, ...options });
|
|
8437
|
+
return this._client.post('/uploads', { body, ...options, __security: { bearerAuth: true } });
|
|
6545
8438
|
}
|
|
6546
8439
|
/**
|
|
6547
8440
|
* Cancels the Upload. No Parts may be added after an Upload is cancelled.
|
|
@@ -6549,7 +8442,10 @@ class Uploads extends APIResource {
|
|
|
6549
8442
|
* Returns the Upload object with status `cancelled`.
|
|
6550
8443
|
*/
|
|
6551
8444
|
cancel(uploadID, options) {
|
|
6552
|
-
return this._client.post(path `/uploads/${uploadID}/cancel`,
|
|
8445
|
+
return this._client.post(path `/uploads/${uploadID}/cancel`, {
|
|
8446
|
+
...options,
|
|
8447
|
+
__security: { bearerAuth: true },
|
|
8448
|
+
});
|
|
6553
8449
|
}
|
|
6554
8450
|
/**
|
|
6555
8451
|
* Completes the
|
|
@@ -6569,7 +8465,11 @@ class Uploads extends APIResource {
|
|
|
6569
8465
|
* object.
|
|
6570
8466
|
*/
|
|
6571
8467
|
complete(uploadID, body, options) {
|
|
6572
|
-
return this._client.post(path `/uploads/${uploadID}/complete`, {
|
|
8468
|
+
return this._client.post(path `/uploads/${uploadID}/complete`, {
|
|
8469
|
+
body,
|
|
8470
|
+
...options,
|
|
8471
|
+
__security: { bearerAuth: true },
|
|
8472
|
+
});
|
|
6573
8473
|
}
|
|
6574
8474
|
}
|
|
6575
8475
|
Uploads.Parts = Parts;
|
|
@@ -6606,6 +8506,7 @@ class FileBatches extends APIResource {
|
|
|
6606
8506
|
body,
|
|
6607
8507
|
...options,
|
|
6608
8508
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8509
|
+
__security: { bearerAuth: true },
|
|
6609
8510
|
});
|
|
6610
8511
|
}
|
|
6611
8512
|
/**
|
|
@@ -6616,6 +8517,7 @@ class FileBatches extends APIResource {
|
|
|
6616
8517
|
return this._client.get(path `/vector_stores/${vector_store_id}/file_batches/${batchID}`, {
|
|
6617
8518
|
...options,
|
|
6618
8519
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8520
|
+
__security: { bearerAuth: true },
|
|
6619
8521
|
});
|
|
6620
8522
|
}
|
|
6621
8523
|
/**
|
|
@@ -6627,6 +8529,7 @@ class FileBatches extends APIResource {
|
|
|
6627
8529
|
return this._client.post(path `/vector_stores/${vector_store_id}/file_batches/${batchID}/cancel`, {
|
|
6628
8530
|
...options,
|
|
6629
8531
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8532
|
+
__security: { bearerAuth: true },
|
|
6630
8533
|
});
|
|
6631
8534
|
}
|
|
6632
8535
|
/**
|
|
@@ -6641,7 +8544,12 @@ class FileBatches extends APIResource {
|
|
|
6641
8544
|
*/
|
|
6642
8545
|
listFiles(batchID, params, options) {
|
|
6643
8546
|
const { vector_store_id, ...query } = params;
|
|
6644
|
-
return this._client.getAPIList(path `/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, (CursorPage), {
|
|
8547
|
+
return this._client.getAPIList(path `/vector_stores/${vector_store_id}/file_batches/${batchID}/files`, (CursorPage), {
|
|
8548
|
+
query,
|
|
8549
|
+
...options,
|
|
8550
|
+
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8551
|
+
__security: { bearerAuth: true },
|
|
8552
|
+
});
|
|
6645
8553
|
}
|
|
6646
8554
|
/**
|
|
6647
8555
|
* Wait for the given file batch to be processed.
|
|
@@ -6731,6 +8639,7 @@ class Files extends APIResource {
|
|
|
6731
8639
|
body,
|
|
6732
8640
|
...options,
|
|
6733
8641
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8642
|
+
__security: { bearerAuth: true },
|
|
6734
8643
|
});
|
|
6735
8644
|
}
|
|
6736
8645
|
/**
|
|
@@ -6741,6 +8650,7 @@ class Files extends APIResource {
|
|
|
6741
8650
|
return this._client.get(path `/vector_stores/${vector_store_id}/files/${fileID}`, {
|
|
6742
8651
|
...options,
|
|
6743
8652
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8653
|
+
__security: { bearerAuth: true },
|
|
6744
8654
|
});
|
|
6745
8655
|
}
|
|
6746
8656
|
/**
|
|
@@ -6752,6 +8662,7 @@ class Files extends APIResource {
|
|
|
6752
8662
|
body,
|
|
6753
8663
|
...options,
|
|
6754
8664
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8665
|
+
__security: { bearerAuth: true },
|
|
6755
8666
|
});
|
|
6756
8667
|
}
|
|
6757
8668
|
/**
|
|
@@ -6762,6 +8673,7 @@ class Files extends APIResource {
|
|
|
6762
8673
|
query,
|
|
6763
8674
|
...options,
|
|
6764
8675
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8676
|
+
__security: { bearerAuth: true },
|
|
6765
8677
|
});
|
|
6766
8678
|
}
|
|
6767
8679
|
/**
|
|
@@ -6775,6 +8687,7 @@ class Files extends APIResource {
|
|
|
6775
8687
|
return this._client.delete(path `/vector_stores/${vector_store_id}/files/${fileID}`, {
|
|
6776
8688
|
...options,
|
|
6777
8689
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8690
|
+
__security: { bearerAuth: true },
|
|
6778
8691
|
});
|
|
6779
8692
|
}
|
|
6780
8693
|
/**
|
|
@@ -6848,7 +8761,11 @@ class Files extends APIResource {
|
|
|
6848
8761
|
*/
|
|
6849
8762
|
content(fileID, params, options) {
|
|
6850
8763
|
const { vector_store_id } = params;
|
|
6851
|
-
return this._client.getAPIList(path `/vector_stores/${vector_store_id}/files/${fileID}/content`, (Page), {
|
|
8764
|
+
return this._client.getAPIList(path `/vector_stores/${vector_store_id}/files/${fileID}/content`, (Page), {
|
|
8765
|
+
...options,
|
|
8766
|
+
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8767
|
+
__security: { bearerAuth: true },
|
|
8768
|
+
});
|
|
6852
8769
|
}
|
|
6853
8770
|
}
|
|
6854
8771
|
|
|
@@ -6867,6 +8784,7 @@ class VectorStores extends APIResource {
|
|
|
6867
8784
|
body,
|
|
6868
8785
|
...options,
|
|
6869
8786
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8787
|
+
__security: { bearerAuth: true },
|
|
6870
8788
|
});
|
|
6871
8789
|
}
|
|
6872
8790
|
/**
|
|
@@ -6876,6 +8794,7 @@ class VectorStores extends APIResource {
|
|
|
6876
8794
|
return this._client.get(path `/vector_stores/${vectorStoreID}`, {
|
|
6877
8795
|
...options,
|
|
6878
8796
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8797
|
+
__security: { bearerAuth: true },
|
|
6879
8798
|
});
|
|
6880
8799
|
}
|
|
6881
8800
|
/**
|
|
@@ -6886,6 +8805,7 @@ class VectorStores extends APIResource {
|
|
|
6886
8805
|
body,
|
|
6887
8806
|
...options,
|
|
6888
8807
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8808
|
+
__security: { bearerAuth: true },
|
|
6889
8809
|
});
|
|
6890
8810
|
}
|
|
6891
8811
|
/**
|
|
@@ -6896,6 +8816,7 @@ class VectorStores extends APIResource {
|
|
|
6896
8816
|
query,
|
|
6897
8817
|
...options,
|
|
6898
8818
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8819
|
+
__security: { bearerAuth: true },
|
|
6899
8820
|
});
|
|
6900
8821
|
}
|
|
6901
8822
|
/**
|
|
@@ -6905,6 +8826,7 @@ class VectorStores extends APIResource {
|
|
|
6905
8826
|
return this._client.delete(path `/vector_stores/${vectorStoreID}`, {
|
|
6906
8827
|
...options,
|
|
6907
8828
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8829
|
+
__security: { bearerAuth: true },
|
|
6908
8830
|
});
|
|
6909
8831
|
}
|
|
6910
8832
|
/**
|
|
@@ -6917,6 +8839,7 @@ class VectorStores extends APIResource {
|
|
|
6917
8839
|
method: 'post',
|
|
6918
8840
|
...options,
|
|
6919
8841
|
headers: buildHeaders([{ 'OpenAI-Beta': 'assistants=v2' }, options?.headers]),
|
|
8842
|
+
__security: { bearerAuth: true },
|
|
6920
8843
|
});
|
|
6921
8844
|
}
|
|
6922
8845
|
}
|
|
@@ -6929,31 +8852,35 @@ class Videos extends APIResource {
|
|
|
6929
8852
|
* Create a new video generation job from a prompt and optional reference assets.
|
|
6930
8853
|
*/
|
|
6931
8854
|
create(body, options) {
|
|
6932
|
-
return this._client.post('/videos', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
8855
|
+
return this._client.post('/videos', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
6933
8856
|
}
|
|
6934
8857
|
/**
|
|
6935
8858
|
* Fetch the latest metadata for a generated video.
|
|
6936
8859
|
*/
|
|
6937
8860
|
retrieve(videoID, options) {
|
|
6938
|
-
return this._client.get(path `/videos/${videoID}`, options);
|
|
8861
|
+
return this._client.get(path `/videos/${videoID}`, { ...options, __security: { bearerAuth: true } });
|
|
6939
8862
|
}
|
|
6940
8863
|
/**
|
|
6941
8864
|
* List recently generated videos for the current project.
|
|
6942
8865
|
*/
|
|
6943
8866
|
list(query = {}, options) {
|
|
6944
|
-
return this._client.getAPIList('/videos', (ConversationCursorPage), {
|
|
8867
|
+
return this._client.getAPIList('/videos', (ConversationCursorPage), {
|
|
8868
|
+
query,
|
|
8869
|
+
...options,
|
|
8870
|
+
__security: { bearerAuth: true },
|
|
8871
|
+
});
|
|
6945
8872
|
}
|
|
6946
8873
|
/**
|
|
6947
8874
|
* Permanently delete a completed or failed video and its stored assets.
|
|
6948
8875
|
*/
|
|
6949
8876
|
delete(videoID, options) {
|
|
6950
|
-
return this._client.delete(path `/videos/${videoID}`, options);
|
|
8877
|
+
return this._client.delete(path `/videos/${videoID}`, { ...options, __security: { bearerAuth: true } });
|
|
6951
8878
|
}
|
|
6952
8879
|
/**
|
|
6953
8880
|
* Create a character from an uploaded video.
|
|
6954
8881
|
*/
|
|
6955
8882
|
createCharacter(body, options) {
|
|
6956
|
-
return this._client.post('/videos/characters', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
8883
|
+
return this._client.post('/videos/characters', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
6957
8884
|
}
|
|
6958
8885
|
/**
|
|
6959
8886
|
* Download the generated video bytes or a derived preview asset.
|
|
@@ -6965,6 +8892,7 @@ class Videos extends APIResource {
|
|
|
6965
8892
|
query,
|
|
6966
8893
|
...options,
|
|
6967
8894
|
headers: buildHeaders([{ Accept: 'application/binary' }, options?.headers]),
|
|
8895
|
+
__security: { bearerAuth: true },
|
|
6968
8896
|
__binaryResponse: true,
|
|
6969
8897
|
});
|
|
6970
8898
|
}
|
|
@@ -6973,25 +8901,28 @@ class Videos extends APIResource {
|
|
|
6973
8901
|
* generated video.
|
|
6974
8902
|
*/
|
|
6975
8903
|
edit(body, options) {
|
|
6976
|
-
return this._client.post('/videos/edits', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
8904
|
+
return this._client.post('/videos/edits', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
6977
8905
|
}
|
|
6978
8906
|
/**
|
|
6979
8907
|
* Create an extension of a completed video.
|
|
6980
8908
|
*/
|
|
6981
8909
|
extend(body, options) {
|
|
6982
|
-
return this._client.post('/videos/extensions', multipartFormRequestOptions({ body, ...options }, this._client));
|
|
8910
|
+
return this._client.post('/videos/extensions', multipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
6983
8911
|
}
|
|
6984
8912
|
/**
|
|
6985
8913
|
* Fetch a character.
|
|
6986
8914
|
*/
|
|
6987
8915
|
getCharacter(characterID, options) {
|
|
6988
|
-
return this._client.get(path `/videos/characters/${characterID}`,
|
|
8916
|
+
return this._client.get(path `/videos/characters/${characterID}`, {
|
|
8917
|
+
...options,
|
|
8918
|
+
__security: { bearerAuth: true },
|
|
8919
|
+
});
|
|
6989
8920
|
}
|
|
6990
8921
|
/**
|
|
6991
8922
|
* Create a remix of a completed video using a refreshed prompt.
|
|
6992
8923
|
*/
|
|
6993
8924
|
remix(videoID, body, options) {
|
|
6994
|
-
return this._client.post(path `/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options }, this._client));
|
|
8925
|
+
return this._client.post(path `/videos/${videoID}/remix`, maybeMultipartFormRequestOptions({ body, ...options, __security: { bearerAuth: true } }, this._client));
|
|
6995
8926
|
}
|
|
6996
8927
|
}
|
|
6997
8928
|
|
|
@@ -7098,7 +9029,8 @@ class OpenAI {
|
|
|
7098
9029
|
/**
|
|
7099
9030
|
* API Client for interfacing with the OpenAI API.
|
|
7100
9031
|
*
|
|
7101
|
-
* @param {string | undefined} [opts.apiKey=process.env['OPENAI_API_KEY'] ??
|
|
9032
|
+
* @param {string | null | undefined} [opts.apiKey=process.env['OPENAI_API_KEY'] ?? null]
|
|
9033
|
+
* @param {string | null | undefined} [opts.adminAPIKey=process.env['OPENAI_ADMIN_KEY'] ?? null]
|
|
7102
9034
|
* @param {string | null | undefined} [opts.organization=process.env['OPENAI_ORG_ID'] ?? null]
|
|
7103
9035
|
* @param {string | null | undefined} [opts.project=process.env['OPENAI_PROJECT_ID'] ?? null]
|
|
7104
9036
|
* @param {string | null | undefined} [opts.webhookSecret=process.env['OPENAI_WEBHOOK_SECRET'] ?? null]
|
|
@@ -7111,7 +9043,7 @@ class OpenAI {
|
|
|
7111
9043
|
* @param {Record<string, string | undefined>} opts.defaultQuery - Default query parameters to include with every request to the API.
|
|
7112
9044
|
* @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.
|
|
7113
9045
|
*/
|
|
7114
|
-
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 } = {}) {
|
|
9046
|
+
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 } = {}) {
|
|
7115
9047
|
_OpenAI_instances.add(this);
|
|
7116
9048
|
_OpenAI_encoder.set(this, void 0);
|
|
7117
9049
|
/**
|
|
@@ -7153,6 +9085,7 @@ class OpenAI {
|
|
|
7153
9085
|
* Use Uploads to upload large files in multiple parts.
|
|
7154
9086
|
*/
|
|
7155
9087
|
this.uploads = new Uploads(this);
|
|
9088
|
+
this.admin = new Admin(this);
|
|
7156
9089
|
this.responses = new Responses(this);
|
|
7157
9090
|
this.realtime = new Realtime(this);
|
|
7158
9091
|
/**
|
|
@@ -7166,17 +9099,9 @@ class OpenAI {
|
|
|
7166
9099
|
this.containers = new Containers(this);
|
|
7167
9100
|
this.skills = new Skills(this);
|
|
7168
9101
|
this.videos = new Videos(this);
|
|
7169
|
-
if (workloadIdentity) {
|
|
7170
|
-
if (apiKey && apiKey !== WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER) {
|
|
7171
|
-
throw new OpenAIError('The `apiKey` and `workloadIdentity` arguments are mutually exclusive; only one can be passed at a time.');
|
|
7172
|
-
}
|
|
7173
|
-
apiKey = WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER;
|
|
7174
|
-
}
|
|
7175
|
-
else if (apiKey === undefined) {
|
|
7176
|
-
throw new OpenAIError('Missing credentials. Please pass an `apiKey`, `workloadIdentity`, or set the `OPENAI_API_KEY` environment variable.');
|
|
7177
|
-
}
|
|
7178
9102
|
const options = {
|
|
7179
9103
|
apiKey,
|
|
9104
|
+
adminAPIKey,
|
|
7180
9105
|
organization,
|
|
7181
9106
|
project,
|
|
7182
9107
|
webhookSecret,
|
|
@@ -7184,6 +9109,12 @@ class OpenAI {
|
|
|
7184
9109
|
...opts,
|
|
7185
9110
|
baseURL: baseURL || `https://api.openai.com/v1`,
|
|
7186
9111
|
};
|
|
9112
|
+
if (apiKey && workloadIdentity) {
|
|
9113
|
+
throw new OpenAIError('The `apiKey` and `workloadIdentity` options are mutually exclusive');
|
|
9114
|
+
}
|
|
9115
|
+
if (!apiKey && !adminAPIKey && !workloadIdentity) {
|
|
9116
|
+
throw new OpenAIError('Missing credentials. Please pass an `apiKey`, `workloadIdentity`, `adminAPIKey`, or set the `OPENAI_API_KEY` or `OPENAI_ADMIN_KEY` environment variable.');
|
|
9117
|
+
}
|
|
7187
9118
|
if (!options.dangerouslyAllowBrowser && isRunningInBrowser()) {
|
|
7188
9119
|
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");
|
|
7189
9120
|
}
|
|
@@ -7201,11 +9132,23 @@ class OpenAI {
|
|
|
7201
9132
|
this.maxRetries = options.maxRetries ?? 2;
|
|
7202
9133
|
this.fetch = options.fetch ?? getDefaultFetch();
|
|
7203
9134
|
__classPrivateFieldSet(this, _OpenAI_encoder, FallbackEncoder);
|
|
9135
|
+
const customHeadersEnv = readEnv('OPENAI_CUSTOM_HEADERS');
|
|
9136
|
+
if (customHeadersEnv) {
|
|
9137
|
+
const parsed = {};
|
|
9138
|
+
for (const line of customHeadersEnv.split('\n')) {
|
|
9139
|
+
const colon = line.indexOf(':');
|
|
9140
|
+
if (colon >= 0) {
|
|
9141
|
+
parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim();
|
|
9142
|
+
}
|
|
9143
|
+
}
|
|
9144
|
+
options.defaultHeaders = buildHeaders([parsed, options.defaultHeaders]);
|
|
9145
|
+
}
|
|
7204
9146
|
this._options = options;
|
|
7205
9147
|
if (workloadIdentity) {
|
|
7206
9148
|
this._workloadIdentityAuth = new WorkloadIdentityAuth(workloadIdentity, this.fetch);
|
|
7207
9149
|
}
|
|
7208
|
-
this.apiKey = typeof apiKey === 'string' ? apiKey :
|
|
9150
|
+
this.apiKey = typeof apiKey === 'string' ? apiKey : null;
|
|
9151
|
+
this.adminAPIKey = adminAPIKey;
|
|
7209
9152
|
this.organization = organization;
|
|
7210
9153
|
this.project = project;
|
|
7211
9154
|
this.webhookSecret = webhookSecret;
|
|
@@ -7223,7 +9166,8 @@ class OpenAI {
|
|
|
7223
9166
|
logLevel: this.logLevel,
|
|
7224
9167
|
fetch: this.fetch,
|
|
7225
9168
|
fetchOptions: this.fetchOptions,
|
|
7226
|
-
apiKey: this.apiKey,
|
|
9169
|
+
apiKey: this._options.apiKey,
|
|
9170
|
+
adminAPIKey: this.adminAPIKey,
|
|
7227
9171
|
workloadIdentity: this._options.workloadIdentity,
|
|
7228
9172
|
organization: this.organization,
|
|
7229
9173
|
project: this.project,
|
|
@@ -7235,12 +9179,45 @@ class OpenAI {
|
|
|
7235
9179
|
defaultQuery() {
|
|
7236
9180
|
return this._options.defaultQuery;
|
|
7237
9181
|
}
|
|
7238
|
-
validateHeaders({ values, nulls }
|
|
7239
|
-
|
|
9182
|
+
validateHeaders({ values, nulls }, schemes = {
|
|
9183
|
+
bearerAuth: true,
|
|
9184
|
+
adminAPIKeyAuth: true,
|
|
9185
|
+
}) {
|
|
9186
|
+
if (values.get('authorization') || values.get('api-key')) {
|
|
9187
|
+
return;
|
|
9188
|
+
}
|
|
9189
|
+
if (nulls.has('authorization') || nulls.has('api-key')) {
|
|
9190
|
+
return;
|
|
9191
|
+
}
|
|
9192
|
+
if (this._workloadIdentityAuth && schemes.bearerAuth) {
|
|
9193
|
+
return;
|
|
9194
|
+
}
|
|
9195
|
+
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');
|
|
7240
9196
|
}
|
|
7241
|
-
async authHeaders(opts
|
|
9197
|
+
async authHeaders(opts, schemes = {
|
|
9198
|
+
bearerAuth: true,
|
|
9199
|
+
adminAPIKeyAuth: true,
|
|
9200
|
+
}) {
|
|
9201
|
+
return buildHeaders([
|
|
9202
|
+
schemes.bearerAuth ? await this.bearerAuth(opts) : null,
|
|
9203
|
+
schemes.adminAPIKeyAuth ? await this.adminAPIKeyAuth(opts) : null,
|
|
9204
|
+
]);
|
|
9205
|
+
}
|
|
9206
|
+
async bearerAuth(opts) {
|
|
9207
|
+
if (this._workloadIdentityAuth) {
|
|
9208
|
+
return buildHeaders([{ Authorization: `Bearer ${await this._workloadIdentityAuth.getToken()}` }]);
|
|
9209
|
+
}
|
|
9210
|
+
if (this.apiKey == null) {
|
|
9211
|
+
return undefined;
|
|
9212
|
+
}
|
|
7242
9213
|
return buildHeaders([{ Authorization: `Bearer ${this.apiKey}` }]);
|
|
7243
9214
|
}
|
|
9215
|
+
async adminAPIKeyAuth(opts) {
|
|
9216
|
+
if (this.adminAPIKey == null) {
|
|
9217
|
+
return undefined;
|
|
9218
|
+
}
|
|
9219
|
+
return buildHeaders([{ Authorization: `Bearer ${this.adminAPIKey}` }]);
|
|
9220
|
+
}
|
|
7244
9221
|
stringifyQuery(query) {
|
|
7245
9222
|
return stringifyQuery(query);
|
|
7246
9223
|
}
|
|
@@ -7293,7 +9270,10 @@ class OpenAI {
|
|
|
7293
9270
|
* Used as a callback for mutating the given `FinalRequestOptions` object.
|
|
7294
9271
|
*/
|
|
7295
9272
|
async prepareOptions(options) {
|
|
7296
|
-
|
|
9273
|
+
const security = options.__security ?? { bearerAuth: true };
|
|
9274
|
+
if (security.bearerAuth) {
|
|
9275
|
+
await this._callApiKey();
|
|
9276
|
+
}
|
|
7297
9277
|
}
|
|
7298
9278
|
/**
|
|
7299
9279
|
* Used as a callback for mutating the given `RequestInit` object.
|
|
@@ -7350,8 +9330,9 @@ class OpenAI {
|
|
|
7350
9330
|
if (options.signal?.aborted) {
|
|
7351
9331
|
throw new APIUserAbortError();
|
|
7352
9332
|
}
|
|
9333
|
+
const security = options.__security ?? { bearerAuth: true };
|
|
7353
9334
|
const controller = new AbortController();
|
|
7354
|
-
const response = await this.fetchWithAuth(url, req, timeout, controller).catch(castToError);
|
|
9335
|
+
const response = await this.fetchWithAuth(url, req, timeout, controller, security).catch(castToError);
|
|
7355
9336
|
const headersTime = Date.now();
|
|
7356
9337
|
if (response instanceof globalThis.Error) {
|
|
7357
9338
|
const retryMessage = `retrying, ${retriesRemaining} attempts remaining`;
|
|
@@ -7397,6 +9378,7 @@ class OpenAI {
|
|
|
7397
9378
|
if (!response.ok) {
|
|
7398
9379
|
if (response.status === 401 &&
|
|
7399
9380
|
this._workloadIdentityAuth &&
|
|
9381
|
+
security.bearerAuth &&
|
|
7400
9382
|
!options.__metadata?.['hasStreamingBody'] &&
|
|
7401
9383
|
!options.__metadata?.['workloadIdentityTokenRefreshed']) {
|
|
7402
9384
|
await CancelReadableStream(response.body);
|
|
@@ -7459,8 +9441,11 @@ class OpenAI {
|
|
|
7459
9441
|
const request = this.makeRequest(options, null, undefined);
|
|
7460
9442
|
return new PagePromise(this, request, Page);
|
|
7461
9443
|
}
|
|
7462
|
-
async fetchWithAuth(url, init, timeout, controller
|
|
7463
|
-
|
|
9444
|
+
async fetchWithAuth(url, init, timeout, controller, schemes = {
|
|
9445
|
+
bearerAuth: true,
|
|
9446
|
+
adminAPIKeyAuth: true,
|
|
9447
|
+
}) {
|
|
9448
|
+
if (this._workloadIdentityAuth && schemes.bearerAuth) {
|
|
7464
9449
|
const headers = init.headers;
|
|
7465
9450
|
const authHeader = headers.get('Authorization');
|
|
7466
9451
|
if (!authHeader || authHeader === `Bearer ${WORKLOAD_IDENTITY_API_KEY_PLACEHOLDER}`) {
|
|
@@ -7605,12 +9590,12 @@ class OpenAI {
|
|
|
7605
9590
|
'OpenAI-Organization': this.organization,
|
|
7606
9591
|
'OpenAI-Project': this.project,
|
|
7607
9592
|
},
|
|
7608
|
-
await this.authHeaders(options),
|
|
9593
|
+
await this.authHeaders(options, options.__security ?? { bearerAuth: true }),
|
|
7609
9594
|
this._options.defaultHeaders,
|
|
7610
9595
|
bodyHeaders,
|
|
7611
9596
|
options.headers,
|
|
7612
9597
|
]);
|
|
7613
|
-
this.validateHeaders(headers);
|
|
9598
|
+
this.validateHeaders(headers, options.__security ?? { bearerAuth: true });
|
|
7614
9599
|
return headers.values;
|
|
7615
9600
|
}
|
|
7616
9601
|
_makeAbort(controller) {
|
|
@@ -7707,6 +9692,7 @@ OpenAI.Webhooks = Webhooks;
|
|
|
7707
9692
|
OpenAI.Beta = Beta;
|
|
7708
9693
|
OpenAI.Batches = Batches;
|
|
7709
9694
|
OpenAI.Uploads = Uploads;
|
|
9695
|
+
OpenAI.Admin = Admin;
|
|
7710
9696
|
OpenAI.Responses = Responses;
|
|
7711
9697
|
OpenAI.Realtime = Realtime;
|
|
7712
9698
|
OpenAI.Conversations = Conversations;
|
|
@@ -10266,7 +12252,6 @@ function zodTextFormat(zodObject, name, props) {
|
|
|
10266
12252
|
}, (content) => zodObject.parse(JSON.parse(content)));
|
|
10267
12253
|
}
|
|
10268
12254
|
|
|
10269
|
-
// llm-openai-config.ts
|
|
10270
12255
|
const DEFAULT_MODEL = 'gpt-5-mini';
|
|
10271
12256
|
const GPT_5_HIGH_CONTEXT_THRESHOLD_TOKENS = 272_000;
|
|
10272
12257
|
const GPT_5_HIGH_CONTEXT_INPUT_MULTIPLIER = 2;
|
|
@@ -10347,25 +12332,144 @@ const deepseekModelCosts = {
|
|
|
10347
12332
|
function shouldUseGPT5HighContextPricing(model, inputTokens) {
|
|
10348
12333
|
return (model === 'gpt-5.4' || model === 'gpt-5.5') && inputTokens > GPT_5_HIGH_CONTEXT_THRESHOLD_TOKENS;
|
|
10349
12334
|
}
|
|
10350
|
-
|
|
10351
|
-
const
|
|
10352
|
-
|
|
10353
|
-
'gpt-image-
|
|
12335
|
+
const DEFAULT_IMAGE_PRICING_QUALITY = 'high';
|
|
12336
|
+
const DEFAULT_IMAGE_PRICING_SIZE = '1024x1024';
|
|
12337
|
+
const PRICED_OPENAI_IMAGE_MODELS = [
|
|
12338
|
+
'gpt-image-2',
|
|
12339
|
+
'gpt-image-2-2026-04-21',
|
|
12340
|
+
'gpt-image-1.5',
|
|
12341
|
+
'gpt-image-1',
|
|
12342
|
+
'gpt-image-1-mini',
|
|
12343
|
+
];
|
|
12344
|
+
const OPENAI_IMAGE_PRICING_SIZES = ['1024x1024', '1024x1536', '1536x1024'];
|
|
12345
|
+
/**
|
|
12346
|
+
* Estimated image output costs in USD per image for common GPT Image sizes.
|
|
12347
|
+
* Last updated May 2026 from the OpenAI image generation guide. Text and image
|
|
12348
|
+
* input token costs for prompts and edit inputs are not included.
|
|
12349
|
+
*/
|
|
12350
|
+
const openAiImageCostByQualityAndSize = {
|
|
12351
|
+
'gpt-image-2': {
|
|
12352
|
+
low: {
|
|
12353
|
+
'1024x1024': 0.006,
|
|
12354
|
+
'1024x1536': 0.005,
|
|
12355
|
+
'1536x1024': 0.005,
|
|
12356
|
+
},
|
|
12357
|
+
medium: {
|
|
12358
|
+
'1024x1024': 0.053,
|
|
12359
|
+
'1024x1536': 0.041,
|
|
12360
|
+
'1536x1024': 0.041,
|
|
12361
|
+
},
|
|
12362
|
+
high: {
|
|
12363
|
+
'1024x1024': 0.211,
|
|
12364
|
+
'1024x1536': 0.165,
|
|
12365
|
+
'1536x1024': 0.165,
|
|
12366
|
+
},
|
|
12367
|
+
},
|
|
12368
|
+
'gpt-image-2-2026-04-21': {
|
|
12369
|
+
low: {
|
|
12370
|
+
'1024x1024': 0.006,
|
|
12371
|
+
'1024x1536': 0.005,
|
|
12372
|
+
'1536x1024': 0.005,
|
|
12373
|
+
},
|
|
12374
|
+
medium: {
|
|
12375
|
+
'1024x1024': 0.053,
|
|
12376
|
+
'1024x1536': 0.041,
|
|
12377
|
+
'1536x1024': 0.041,
|
|
12378
|
+
},
|
|
12379
|
+
high: {
|
|
12380
|
+
'1024x1024': 0.211,
|
|
12381
|
+
'1024x1536': 0.165,
|
|
12382
|
+
'1536x1024': 0.165,
|
|
12383
|
+
},
|
|
12384
|
+
},
|
|
12385
|
+
'gpt-image-1.5': {
|
|
12386
|
+
low: {
|
|
12387
|
+
'1024x1024': 0.009,
|
|
12388
|
+
'1024x1536': 0.013,
|
|
12389
|
+
'1536x1024': 0.013,
|
|
12390
|
+
},
|
|
12391
|
+
medium: {
|
|
12392
|
+
'1024x1024': 0.034,
|
|
12393
|
+
'1024x1536': 0.05,
|
|
12394
|
+
'1536x1024': 0.05,
|
|
12395
|
+
},
|
|
12396
|
+
high: {
|
|
12397
|
+
'1024x1024': 0.133,
|
|
12398
|
+
'1024x1536': 0.2,
|
|
12399
|
+
'1536x1024': 0.2,
|
|
12400
|
+
},
|
|
12401
|
+
},
|
|
12402
|
+
'gpt-image-1': {
|
|
12403
|
+
low: {
|
|
12404
|
+
'1024x1024': 0.011,
|
|
12405
|
+
'1024x1536': 0.016,
|
|
12406
|
+
'1536x1024': 0.016,
|
|
12407
|
+
},
|
|
12408
|
+
medium: {
|
|
12409
|
+
'1024x1024': 0.042,
|
|
12410
|
+
'1024x1536': 0.063,
|
|
12411
|
+
'1536x1024': 0.063,
|
|
12412
|
+
},
|
|
12413
|
+
high: {
|
|
12414
|
+
'1024x1024': 0.167,
|
|
12415
|
+
'1024x1536': 0.25,
|
|
12416
|
+
'1536x1024': 0.25,
|
|
12417
|
+
},
|
|
12418
|
+
},
|
|
12419
|
+
'gpt-image-1-mini': {
|
|
12420
|
+
low: {
|
|
12421
|
+
'1024x1024': 0.005,
|
|
12422
|
+
'1024x1536': 0.006,
|
|
12423
|
+
'1536x1024': 0.006,
|
|
12424
|
+
},
|
|
12425
|
+
medium: {
|
|
12426
|
+
'1024x1024': 0.011,
|
|
12427
|
+
'1024x1536': 0.015,
|
|
12428
|
+
'1536x1024': 0.015,
|
|
12429
|
+
},
|
|
12430
|
+
high: {
|
|
12431
|
+
'1024x1024': 0.036,
|
|
12432
|
+
'1024x1536': 0.052,
|
|
12433
|
+
'1536x1024': 0.052,
|
|
12434
|
+
},
|
|
12435
|
+
},
|
|
10354
12436
|
};
|
|
12437
|
+
function isPricedOpenAIImageModel(model) {
|
|
12438
|
+
return PRICED_OPENAI_IMAGE_MODELS.includes(model);
|
|
12439
|
+
}
|
|
12440
|
+
function isOpenAIImagePricingSize(size) {
|
|
12441
|
+
return OPENAI_IMAGE_PRICING_SIZES.includes(size);
|
|
12442
|
+
}
|
|
12443
|
+
function resolveImagePricingQuality(quality) {
|
|
12444
|
+
if (quality === 'low' || quality === 'medium' || quality === 'high') {
|
|
12445
|
+
return quality;
|
|
12446
|
+
}
|
|
12447
|
+
return DEFAULT_IMAGE_PRICING_QUALITY;
|
|
12448
|
+
}
|
|
12449
|
+
function resolveImagePricingSize(size) {
|
|
12450
|
+
if (typeof size === 'string' && isOpenAIImagePricingSize(size)) {
|
|
12451
|
+
return size;
|
|
12452
|
+
}
|
|
12453
|
+
return DEFAULT_IMAGE_PRICING_SIZE;
|
|
12454
|
+
}
|
|
10355
12455
|
/**
|
|
10356
12456
|
* Calculates the cost of generating images using OpenAI's Images API.
|
|
10357
12457
|
*
|
|
10358
12458
|
* @param model The image generation model name.
|
|
10359
12459
|
* @param imageCount The number of images generated.
|
|
12460
|
+
* @param quality The requested image quality.
|
|
12461
|
+
* @param size The requested image size.
|
|
10360
12462
|
* @returns The cost of generating the images in USD.
|
|
10361
12463
|
*/
|
|
10362
|
-
function calculateImageCost(model, imageCount) {
|
|
12464
|
+
function calculateImageCost(model, imageCount, quality, size) {
|
|
10363
12465
|
if (typeof model !== 'string' || typeof imageCount !== 'number' || imageCount <= 0) {
|
|
10364
12466
|
return 0;
|
|
10365
12467
|
}
|
|
10366
|
-
|
|
10367
|
-
if (!costPerImage)
|
|
12468
|
+
if (!isPricedOpenAIImageModel(model))
|
|
10368
12469
|
return 0;
|
|
12470
|
+
const pricingQuality = resolveImagePricingQuality(quality);
|
|
12471
|
+
const pricingSize = resolveImagePricingSize(size);
|
|
12472
|
+
const costPerImage = openAiImageCostByQualityAndSize[model][pricingQuality][pricingSize];
|
|
10369
12473
|
return imageCount * costPerImage;
|
|
10370
12474
|
}
|
|
10371
12475
|
/**
|
|
@@ -11064,7 +13168,7 @@ async function makeLLMCall(input, options = {}) {
|
|
|
11064
13168
|
return await makeResponsesAPICall(processedInput, responsesOptions);
|
|
11065
13169
|
}
|
|
11066
13170
|
|
|
11067
|
-
const DEFAULT_IMAGE_MODEL = 'gpt-image-
|
|
13171
|
+
const DEFAULT_IMAGE_MODEL = 'gpt-image-2';
|
|
11068
13172
|
const resolveImageModel = (model) => model ?? DEFAULT_IMAGE_MODEL;
|
|
11069
13173
|
const MULTIMODAL_VISION_MODELS = new Set(OPENAI_MODELS);
|
|
11070
13174
|
/**
|
|
@@ -11153,7 +13257,7 @@ async function makeImagesCall(prompt, options = {}) {
|
|
|
11153
13257
|
throw new Error('No images returned from OpenAI Images API');
|
|
11154
13258
|
}
|
|
11155
13259
|
// Calculate cost
|
|
11156
|
-
const cost = calculateImageCost(imageModel, count || 1);
|
|
13260
|
+
const cost = calculateImageCost(imageModel, count || 1, quality, size);
|
|
11157
13261
|
// Return the response with enhanced usage information
|
|
11158
13262
|
const enhancedResponse = {
|
|
11159
13263
|
...response,
|
|
@@ -12528,5 +14632,5 @@ const disco = {
|
|
|
12528
14632
|
time,
|
|
12529
14633
|
};
|
|
12530
14634
|
|
|
12531
|
-
export { OPENAI_MODELS, disco, isOpenAIModel, isOpenRouterModel, supportsTemperature };
|
|
14635
|
+
export { OPENAI_IMAGE_MODELS, OPENAI_MODELS, OPENROUTER_MODELS, disco, isOpenAIImageModel, isOpenAIModel, isOpenRouterModel, supportsTemperature };
|
|
12532
14636
|
//# sourceMappingURL=index-frontend.mjs.map
|