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