fork of hey-api/openapi-ts because I need some additional things
at main 3886 lines 104 kB view raw
1// This file is auto-generated by @hey-api/openapi-ts 2 3import { 4 type Client, 5 formDataBodySerializer, 6 type Options as Options2, 7 type TDataShape, 8} from './client'; 9import { client } from './client.gen'; 10import type { 11 ActivateOrganizationCertificatesData, 12 ActivateOrganizationCertificatesResponses, 13 ActivateProjectCertificatesData, 14 ActivateProjectCertificatesResponses, 15 AddUploadPartData, 16 AddUploadPartResponses, 17 AdminApiKeysCreateData, 18 AdminApiKeysCreateResponses, 19 AdminApiKeysDeleteData, 20 AdminApiKeysDeleteResponses, 21 AdminApiKeysGetData, 22 AdminApiKeysGetResponses, 23 AdminApiKeysListData, 24 AdminApiKeysListResponses, 25 ArchiveProjectData, 26 ArchiveProjectResponses, 27 CancelBatchData, 28 CancelBatchResponses, 29 CancelEvalRunData, 30 CancelEvalRunResponses, 31 CancelFineTuningJobData, 32 CancelFineTuningJobResponses, 33 CancelResponseData, 34 CancelResponseErrors, 35 CancelResponseResponses, 36 CancelRunData, 37 CancelRunResponses, 38 CancelUploadData, 39 CancelUploadResponses, 40 CancelVectorStoreFileBatchData, 41 CancelVectorStoreFileBatchResponses, 42 CompleteUploadData, 43 CompleteUploadResponses, 44 CreateAssistantData, 45 CreateAssistantResponses, 46 CreateBatchData, 47 CreateBatchResponses, 48 CreateChatCompletionData, 49 CreateChatCompletionResponses, 50 CreateCompletionData, 51 CreateCompletionResponses, 52 CreateContainerData, 53 CreateContainerFileData, 54 CreateContainerFileResponses, 55 CreateContainerResponses, 56 CreateEmbeddingData, 57 CreateEmbeddingResponses, 58 CreateEvalData, 59 CreateEvalResponses, 60 CreateEvalRunData, 61 CreateEvalRunErrors, 62 CreateEvalRunResponses, 63 CreateFileData, 64 CreateFileResponses, 65 CreateFineTuningCheckpointPermissionData, 66 CreateFineTuningCheckpointPermissionResponses, 67 CreateFineTuningJobData, 68 CreateFineTuningJobResponses, 69 CreateImageData, 70 CreateImageEditData, 71 CreateImageEditResponses, 72 CreateImageResponses, 73 CreateImageVariationData, 74 CreateImageVariationResponses, 75 CreateMessageData, 76 CreateMessageResponses, 77 CreateModerationData, 78 CreateModerationResponses, 79 CreateProjectData, 80 CreateProjectResponses, 81 CreateProjectServiceAccountData, 82 CreateProjectServiceAccountErrors, 83 CreateProjectServiceAccountResponses, 84 CreateProjectUserData, 85 CreateProjectUserErrors, 86 CreateProjectUserResponses, 87 CreateRealtimeSessionData, 88 CreateRealtimeSessionResponses, 89 CreateRealtimeTranscriptionSessionData, 90 CreateRealtimeTranscriptionSessionResponses, 91 CreateResponseData, 92 CreateResponseResponses, 93 CreateRunData, 94 CreateRunResponses, 95 CreateSpeechData, 96 CreateSpeechResponses, 97 CreateThreadAndRunData, 98 CreateThreadAndRunResponses, 99 CreateThreadData, 100 CreateThreadResponses, 101 CreateTranscriptionData, 102 CreateTranscriptionResponses, 103 CreateTranslationData, 104 CreateTranslationResponses, 105 CreateUploadData, 106 CreateUploadResponses, 107 CreateVectorStoreData, 108 CreateVectorStoreFileBatchData, 109 CreateVectorStoreFileBatchResponses, 110 CreateVectorStoreFileData, 111 CreateVectorStoreFileResponses, 112 CreateVectorStoreResponses, 113 DeactivateOrganizationCertificatesData, 114 DeactivateOrganizationCertificatesResponses, 115 DeactivateProjectCertificatesData, 116 DeactivateProjectCertificatesResponses, 117 DeleteAssistantData, 118 DeleteAssistantResponses, 119 DeleteCertificateData, 120 DeleteCertificateResponses, 121 DeleteChatCompletionData, 122 DeleteChatCompletionResponses, 123 DeleteContainerData, 124 DeleteContainerFileData, 125 DeleteContainerFileResponses, 126 DeleteContainerResponses, 127 DeleteEvalData, 128 DeleteEvalErrors, 129 DeleteEvalResponses, 130 DeleteEvalRunData, 131 DeleteEvalRunErrors, 132 DeleteEvalRunResponses, 133 DeleteFileData, 134 DeleteFileResponses, 135 DeleteFineTuningCheckpointPermissionData, 136 DeleteFineTuningCheckpointPermissionResponses, 137 DeleteInviteData, 138 DeleteInviteResponses, 139 DeleteMessageData, 140 DeleteMessageResponses, 141 DeleteModelData, 142 DeleteModelResponses, 143 DeleteProjectApiKeyData, 144 DeleteProjectApiKeyErrors, 145 DeleteProjectApiKeyResponses, 146 DeleteProjectServiceAccountData, 147 DeleteProjectServiceAccountResponses, 148 DeleteProjectUserData, 149 DeleteProjectUserErrors, 150 DeleteProjectUserResponses, 151 DeleteResponseData, 152 DeleteResponseErrors, 153 DeleteResponseResponses, 154 DeleteThreadData, 155 DeleteThreadResponses, 156 DeleteUserData, 157 DeleteUserResponses, 158 DeleteVectorStoreData, 159 DeleteVectorStoreFileData, 160 DeleteVectorStoreFileResponses, 161 DeleteVectorStoreResponses, 162 DownloadFileData, 163 DownloadFileResponses, 164 GetAssistantData, 165 GetAssistantResponses, 166 GetCertificateData, 167 GetCertificateResponses, 168 GetChatCompletionData, 169 GetChatCompletionMessagesData, 170 GetChatCompletionMessagesResponses, 171 GetChatCompletionResponses, 172 GetEvalData, 173 GetEvalResponses, 174 GetEvalRunData, 175 GetEvalRunOutputItemData, 176 GetEvalRunOutputItemResponses, 177 GetEvalRunOutputItemsData, 178 GetEvalRunOutputItemsResponses, 179 GetEvalRunResponses, 180 GetEvalRunsData, 181 GetEvalRunsResponses, 182 GetMessageData, 183 GetMessageResponses, 184 GetResponseData, 185 GetResponseResponses, 186 GetRunData, 187 GetRunResponses, 188 GetRunStepData, 189 GetRunStepResponses, 190 GetThreadData, 191 GetThreadResponses, 192 GetVectorStoreData, 193 GetVectorStoreFileBatchData, 194 GetVectorStoreFileBatchResponses, 195 GetVectorStoreFileData, 196 GetVectorStoreFileResponses, 197 GetVectorStoreResponses, 198 InviteUserData, 199 InviteUserResponses, 200 ListAssistantsData, 201 ListAssistantsResponses, 202 ListAuditLogsData, 203 ListAuditLogsResponses, 204 ListBatchesData, 205 ListBatchesResponses, 206 ListChatCompletionsData, 207 ListChatCompletionsResponses, 208 ListContainerFilesData, 209 ListContainerFilesResponses, 210 ListContainersData, 211 ListContainersResponses, 212 ListEvalsData, 213 ListEvalsResponses, 214 ListFilesData, 215 ListFilesInVectorStoreBatchData, 216 ListFilesInVectorStoreBatchResponses, 217 ListFilesResponses, 218 ListFineTuningCheckpointPermissionsData, 219 ListFineTuningCheckpointPermissionsResponses, 220 ListFineTuningEventsData, 221 ListFineTuningEventsResponses, 222 ListFineTuningJobCheckpointsData, 223 ListFineTuningJobCheckpointsResponses, 224 ListInputItemsData, 225 ListInputItemsResponses, 226 ListInvitesData, 227 ListInvitesResponses, 228 ListMessagesData, 229 ListMessagesResponses, 230 ListModelsData, 231 ListModelsResponses, 232 ListOrganizationCertificatesData, 233 ListOrganizationCertificatesResponses, 234 ListPaginatedFineTuningJobsData, 235 ListPaginatedFineTuningJobsResponses, 236 ListProjectApiKeysData, 237 ListProjectApiKeysResponses, 238 ListProjectCertificatesData, 239 ListProjectCertificatesResponses, 240 ListProjectRateLimitsData, 241 ListProjectRateLimitsResponses, 242 ListProjectsData, 243 ListProjectServiceAccountsData, 244 ListProjectServiceAccountsErrors, 245 ListProjectServiceAccountsResponses, 246 ListProjectsResponses, 247 ListProjectUsersData, 248 ListProjectUsersErrors, 249 ListProjectUsersResponses, 250 ListRunsData, 251 ListRunsResponses, 252 ListRunStepsData, 253 ListRunStepsResponses, 254 ListUsersData, 255 ListUsersResponses, 256 ListVectorStoreFilesData, 257 ListVectorStoreFilesResponses, 258 ListVectorStoresData, 259 ListVectorStoresResponses, 260 ModifyAssistantData, 261 ModifyAssistantResponses, 262 ModifyCertificateData, 263 ModifyCertificateResponses, 264 ModifyMessageData, 265 ModifyMessageResponses, 266 ModifyProjectData, 267 ModifyProjectErrors, 268 ModifyProjectResponses, 269 ModifyProjectUserData, 270 ModifyProjectUserErrors, 271 ModifyProjectUserResponses, 272 ModifyRunData, 273 ModifyRunResponses, 274 ModifyThreadData, 275 ModifyThreadResponses, 276 ModifyUserData, 277 ModifyUserResponses, 278 ModifyVectorStoreData, 279 ModifyVectorStoreResponses, 280 PauseFineTuningJobData, 281 PauseFineTuningJobResponses, 282 ResumeFineTuningJobData, 283 ResumeFineTuningJobResponses, 284 RetrieveBatchData, 285 RetrieveBatchResponses, 286 RetrieveContainerData, 287 RetrieveContainerFileContentData, 288 RetrieveContainerFileContentResponses, 289 RetrieveContainerFileData, 290 RetrieveContainerFileResponses, 291 RetrieveContainerResponses, 292 RetrieveFileData, 293 RetrieveFileResponses, 294 RetrieveFineTuningJobData, 295 RetrieveFineTuningJobResponses, 296 RetrieveInviteData, 297 RetrieveInviteResponses, 298 RetrieveModelData, 299 RetrieveModelResponses, 300 RetrieveProjectApiKeyData, 301 RetrieveProjectApiKeyResponses, 302 RetrieveProjectData, 303 RetrieveProjectResponses, 304 RetrieveProjectServiceAccountData, 305 RetrieveProjectServiceAccountResponses, 306 RetrieveProjectUserData, 307 RetrieveProjectUserResponses, 308 RetrieveUserData, 309 RetrieveUserResponses, 310 RetrieveVectorStoreFileContentData, 311 RetrieveVectorStoreFileContentResponses, 312 RunGraderData, 313 RunGraderResponses, 314 SearchVectorStoreData, 315 SearchVectorStoreResponses, 316 SubmitToolOuputsToRunData, 317 SubmitToolOuputsToRunResponses, 318 UpdateChatCompletionData, 319 UpdateChatCompletionResponses, 320 UpdateEvalData, 321 UpdateEvalResponses, 322 UpdateProjectRateLimitsData, 323 UpdateProjectRateLimitsErrors, 324 UpdateProjectRateLimitsResponses, 325 UpdateVectorStoreFileAttributesData, 326 UpdateVectorStoreFileAttributesResponses, 327 UploadCertificateData, 328 UploadCertificateResponses, 329 UsageAudioSpeechesData, 330 UsageAudioSpeechesResponses, 331 UsageAudioTranscriptionsData, 332 UsageAudioTranscriptionsResponses, 333 UsageCodeInterpreterSessionsData, 334 UsageCodeInterpreterSessionsResponses, 335 UsageCompletionsData, 336 UsageCompletionsResponses, 337 UsageCostsData, 338 UsageCostsResponses, 339 UsageEmbeddingsData, 340 UsageEmbeddingsResponses, 341 UsageImagesData, 342 UsageImagesResponses, 343 UsageModerationsData, 344 UsageModerationsResponses, 345 UsageVectorStoresData, 346 UsageVectorStoresResponses, 347 ValidateGraderData, 348 ValidateGraderResponses, 349} from './types.gen'; 350 351export type Options< 352 TData extends TDataShape = TDataShape, 353 ThrowOnError extends boolean = boolean, 354> = Options2<TData, ThrowOnError> & { 355 /** 356 * You can provide a client instance returned by `createClient()` instead of 357 * individual options. This might be also useful if you want to implement a 358 * custom client. 359 */ 360 client?: Client; 361 /** 362 * You can pass arbitrary values through the `meta` object. This can be 363 * used to access values that aren't defined as part of the SDK function. 364 */ 365 meta?: Record<string, unknown>; 366}; 367 368class HeyApiClient { 369 protected client: Client; 370 371 constructor(args?: { client?: Client }) { 372 this.client = args?.client ?? client; 373 } 374} 375 376class HeyApiRegistry<T> { 377 private readonly defaultKey = 'default'; 378 379 private readonly instances: Map<string, T> = new Map(); 380 381 get(key?: string): T { 382 const instance = this.instances.get(key ?? this.defaultKey); 383 if (!instance) { 384 throw new Error( 385 `No SDK client found. Create one with "new OpenAi()" to fix this error.`, 386 ); 387 } 388 return instance; 389 } 390 391 set(value: T, key?: string): void { 392 this.instances.set(key ?? this.defaultKey, value); 393 } 394} 395 396export class OpenAi extends HeyApiClient { 397 public static readonly __registry = new HeyApiRegistry<OpenAi>(); 398 399 constructor(args?: { client?: Client; key?: string }) { 400 super(args); 401 OpenAi.__registry.set(this, args?.key); 402 } 403 404 /** 405 * List assistants 406 * 407 * Returns a list of assistants. 408 */ 409 public listAssistants<ThrowOnError extends boolean = false>( 410 options?: Options<ListAssistantsData, ThrowOnError>, 411 ) { 412 return (options?.client ?? this.client).get< 413 ListAssistantsResponses, 414 unknown, 415 ThrowOnError 416 >({ 417 security: [{ scheme: 'bearer', type: 'http' }], 418 url: '/assistants', 419 ...options, 420 }); 421 } 422 423 /** 424 * Create assistant 425 * 426 * Create an assistant with a model and instructions. 427 */ 428 public createAssistant<ThrowOnError extends boolean = false>( 429 options: Options<CreateAssistantData, ThrowOnError>, 430 ) { 431 return (options.client ?? this.client).post< 432 CreateAssistantResponses, 433 unknown, 434 ThrowOnError 435 >({ 436 security: [{ scheme: 'bearer', type: 'http' }], 437 url: '/assistants', 438 ...options, 439 headers: { 440 'Content-Type': 'application/json', 441 ...options.headers, 442 }, 443 }); 444 } 445 446 /** 447 * Delete assistant 448 * 449 * Delete an assistant. 450 */ 451 public deleteAssistant<ThrowOnError extends boolean = false>( 452 options: Options<DeleteAssistantData, ThrowOnError>, 453 ) { 454 return (options.client ?? this.client).delete< 455 DeleteAssistantResponses, 456 unknown, 457 ThrowOnError 458 >({ 459 security: [{ scheme: 'bearer', type: 'http' }], 460 url: '/assistants/{assistant_id}', 461 ...options, 462 }); 463 } 464 465 /** 466 * Retrieve assistant 467 * 468 * Retrieves an assistant. 469 */ 470 public getAssistant<ThrowOnError extends boolean = false>( 471 options: Options<GetAssistantData, ThrowOnError>, 472 ) { 473 return (options.client ?? this.client).get< 474 GetAssistantResponses, 475 unknown, 476 ThrowOnError 477 >({ 478 security: [{ scheme: 'bearer', type: 'http' }], 479 url: '/assistants/{assistant_id}', 480 ...options, 481 }); 482 } 483 484 /** 485 * Modify assistant 486 * 487 * Modifies an assistant. 488 */ 489 public modifyAssistant<ThrowOnError extends boolean = false>( 490 options: Options<ModifyAssistantData, ThrowOnError>, 491 ) { 492 return (options.client ?? this.client).post< 493 ModifyAssistantResponses, 494 unknown, 495 ThrowOnError 496 >({ 497 security: [{ scheme: 'bearer', type: 'http' }], 498 url: '/assistants/{assistant_id}', 499 ...options, 500 headers: { 501 'Content-Type': 'application/json', 502 ...options.headers, 503 }, 504 }); 505 } 506 507 /** 508 * Create speech 509 * 510 * Generates audio from the input text. 511 */ 512 public createSpeech<ThrowOnError extends boolean = false>( 513 options: Options<CreateSpeechData, ThrowOnError>, 514 ) { 515 return (options.client ?? this.client).post< 516 CreateSpeechResponses, 517 unknown, 518 ThrowOnError 519 >({ 520 security: [{ scheme: 'bearer', type: 'http' }], 521 url: '/audio/speech', 522 ...options, 523 headers: { 524 'Content-Type': 'application/json', 525 ...options.headers, 526 }, 527 }); 528 } 529 530 /** 531 * Create transcription 532 * 533 * Transcribes audio into the input language. 534 */ 535 public createTranscription<ThrowOnError extends boolean = false>( 536 options: Options<CreateTranscriptionData, ThrowOnError>, 537 ) { 538 return (options.client ?? this.client).post< 539 CreateTranscriptionResponses, 540 unknown, 541 ThrowOnError 542 >({ 543 ...formDataBodySerializer, 544 security: [{ scheme: 'bearer', type: 'http' }], 545 url: '/audio/transcriptions', 546 ...options, 547 headers: { 548 'Content-Type': null, 549 ...options.headers, 550 }, 551 }); 552 } 553 554 /** 555 * Create translation 556 * 557 * Translates audio into English. 558 */ 559 public createTranslation<ThrowOnError extends boolean = false>( 560 options: Options<CreateTranslationData, ThrowOnError>, 561 ) { 562 return (options.client ?? this.client).post< 563 CreateTranslationResponses, 564 unknown, 565 ThrowOnError 566 >({ 567 ...formDataBodySerializer, 568 security: [{ scheme: 'bearer', type: 'http' }], 569 url: '/audio/translations', 570 ...options, 571 headers: { 572 'Content-Type': null, 573 ...options.headers, 574 }, 575 }); 576 } 577 578 /** 579 * List batch 580 * 581 * List your organization's batches. 582 */ 583 public listBatches<ThrowOnError extends boolean = false>( 584 options?: Options<ListBatchesData, ThrowOnError>, 585 ) { 586 return (options?.client ?? this.client).get< 587 ListBatchesResponses, 588 unknown, 589 ThrowOnError 590 >({ 591 security: [{ scheme: 'bearer', type: 'http' }], 592 url: '/batches', 593 ...options, 594 }); 595 } 596 597 /** 598 * Create batch 599 * 600 * Creates and executes a batch from an uploaded file of requests 601 */ 602 public createBatch<ThrowOnError extends boolean = false>( 603 options: Options<CreateBatchData, ThrowOnError>, 604 ) { 605 return (options.client ?? this.client).post< 606 CreateBatchResponses, 607 unknown, 608 ThrowOnError 609 >({ 610 security: [{ scheme: 'bearer', type: 'http' }], 611 url: '/batches', 612 ...options, 613 headers: { 614 'Content-Type': 'application/json', 615 ...options.headers, 616 }, 617 }); 618 } 619 620 /** 621 * Retrieve batch 622 * 623 * Retrieves a batch. 624 */ 625 public retrieveBatch<ThrowOnError extends boolean = false>( 626 options: Options<RetrieveBatchData, ThrowOnError>, 627 ) { 628 return (options.client ?? this.client).get< 629 RetrieveBatchResponses, 630 unknown, 631 ThrowOnError 632 >({ 633 security: [{ scheme: 'bearer', type: 'http' }], 634 url: '/batches/{batch_id}', 635 ...options, 636 }); 637 } 638 639 /** 640 * Cancel batch 641 * 642 * Cancels an in-progress batch. The batch will be in status `cancelling` for up to 10 minutes, before changing to `cancelled`, where it will have partial results (if any) available in the output file. 643 */ 644 public cancelBatch<ThrowOnError extends boolean = false>( 645 options: Options<CancelBatchData, ThrowOnError>, 646 ) { 647 return (options.client ?? this.client).post< 648 CancelBatchResponses, 649 unknown, 650 ThrowOnError 651 >({ 652 security: [{ scheme: 'bearer', type: 'http' }], 653 url: '/batches/{batch_id}/cancel', 654 ...options, 655 }); 656 } 657 658 /** 659 * List Chat Completions 660 * 661 * List stored Chat Completions. Only Chat Completions that have been stored 662 * with the `store` parameter set to `true` will be returned. 663 * 664 */ 665 public listChatCompletions<ThrowOnError extends boolean = false>( 666 options?: Options<ListChatCompletionsData, ThrowOnError>, 667 ) { 668 return (options?.client ?? this.client).get< 669 ListChatCompletionsResponses, 670 unknown, 671 ThrowOnError 672 >({ 673 security: [{ scheme: 'bearer', type: 'http' }], 674 url: '/chat/completions', 675 ...options, 676 }); 677 } 678 679 /** 680 * Create chat completion 681 * 682 * **Starting a new project?** We recommend trying [Responses](https://platform.openai.com/docs/api-reference/responses) 683 * to take advantage of the latest OpenAI platform features. Compare 684 * [Chat Completions with Responses](https://platform.openai.com/docs/guides/responses-vs-chat-completions?api-mode=responses). 685 * 686 * --- 687 * 688 * Creates a model response for the given chat conversation. Learn more in the 689 * [text generation](https://platform.openai.com/docs/guides/text-generation), [vision](https://platform.openai.com/docs/guides/vision), 690 * and [audio](https://platform.openai.com/docs/guides/audio) guides. 691 * 692 * Parameter support can differ depending on the model used to generate the 693 * response, particularly for newer reasoning models. Parameters that are only 694 * supported for reasoning models are noted below. For the current state of 695 * unsupported parameters in reasoning models, 696 * [refer to the reasoning guide](https://platform.openai.com/docs/guides/reasoning). 697 * 698 */ 699 public createChatCompletion<ThrowOnError extends boolean = false>( 700 options: Options<CreateChatCompletionData, ThrowOnError>, 701 ) { 702 return (options.client ?? this.client).post< 703 CreateChatCompletionResponses, 704 unknown, 705 ThrowOnError 706 >({ 707 security: [{ scheme: 'bearer', type: 'http' }], 708 url: '/chat/completions', 709 ...options, 710 headers: { 711 'Content-Type': 'application/json', 712 ...options.headers, 713 }, 714 }); 715 } 716 717 /** 718 * Delete chat completion 719 * 720 * Delete a stored chat completion. Only Chat Completions that have been 721 * created with the `store` parameter set to `true` can be deleted. 722 * 723 */ 724 public deleteChatCompletion<ThrowOnError extends boolean = false>( 725 options: Options<DeleteChatCompletionData, ThrowOnError>, 726 ) { 727 return (options.client ?? this.client).delete< 728 DeleteChatCompletionResponses, 729 unknown, 730 ThrowOnError 731 >({ 732 security: [{ scheme: 'bearer', type: 'http' }], 733 url: '/chat/completions/{completion_id}', 734 ...options, 735 }); 736 } 737 738 /** 739 * Get chat completion 740 * 741 * Get a stored chat completion. Only Chat Completions that have been created 742 * with the `store` parameter set to `true` will be returned. 743 * 744 */ 745 public getChatCompletion<ThrowOnError extends boolean = false>( 746 options: Options<GetChatCompletionData, ThrowOnError>, 747 ) { 748 return (options.client ?? this.client).get< 749 GetChatCompletionResponses, 750 unknown, 751 ThrowOnError 752 >({ 753 security: [{ scheme: 'bearer', type: 'http' }], 754 url: '/chat/completions/{completion_id}', 755 ...options, 756 }); 757 } 758 759 /** 760 * Update chat completion 761 * 762 * Modify a stored chat completion. Only Chat Completions that have been 763 * created with the `store` parameter set to `true` can be modified. Currently, 764 * the only supported modification is to update the `metadata` field. 765 * 766 */ 767 public updateChatCompletion<ThrowOnError extends boolean = false>( 768 options: Options<UpdateChatCompletionData, ThrowOnError>, 769 ) { 770 return (options.client ?? this.client).post< 771 UpdateChatCompletionResponses, 772 unknown, 773 ThrowOnError 774 >({ 775 security: [{ scheme: 'bearer', type: 'http' }], 776 url: '/chat/completions/{completion_id}', 777 ...options, 778 headers: { 779 'Content-Type': 'application/json', 780 ...options.headers, 781 }, 782 }); 783 } 784 785 /** 786 * Get chat messages 787 * 788 * Get the messages in a stored chat completion. Only Chat Completions that 789 * have been created with the `store` parameter set to `true` will be 790 * returned. 791 * 792 */ 793 public getChatCompletionMessages<ThrowOnError extends boolean = false>( 794 options: Options<GetChatCompletionMessagesData, ThrowOnError>, 795 ) { 796 return (options.client ?? this.client).get< 797 GetChatCompletionMessagesResponses, 798 unknown, 799 ThrowOnError 800 >({ 801 security: [{ scheme: 'bearer', type: 'http' }], 802 url: '/chat/completions/{completion_id}/messages', 803 ...options, 804 }); 805 } 806 807 /** 808 * Create completion 809 * 810 * Creates a completion for the provided prompt and parameters. 811 */ 812 public createCompletion<ThrowOnError extends boolean = false>( 813 options: Options<CreateCompletionData, ThrowOnError>, 814 ) { 815 return (options.client ?? this.client).post< 816 CreateCompletionResponses, 817 unknown, 818 ThrowOnError 819 >({ 820 security: [{ scheme: 'bearer', type: 'http' }], 821 url: '/completions', 822 ...options, 823 headers: { 824 'Content-Type': 'application/json', 825 ...options.headers, 826 }, 827 }); 828 } 829 830 /** 831 * List containers 832 * 833 * List Containers 834 */ 835 public listContainers<ThrowOnError extends boolean = false>( 836 options?: Options<ListContainersData, ThrowOnError>, 837 ) { 838 return (options?.client ?? this.client).get< 839 ListContainersResponses, 840 unknown, 841 ThrowOnError 842 >({ 843 security: [{ scheme: 'bearer', type: 'http' }], 844 url: '/containers', 845 ...options, 846 }); 847 } 848 849 /** 850 * Create container 851 * 852 * Create Container 853 */ 854 public createContainer<ThrowOnError extends boolean = false>( 855 options?: Options<CreateContainerData, ThrowOnError>, 856 ) { 857 return (options?.client ?? this.client).post< 858 CreateContainerResponses, 859 unknown, 860 ThrowOnError 861 >({ 862 security: [{ scheme: 'bearer', type: 'http' }], 863 url: '/containers', 864 ...options, 865 headers: { 866 'Content-Type': 'application/json', 867 ...options?.headers, 868 }, 869 }); 870 } 871 872 /** 873 * Delete a container 874 * 875 * Delete Container 876 */ 877 public deleteContainer<ThrowOnError extends boolean = false>( 878 options: Options<DeleteContainerData, ThrowOnError>, 879 ) { 880 return (options.client ?? this.client).delete< 881 DeleteContainerResponses, 882 unknown, 883 ThrowOnError 884 >({ 885 security: [{ scheme: 'bearer', type: 'http' }], 886 url: '/containers/{container_id}', 887 ...options, 888 }); 889 } 890 891 /** 892 * Retrieve container 893 * 894 * Retrieve Container 895 */ 896 public retrieveContainer<ThrowOnError extends boolean = false>( 897 options: Options<RetrieveContainerData, ThrowOnError>, 898 ) { 899 return (options.client ?? this.client).get< 900 RetrieveContainerResponses, 901 unknown, 902 ThrowOnError 903 >({ 904 security: [{ scheme: 'bearer', type: 'http' }], 905 url: '/containers/{container_id}', 906 ...options, 907 }); 908 } 909 910 /** 911 * List container files 912 * 913 * List Container files 914 */ 915 public listContainerFiles<ThrowOnError extends boolean = false>( 916 options: Options<ListContainerFilesData, ThrowOnError>, 917 ) { 918 return (options.client ?? this.client).get< 919 ListContainerFilesResponses, 920 unknown, 921 ThrowOnError 922 >({ 923 security: [{ scheme: 'bearer', type: 'http' }], 924 url: '/containers/{container_id}/files', 925 ...options, 926 }); 927 } 928 929 /** 930 * Create container file 931 * 932 * Create a Container File 933 * 934 * You can send either a multipart/form-data request with the raw file content, or a JSON request with a file ID. 935 * 936 */ 937 public createContainerFile<ThrowOnError extends boolean = false>( 938 options: Options<CreateContainerFileData, ThrowOnError>, 939 ) { 940 return (options.client ?? this.client).post< 941 CreateContainerFileResponses, 942 unknown, 943 ThrowOnError 944 >({ 945 ...formDataBodySerializer, 946 security: [{ scheme: 'bearer', type: 'http' }], 947 url: '/containers/{container_id}/files', 948 ...options, 949 headers: { 950 'Content-Type': null, 951 ...options.headers, 952 }, 953 }); 954 } 955 956 /** 957 * Delete a container file 958 * 959 * Delete Container File 960 */ 961 public deleteContainerFile<ThrowOnError extends boolean = false>( 962 options: Options<DeleteContainerFileData, ThrowOnError>, 963 ) { 964 return (options.client ?? this.client).delete< 965 DeleteContainerFileResponses, 966 unknown, 967 ThrowOnError 968 >({ 969 security: [{ scheme: 'bearer', type: 'http' }], 970 url: '/containers/{container_id}/files/{file_id}', 971 ...options, 972 }); 973 } 974 975 /** 976 * Retrieve container file 977 * 978 * Retrieve Container File 979 */ 980 public retrieveContainerFile<ThrowOnError extends boolean = false>( 981 options: Options<RetrieveContainerFileData, ThrowOnError>, 982 ) { 983 return (options.client ?? this.client).get< 984 RetrieveContainerFileResponses, 985 unknown, 986 ThrowOnError 987 >({ 988 security: [{ scheme: 'bearer', type: 'http' }], 989 url: '/containers/{container_id}/files/{file_id}', 990 ...options, 991 }); 992 } 993 994 /** 995 * Retrieve container file content 996 * 997 * Retrieve Container File Content 998 */ 999 public retrieveContainerFileContent<ThrowOnError extends boolean = false>( 1000 options: Options<RetrieveContainerFileContentData, ThrowOnError>, 1001 ) { 1002 return (options.client ?? this.client).get< 1003 RetrieveContainerFileContentResponses, 1004 unknown, 1005 ThrowOnError 1006 >({ 1007 security: [{ scheme: 'bearer', type: 'http' }], 1008 url: '/containers/{container_id}/files/{file_id}/content', 1009 ...options, 1010 }); 1011 } 1012 1013 /** 1014 * Create embeddings 1015 * 1016 * Creates an embedding vector representing the input text. 1017 */ 1018 public createEmbedding<ThrowOnError extends boolean = false>( 1019 options: Options<CreateEmbeddingData, ThrowOnError>, 1020 ) { 1021 return (options.client ?? this.client).post< 1022 CreateEmbeddingResponses, 1023 unknown, 1024 ThrowOnError 1025 >({ 1026 security: [{ scheme: 'bearer', type: 'http' }], 1027 url: '/embeddings', 1028 ...options, 1029 headers: { 1030 'Content-Type': 'application/json', 1031 ...options.headers, 1032 }, 1033 }); 1034 } 1035 1036 /** 1037 * List evals 1038 * 1039 * List evaluations for a project. 1040 * 1041 */ 1042 public listEvals<ThrowOnError extends boolean = false>( 1043 options?: Options<ListEvalsData, ThrowOnError>, 1044 ) { 1045 return (options?.client ?? this.client).get< 1046 ListEvalsResponses, 1047 unknown, 1048 ThrowOnError 1049 >({ 1050 security: [{ scheme: 'bearer', type: 'http' }], 1051 url: '/evals', 1052 ...options, 1053 }); 1054 } 1055 1056 /** 1057 * Create eval 1058 * 1059 * Create the structure of an evaluation that can be used to test a model's performance. 1060 * An evaluation is a set of testing criteria and the config for a data source, which dictates the schema of the data used in the evaluation. After creating an evaluation, you can run it on different models and model parameters. We support several types of graders and datasources. 1061 * For more information, see the [Evals guide](https://platform.openai.com/docs/guides/evals). 1062 * 1063 */ 1064 public createEval<ThrowOnError extends boolean = false>( 1065 options: Options<CreateEvalData, ThrowOnError>, 1066 ) { 1067 return (options.client ?? this.client).post< 1068 CreateEvalResponses, 1069 unknown, 1070 ThrowOnError 1071 >({ 1072 security: [{ scheme: 'bearer', type: 'http' }], 1073 url: '/evals', 1074 ...options, 1075 headers: { 1076 'Content-Type': 'application/json', 1077 ...options.headers, 1078 }, 1079 }); 1080 } 1081 1082 /** 1083 * Delete an eval 1084 * 1085 * Delete an evaluation. 1086 * 1087 */ 1088 public deleteEval<ThrowOnError extends boolean = false>( 1089 options: Options<DeleteEvalData, ThrowOnError>, 1090 ) { 1091 return (options.client ?? this.client).delete< 1092 DeleteEvalResponses, 1093 DeleteEvalErrors, 1094 ThrowOnError 1095 >({ 1096 security: [{ scheme: 'bearer', type: 'http' }], 1097 url: '/evals/{eval_id}', 1098 ...options, 1099 }); 1100 } 1101 1102 /** 1103 * Get an eval 1104 * 1105 * Get an evaluation by ID. 1106 * 1107 */ 1108 public getEval<ThrowOnError extends boolean = false>( 1109 options: Options<GetEvalData, ThrowOnError>, 1110 ) { 1111 return (options.client ?? this.client).get< 1112 GetEvalResponses, 1113 unknown, 1114 ThrowOnError 1115 >({ 1116 security: [{ scheme: 'bearer', type: 'http' }], 1117 url: '/evals/{eval_id}', 1118 ...options, 1119 }); 1120 } 1121 1122 /** 1123 * Update an eval 1124 * 1125 * Update certain properties of an evaluation. 1126 * 1127 */ 1128 public updateEval<ThrowOnError extends boolean = false>( 1129 options: Options<UpdateEvalData, ThrowOnError>, 1130 ) { 1131 return (options.client ?? this.client).post< 1132 UpdateEvalResponses, 1133 unknown, 1134 ThrowOnError 1135 >({ 1136 security: [{ scheme: 'bearer', type: 'http' }], 1137 url: '/evals/{eval_id}', 1138 ...options, 1139 headers: { 1140 'Content-Type': 'application/json', 1141 ...options.headers, 1142 }, 1143 }); 1144 } 1145 1146 /** 1147 * Get eval runs 1148 * 1149 * Get a list of runs for an evaluation. 1150 * 1151 */ 1152 public getEvalRuns<ThrowOnError extends boolean = false>( 1153 options: Options<GetEvalRunsData, ThrowOnError>, 1154 ) { 1155 return (options.client ?? this.client).get< 1156 GetEvalRunsResponses, 1157 unknown, 1158 ThrowOnError 1159 >({ 1160 security: [{ scheme: 'bearer', type: 'http' }], 1161 url: '/evals/{eval_id}/runs', 1162 ...options, 1163 }); 1164 } 1165 1166 /** 1167 * Create eval run 1168 * 1169 * Kicks off a new run for a given evaluation, specifying the data source, and what model configuration to use to test. The datasource will be validated against the schema specified in the config of the evaluation. 1170 * 1171 */ 1172 public createEvalRun<ThrowOnError extends boolean = false>( 1173 options: Options<CreateEvalRunData, ThrowOnError>, 1174 ) { 1175 return (options.client ?? this.client).post< 1176 CreateEvalRunResponses, 1177 CreateEvalRunErrors, 1178 ThrowOnError 1179 >({ 1180 security: [{ scheme: 'bearer', type: 'http' }], 1181 url: '/evals/{eval_id}/runs', 1182 ...options, 1183 headers: { 1184 'Content-Type': 'application/json', 1185 ...options.headers, 1186 }, 1187 }); 1188 } 1189 1190 /** 1191 * Delete eval run 1192 * 1193 * Delete an eval run. 1194 * 1195 */ 1196 public deleteEvalRun<ThrowOnError extends boolean = false>( 1197 options: Options<DeleteEvalRunData, ThrowOnError>, 1198 ) { 1199 return (options.client ?? this.client).delete< 1200 DeleteEvalRunResponses, 1201 DeleteEvalRunErrors, 1202 ThrowOnError 1203 >({ 1204 security: [{ scheme: 'bearer', type: 'http' }], 1205 url: '/evals/{eval_id}/runs/{run_id}', 1206 ...options, 1207 }); 1208 } 1209 1210 /** 1211 * Get an eval run 1212 * 1213 * Get an evaluation run by ID. 1214 * 1215 */ 1216 public getEvalRun<ThrowOnError extends boolean = false>( 1217 options: Options<GetEvalRunData, ThrowOnError>, 1218 ) { 1219 return (options.client ?? this.client).get< 1220 GetEvalRunResponses, 1221 unknown, 1222 ThrowOnError 1223 >({ 1224 security: [{ scheme: 'bearer', type: 'http' }], 1225 url: '/evals/{eval_id}/runs/{run_id}', 1226 ...options, 1227 }); 1228 } 1229 1230 /** 1231 * Cancel eval run 1232 * 1233 * Cancel an ongoing evaluation run. 1234 * 1235 */ 1236 public cancelEvalRun<ThrowOnError extends boolean = false>( 1237 options: Options<CancelEvalRunData, ThrowOnError>, 1238 ) { 1239 return (options.client ?? this.client).post< 1240 CancelEvalRunResponses, 1241 unknown, 1242 ThrowOnError 1243 >({ 1244 security: [{ scheme: 'bearer', type: 'http' }], 1245 url: '/evals/{eval_id}/runs/{run_id}', 1246 ...options, 1247 }); 1248 } 1249 1250 /** 1251 * Get eval run output items 1252 * 1253 * Get a list of output items for an evaluation run. 1254 * 1255 */ 1256 public getEvalRunOutputItems<ThrowOnError extends boolean = false>( 1257 options: Options<GetEvalRunOutputItemsData, ThrowOnError>, 1258 ) { 1259 return (options.client ?? this.client).get< 1260 GetEvalRunOutputItemsResponses, 1261 unknown, 1262 ThrowOnError 1263 >({ 1264 security: [{ scheme: 'bearer', type: 'http' }], 1265 url: '/evals/{eval_id}/runs/{run_id}/output_items', 1266 ...options, 1267 }); 1268 } 1269 1270 /** 1271 * Get an output item of an eval run 1272 * 1273 * Get an evaluation run output item by ID. 1274 * 1275 */ 1276 public getEvalRunOutputItem<ThrowOnError extends boolean = false>( 1277 options: Options<GetEvalRunOutputItemData, ThrowOnError>, 1278 ) { 1279 return (options.client ?? this.client).get< 1280 GetEvalRunOutputItemResponses, 1281 unknown, 1282 ThrowOnError 1283 >({ 1284 security: [{ scheme: 'bearer', type: 'http' }], 1285 url: '/evals/{eval_id}/runs/{run_id}/output_items/{output_item_id}', 1286 ...options, 1287 }); 1288 } 1289 1290 /** 1291 * List files 1292 * 1293 * Returns a list of files. 1294 */ 1295 public listFiles<ThrowOnError extends boolean = false>( 1296 options?: Options<ListFilesData, ThrowOnError>, 1297 ) { 1298 return (options?.client ?? this.client).get< 1299 ListFilesResponses, 1300 unknown, 1301 ThrowOnError 1302 >({ 1303 security: [{ scheme: 'bearer', type: 'http' }], 1304 url: '/files', 1305 ...options, 1306 }); 1307 } 1308 1309 /** 1310 * Upload file 1311 * 1312 * Upload a file that can be used across various endpoints. Individual files can be up to 512 MB, and the size of all files uploaded by one organization can be up to 1 TB. 1313 * 1314 * The Assistants API supports files up to 2 million tokens and of specific file types. See the [Assistants Tools guide](https://platform.openai.com/docs/assistants/tools) for details. 1315 * 1316 * The Fine-tuning API only supports `.jsonl` files. The input also has certain required formats for fine-tuning [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input) or [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input) models. 1317 * 1318 * The Batch API only supports `.jsonl` files up to 200 MB in size. The input also has a specific required [format](https://platform.openai.com/docs/api-reference/batch/request-input). 1319 * 1320 * Please [contact us](https://help.openai.com/) if you need to increase these storage limits. 1321 * 1322 */ 1323 public createFile<ThrowOnError extends boolean = false>( 1324 options: Options<CreateFileData, ThrowOnError>, 1325 ) { 1326 return (options.client ?? this.client).post< 1327 CreateFileResponses, 1328 unknown, 1329 ThrowOnError 1330 >({ 1331 ...formDataBodySerializer, 1332 security: [{ scheme: 'bearer', type: 'http' }], 1333 url: '/files', 1334 ...options, 1335 headers: { 1336 'Content-Type': null, 1337 ...options.headers, 1338 }, 1339 }); 1340 } 1341 1342 /** 1343 * Delete file 1344 * 1345 * Delete a file. 1346 */ 1347 public deleteFile<ThrowOnError extends boolean = false>( 1348 options: Options<DeleteFileData, ThrowOnError>, 1349 ) { 1350 return (options.client ?? this.client).delete< 1351 DeleteFileResponses, 1352 unknown, 1353 ThrowOnError 1354 >({ 1355 security: [{ scheme: 'bearer', type: 'http' }], 1356 url: '/files/{file_id}', 1357 ...options, 1358 }); 1359 } 1360 1361 /** 1362 * Retrieve file 1363 * 1364 * Returns information about a specific file. 1365 */ 1366 public retrieveFile<ThrowOnError extends boolean = false>( 1367 options: Options<RetrieveFileData, ThrowOnError>, 1368 ) { 1369 return (options.client ?? this.client).get< 1370 RetrieveFileResponses, 1371 unknown, 1372 ThrowOnError 1373 >({ 1374 security: [{ scheme: 'bearer', type: 'http' }], 1375 url: '/files/{file_id}', 1376 ...options, 1377 }); 1378 } 1379 1380 /** 1381 * Retrieve file content 1382 * 1383 * Returns the contents of the specified file. 1384 */ 1385 public downloadFile<ThrowOnError extends boolean = false>( 1386 options: Options<DownloadFileData, ThrowOnError>, 1387 ) { 1388 return (options.client ?? this.client).get< 1389 DownloadFileResponses, 1390 unknown, 1391 ThrowOnError 1392 >({ 1393 security: [{ scheme: 'bearer', type: 'http' }], 1394 url: '/files/{file_id}/content', 1395 ...options, 1396 }); 1397 } 1398 1399 /** 1400 * Run grader 1401 * 1402 * Run a grader. 1403 * 1404 */ 1405 public runGrader<ThrowOnError extends boolean = false>( 1406 options: Options<RunGraderData, ThrowOnError>, 1407 ) { 1408 return (options.client ?? this.client).post< 1409 RunGraderResponses, 1410 unknown, 1411 ThrowOnError 1412 >({ 1413 security: [{ scheme: 'bearer', type: 'http' }], 1414 url: '/fine_tuning/alpha/graders/run', 1415 ...options, 1416 headers: { 1417 'Content-Type': 'application/json', 1418 ...options.headers, 1419 }, 1420 }); 1421 } 1422 1423 /** 1424 * Validate grader 1425 * 1426 * Validate a grader. 1427 * 1428 */ 1429 public validateGrader<ThrowOnError extends boolean = false>( 1430 options: Options<ValidateGraderData, ThrowOnError>, 1431 ) { 1432 return (options.client ?? this.client).post< 1433 ValidateGraderResponses, 1434 unknown, 1435 ThrowOnError 1436 >({ 1437 security: [{ scheme: 'bearer', type: 'http' }], 1438 url: '/fine_tuning/alpha/graders/validate', 1439 ...options, 1440 headers: { 1441 'Content-Type': 'application/json', 1442 ...options.headers, 1443 }, 1444 }); 1445 } 1446 1447 /** 1448 * List checkpoint permissions 1449 * 1450 * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys). 1451 * 1452 * Organization owners can use this endpoint to view all permissions for a fine-tuned model checkpoint. 1453 * 1454 */ 1455 public listFineTuningCheckpointPermissions< 1456 ThrowOnError extends boolean = false, 1457 >(options: Options<ListFineTuningCheckpointPermissionsData, ThrowOnError>) { 1458 return (options.client ?? this.client).get< 1459 ListFineTuningCheckpointPermissionsResponses, 1460 unknown, 1461 ThrowOnError 1462 >({ 1463 security: [{ scheme: 'bearer', type: 'http' }], 1464 url: '/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions', 1465 ...options, 1466 }); 1467 } 1468 1469 /** 1470 * Create checkpoint permissions 1471 * 1472 * **NOTE:** Calling this endpoint requires an [admin API key](../admin-api-keys). 1473 * 1474 * This enables organization owners to share fine-tuned models with other projects in their organization. 1475 * 1476 */ 1477 public createFineTuningCheckpointPermission< 1478 ThrowOnError extends boolean = false, 1479 >(options: Options<CreateFineTuningCheckpointPermissionData, ThrowOnError>) { 1480 return (options.client ?? this.client).post< 1481 CreateFineTuningCheckpointPermissionResponses, 1482 unknown, 1483 ThrowOnError 1484 >({ 1485 security: [{ scheme: 'bearer', type: 'http' }], 1486 url: '/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions', 1487 ...options, 1488 headers: { 1489 'Content-Type': 'application/json', 1490 ...options.headers, 1491 }, 1492 }); 1493 } 1494 1495 /** 1496 * Delete checkpoint permission 1497 * 1498 * **NOTE:** This endpoint requires an [admin API key](../admin-api-keys). 1499 * 1500 * Organization owners can use this endpoint to delete a permission for a fine-tuned model checkpoint. 1501 * 1502 */ 1503 public deleteFineTuningCheckpointPermission< 1504 ThrowOnError extends boolean = false, 1505 >(options: Options<DeleteFineTuningCheckpointPermissionData, ThrowOnError>) { 1506 return (options.client ?? this.client).delete< 1507 DeleteFineTuningCheckpointPermissionResponses, 1508 unknown, 1509 ThrowOnError 1510 >({ 1511 security: [{ scheme: 'bearer', type: 'http' }], 1512 url: '/fine_tuning/checkpoints/{fine_tuned_model_checkpoint}/permissions/{permission_id}', 1513 ...options, 1514 }); 1515 } 1516 1517 /** 1518 * List fine-tuning jobs 1519 * 1520 * List your organization's fine-tuning jobs 1521 * 1522 */ 1523 public listPaginatedFineTuningJobs<ThrowOnError extends boolean = false>( 1524 options?: Options<ListPaginatedFineTuningJobsData, ThrowOnError>, 1525 ) { 1526 return (options?.client ?? this.client).get< 1527 ListPaginatedFineTuningJobsResponses, 1528 unknown, 1529 ThrowOnError 1530 >({ 1531 security: [{ scheme: 'bearer', type: 'http' }], 1532 url: '/fine_tuning/jobs', 1533 ...options, 1534 }); 1535 } 1536 1537 /** 1538 * Create fine-tuning job 1539 * 1540 * Creates a fine-tuning job which begins the process of creating a new model from a given dataset. 1541 * 1542 * Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete. 1543 * 1544 * [Learn more about fine-tuning](https://platform.openai.com/docs/guides/model-optimization) 1545 * 1546 */ 1547 public createFineTuningJob<ThrowOnError extends boolean = false>( 1548 options: Options<CreateFineTuningJobData, ThrowOnError>, 1549 ) { 1550 return (options.client ?? this.client).post< 1551 CreateFineTuningJobResponses, 1552 unknown, 1553 ThrowOnError 1554 >({ 1555 security: [{ scheme: 'bearer', type: 'http' }], 1556 url: '/fine_tuning/jobs', 1557 ...options, 1558 headers: { 1559 'Content-Type': 'application/json', 1560 ...options.headers, 1561 }, 1562 }); 1563 } 1564 1565 /** 1566 * Retrieve fine-tuning job 1567 * 1568 * Get info about a fine-tuning job. 1569 * 1570 * [Learn more about fine-tuning](https://platform.openai.com/docs/guides/model-optimization) 1571 * 1572 */ 1573 public retrieveFineTuningJob<ThrowOnError extends boolean = false>( 1574 options: Options<RetrieveFineTuningJobData, ThrowOnError>, 1575 ) { 1576 return (options.client ?? this.client).get< 1577 RetrieveFineTuningJobResponses, 1578 unknown, 1579 ThrowOnError 1580 >({ 1581 security: [{ scheme: 'bearer', type: 'http' }], 1582 url: '/fine_tuning/jobs/{fine_tuning_job_id}', 1583 ...options, 1584 }); 1585 } 1586 1587 /** 1588 * Cancel fine-tuning 1589 * 1590 * Immediately cancel a fine-tune job. 1591 * 1592 */ 1593 public cancelFineTuningJob<ThrowOnError extends boolean = false>( 1594 options: Options<CancelFineTuningJobData, ThrowOnError>, 1595 ) { 1596 return (options.client ?? this.client).post< 1597 CancelFineTuningJobResponses, 1598 unknown, 1599 ThrowOnError 1600 >({ 1601 security: [{ scheme: 'bearer', type: 'http' }], 1602 url: '/fine_tuning/jobs/{fine_tuning_job_id}/cancel', 1603 ...options, 1604 }); 1605 } 1606 1607 /** 1608 * List fine-tuning checkpoints 1609 * 1610 * List checkpoints for a fine-tuning job. 1611 * 1612 */ 1613 public listFineTuningJobCheckpoints<ThrowOnError extends boolean = false>( 1614 options: Options<ListFineTuningJobCheckpointsData, ThrowOnError>, 1615 ) { 1616 return (options.client ?? this.client).get< 1617 ListFineTuningJobCheckpointsResponses, 1618 unknown, 1619 ThrowOnError 1620 >({ 1621 security: [{ scheme: 'bearer', type: 'http' }], 1622 url: '/fine_tuning/jobs/{fine_tuning_job_id}/checkpoints', 1623 ...options, 1624 }); 1625 } 1626 1627 /** 1628 * List fine-tuning events 1629 * 1630 * Get status updates for a fine-tuning job. 1631 * 1632 */ 1633 public listFineTuningEvents<ThrowOnError extends boolean = false>( 1634 options: Options<ListFineTuningEventsData, ThrowOnError>, 1635 ) { 1636 return (options.client ?? this.client).get< 1637 ListFineTuningEventsResponses, 1638 unknown, 1639 ThrowOnError 1640 >({ 1641 security: [{ scheme: 'bearer', type: 'http' }], 1642 url: '/fine_tuning/jobs/{fine_tuning_job_id}/events', 1643 ...options, 1644 }); 1645 } 1646 1647 /** 1648 * Pause fine-tuning 1649 * 1650 * Pause a fine-tune job. 1651 * 1652 */ 1653 public pauseFineTuningJob<ThrowOnError extends boolean = false>( 1654 options: Options<PauseFineTuningJobData, ThrowOnError>, 1655 ) { 1656 return (options.client ?? this.client).post< 1657 PauseFineTuningJobResponses, 1658 unknown, 1659 ThrowOnError 1660 >({ 1661 security: [{ scheme: 'bearer', type: 'http' }], 1662 url: '/fine_tuning/jobs/{fine_tuning_job_id}/pause', 1663 ...options, 1664 }); 1665 } 1666 1667 /** 1668 * Resume fine-tuning 1669 * 1670 * Resume a fine-tune job. 1671 * 1672 */ 1673 public resumeFineTuningJob<ThrowOnError extends boolean = false>( 1674 options: Options<ResumeFineTuningJobData, ThrowOnError>, 1675 ) { 1676 return (options.client ?? this.client).post< 1677 ResumeFineTuningJobResponses, 1678 unknown, 1679 ThrowOnError 1680 >({ 1681 security: [{ scheme: 'bearer', type: 'http' }], 1682 url: '/fine_tuning/jobs/{fine_tuning_job_id}/resume', 1683 ...options, 1684 }); 1685 } 1686 1687 /** 1688 * Create image edit 1689 * 1690 * Creates an edited or extended image given one or more source images and a prompt. This endpoint only supports `gpt-image-1` and `dall-e-2`. 1691 */ 1692 public createImageEdit<ThrowOnError extends boolean = false>( 1693 options: Options<CreateImageEditData, ThrowOnError>, 1694 ) { 1695 return (options.client ?? this.client).post< 1696 CreateImageEditResponses, 1697 unknown, 1698 ThrowOnError 1699 >({ 1700 ...formDataBodySerializer, 1701 security: [{ scheme: 'bearer', type: 'http' }], 1702 url: '/images/edits', 1703 ...options, 1704 headers: { 1705 'Content-Type': null, 1706 ...options.headers, 1707 }, 1708 }); 1709 } 1710 1711 /** 1712 * Create image 1713 * 1714 * Creates an image given a prompt. [Learn more](https://platform.openai.com/docs/guides/images). 1715 * 1716 */ 1717 public createImage<ThrowOnError extends boolean = false>( 1718 options: Options<CreateImageData, ThrowOnError>, 1719 ) { 1720 return (options.client ?? this.client).post< 1721 CreateImageResponses, 1722 unknown, 1723 ThrowOnError 1724 >({ 1725 security: [{ scheme: 'bearer', type: 'http' }], 1726 url: '/images/generations', 1727 ...options, 1728 headers: { 1729 'Content-Type': 'application/json', 1730 ...options.headers, 1731 }, 1732 }); 1733 } 1734 1735 /** 1736 * Create image variation 1737 * 1738 * Creates a variation of a given image. This endpoint only supports `dall-e-2`. 1739 */ 1740 public createImageVariation<ThrowOnError extends boolean = false>( 1741 options: Options<CreateImageVariationData, ThrowOnError>, 1742 ) { 1743 return (options.client ?? this.client).post< 1744 CreateImageVariationResponses, 1745 unknown, 1746 ThrowOnError 1747 >({ 1748 ...formDataBodySerializer, 1749 security: [{ scheme: 'bearer', type: 'http' }], 1750 url: '/images/variations', 1751 ...options, 1752 headers: { 1753 'Content-Type': null, 1754 ...options.headers, 1755 }, 1756 }); 1757 } 1758 1759 /** 1760 * List models 1761 * 1762 * Lists the currently available models, and provides basic information about each one such as the owner and availability. 1763 */ 1764 public listModels<ThrowOnError extends boolean = false>( 1765 options?: Options<ListModelsData, ThrowOnError>, 1766 ) { 1767 return (options?.client ?? this.client).get< 1768 ListModelsResponses, 1769 unknown, 1770 ThrowOnError 1771 >({ 1772 security: [{ scheme: 'bearer', type: 'http' }], 1773 url: '/models', 1774 ...options, 1775 }); 1776 } 1777 1778 /** 1779 * Delete a fine-tuned model 1780 * 1781 * Delete a fine-tuned model. You must have the Owner role in your organization to delete a model. 1782 */ 1783 public deleteModel<ThrowOnError extends boolean = false>( 1784 options: Options<DeleteModelData, ThrowOnError>, 1785 ) { 1786 return (options.client ?? this.client).delete< 1787 DeleteModelResponses, 1788 unknown, 1789 ThrowOnError 1790 >({ 1791 security: [{ scheme: 'bearer', type: 'http' }], 1792 url: '/models/{model}', 1793 ...options, 1794 }); 1795 } 1796 1797 /** 1798 * Retrieve model 1799 * 1800 * Retrieves a model instance, providing basic information about the model such as the owner and permissioning. 1801 */ 1802 public retrieveModel<ThrowOnError extends boolean = false>( 1803 options: Options<RetrieveModelData, ThrowOnError>, 1804 ) { 1805 return (options.client ?? this.client).get< 1806 RetrieveModelResponses, 1807 unknown, 1808 ThrowOnError 1809 >({ 1810 security: [{ scheme: 'bearer', type: 'http' }], 1811 url: '/models/{model}', 1812 ...options, 1813 }); 1814 } 1815 1816 /** 1817 * Create moderation 1818 * 1819 * Classifies if text and/or image inputs are potentially harmful. Learn 1820 * more in the [moderation guide](https://platform.openai.com/docs/guides/moderation). 1821 * 1822 */ 1823 public createModeration<ThrowOnError extends boolean = false>( 1824 options: Options<CreateModerationData, ThrowOnError>, 1825 ) { 1826 return (options.client ?? this.client).post< 1827 CreateModerationResponses, 1828 unknown, 1829 ThrowOnError 1830 >({ 1831 security: [{ scheme: 'bearer', type: 'http' }], 1832 url: '/moderations', 1833 ...options, 1834 headers: { 1835 'Content-Type': 'application/json', 1836 ...options.headers, 1837 }, 1838 }); 1839 } 1840 1841 /** 1842 * List all organization and project API keys. 1843 * 1844 * List organization API keys 1845 */ 1846 public adminApiKeysList<ThrowOnError extends boolean = false>( 1847 options?: Options<AdminApiKeysListData, ThrowOnError>, 1848 ) { 1849 return (options?.client ?? this.client).get< 1850 AdminApiKeysListResponses, 1851 unknown, 1852 ThrowOnError 1853 >({ 1854 security: [{ scheme: 'bearer', type: 'http' }], 1855 url: '/organization/admin_api_keys', 1856 ...options, 1857 }); 1858 } 1859 1860 /** 1861 * Create admin API key 1862 * 1863 * Create an organization admin API key 1864 */ 1865 public adminApiKeysCreate<ThrowOnError extends boolean = false>( 1866 options: Options<AdminApiKeysCreateData, ThrowOnError>, 1867 ) { 1868 return (options.client ?? this.client).post< 1869 AdminApiKeysCreateResponses, 1870 unknown, 1871 ThrowOnError 1872 >({ 1873 security: [{ scheme: 'bearer', type: 'http' }], 1874 url: '/organization/admin_api_keys', 1875 ...options, 1876 headers: { 1877 'Content-Type': 'application/json', 1878 ...options.headers, 1879 }, 1880 }); 1881 } 1882 1883 /** 1884 * Delete admin API key 1885 * 1886 * Delete an organization admin API key 1887 */ 1888 public adminApiKeysDelete<ThrowOnError extends boolean = false>( 1889 options: Options<AdminApiKeysDeleteData, ThrowOnError>, 1890 ) { 1891 return (options.client ?? this.client).delete< 1892 AdminApiKeysDeleteResponses, 1893 unknown, 1894 ThrowOnError 1895 >({ 1896 security: [{ scheme: 'bearer', type: 'http' }], 1897 url: '/organization/admin_api_keys/{key_id}', 1898 ...options, 1899 }); 1900 } 1901 1902 /** 1903 * Retrieve admin API key 1904 * 1905 * Retrieve a single organization API key 1906 */ 1907 public adminApiKeysGet<ThrowOnError extends boolean = false>( 1908 options: Options<AdminApiKeysGetData, ThrowOnError>, 1909 ) { 1910 return (options.client ?? this.client).get< 1911 AdminApiKeysGetResponses, 1912 unknown, 1913 ThrowOnError 1914 >({ 1915 security: [{ scheme: 'bearer', type: 'http' }], 1916 url: '/organization/admin_api_keys/{key_id}', 1917 ...options, 1918 }); 1919 } 1920 1921 /** 1922 * List audit logs 1923 * 1924 * List user actions and configuration changes within this organization. 1925 */ 1926 public listAuditLogs<ThrowOnError extends boolean = false>( 1927 options?: Options<ListAuditLogsData, ThrowOnError>, 1928 ) { 1929 return (options?.client ?? this.client).get< 1930 ListAuditLogsResponses, 1931 unknown, 1932 ThrowOnError 1933 >({ 1934 querySerializer: { 1935 parameters: { effective_at: { object: { style: 'form' } } }, 1936 }, 1937 security: [{ scheme: 'bearer', type: 'http' }], 1938 url: '/organization/audit_logs', 1939 ...options, 1940 }); 1941 } 1942 1943 /** 1944 * List organization certificates 1945 * 1946 * List uploaded certificates for this organization. 1947 */ 1948 public listOrganizationCertificates<ThrowOnError extends boolean = false>( 1949 options?: Options<ListOrganizationCertificatesData, ThrowOnError>, 1950 ) { 1951 return (options?.client ?? this.client).get< 1952 ListOrganizationCertificatesResponses, 1953 unknown, 1954 ThrowOnError 1955 >({ 1956 security: [{ scheme: 'bearer', type: 'http' }], 1957 url: '/organization/certificates', 1958 ...options, 1959 }); 1960 } 1961 1962 /** 1963 * Upload certificate 1964 * 1965 * Upload a certificate to the organization. This does **not** automatically activate the certificate. 1966 * 1967 * Organizations can upload up to 50 certificates. 1968 * 1969 */ 1970 public uploadCertificate<ThrowOnError extends boolean = false>( 1971 options: Options<UploadCertificateData, ThrowOnError>, 1972 ) { 1973 return (options.client ?? this.client).post< 1974 UploadCertificateResponses, 1975 unknown, 1976 ThrowOnError 1977 >({ 1978 security: [{ scheme: 'bearer', type: 'http' }], 1979 url: '/organization/certificates', 1980 ...options, 1981 headers: { 1982 'Content-Type': 'application/json', 1983 ...options.headers, 1984 }, 1985 }); 1986 } 1987 1988 /** 1989 * Activate certificates for organization 1990 * 1991 * Activate certificates at the organization level. 1992 * 1993 * You can atomically and idempotently activate up to 10 certificates at a time. 1994 * 1995 */ 1996 public activateOrganizationCertificates<ThrowOnError extends boolean = false>( 1997 options: Options<ActivateOrganizationCertificatesData, ThrowOnError>, 1998 ) { 1999 return (options.client ?? this.client).post< 2000 ActivateOrganizationCertificatesResponses, 2001 unknown, 2002 ThrowOnError 2003 >({ 2004 security: [{ scheme: 'bearer', type: 'http' }], 2005 url: '/organization/certificates/activate', 2006 ...options, 2007 headers: { 2008 'Content-Type': 'application/json', 2009 ...options.headers, 2010 }, 2011 }); 2012 } 2013 2014 /** 2015 * Deactivate certificates for organization 2016 * 2017 * Deactivate certificates at the organization level. 2018 * 2019 * You can atomically and idempotently deactivate up to 10 certificates at a time. 2020 * 2021 */ 2022 public deactivateOrganizationCertificates< 2023 ThrowOnError extends boolean = false, 2024 >(options: Options<DeactivateOrganizationCertificatesData, ThrowOnError>) { 2025 return (options.client ?? this.client).post< 2026 DeactivateOrganizationCertificatesResponses, 2027 unknown, 2028 ThrowOnError 2029 >({ 2030 security: [{ scheme: 'bearer', type: 'http' }], 2031 url: '/organization/certificates/deactivate', 2032 ...options, 2033 headers: { 2034 'Content-Type': 'application/json', 2035 ...options.headers, 2036 }, 2037 }); 2038 } 2039 2040 /** 2041 * Delete certificate 2042 * 2043 * Delete a certificate from the organization. 2044 * 2045 * The certificate must be inactive for the organization and all projects. 2046 * 2047 */ 2048 public deleteCertificate<ThrowOnError extends boolean = false>( 2049 options?: Options<DeleteCertificateData, ThrowOnError>, 2050 ) { 2051 return (options?.client ?? this.client).delete< 2052 DeleteCertificateResponses, 2053 unknown, 2054 ThrowOnError 2055 >({ 2056 security: [{ scheme: 'bearer', type: 'http' }], 2057 url: '/organization/certificates/{certificate_id}', 2058 ...options, 2059 }); 2060 } 2061 2062 /** 2063 * Get certificate 2064 * 2065 * Get a certificate that has been uploaded to the organization. 2066 * 2067 * You can get a certificate regardless of whether it is active or not. 2068 * 2069 */ 2070 public getCertificate<ThrowOnError extends boolean = false>( 2071 options: Options<GetCertificateData, ThrowOnError>, 2072 ) { 2073 return (options.client ?? this.client).get< 2074 GetCertificateResponses, 2075 unknown, 2076 ThrowOnError 2077 >({ 2078 security: [{ scheme: 'bearer', type: 'http' }], 2079 url: '/organization/certificates/{certificate_id}', 2080 ...options, 2081 }); 2082 } 2083 2084 /** 2085 * Modify certificate 2086 * 2087 * Modify a certificate. Note that only the name can be modified. 2088 * 2089 */ 2090 public modifyCertificate<ThrowOnError extends boolean = false>( 2091 options: Options<ModifyCertificateData, ThrowOnError>, 2092 ) { 2093 return (options.client ?? this.client).post< 2094 ModifyCertificateResponses, 2095 unknown, 2096 ThrowOnError 2097 >({ 2098 security: [{ scheme: 'bearer', type: 'http' }], 2099 url: '/organization/certificates/{certificate_id}', 2100 ...options, 2101 headers: { 2102 'Content-Type': 'application/json', 2103 ...options.headers, 2104 }, 2105 }); 2106 } 2107 2108 /** 2109 * Costs 2110 * 2111 * Get costs details for the organization. 2112 */ 2113 public usageCosts<ThrowOnError extends boolean = false>( 2114 options: Options<UsageCostsData, ThrowOnError>, 2115 ) { 2116 return (options.client ?? this.client).get< 2117 UsageCostsResponses, 2118 unknown, 2119 ThrowOnError 2120 >({ 2121 security: [{ scheme: 'bearer', type: 'http' }], 2122 url: '/organization/costs', 2123 ...options, 2124 }); 2125 } 2126 2127 /** 2128 * List invites 2129 * 2130 * Returns a list of invites in the organization. 2131 */ 2132 public listInvites<ThrowOnError extends boolean = false>( 2133 options?: Options<ListInvitesData, ThrowOnError>, 2134 ) { 2135 return (options?.client ?? this.client).get< 2136 ListInvitesResponses, 2137 unknown, 2138 ThrowOnError 2139 >({ 2140 security: [{ scheme: 'bearer', type: 'http' }], 2141 url: '/organization/invites', 2142 ...options, 2143 }); 2144 } 2145 2146 /** 2147 * Create invite 2148 * 2149 * Create an invite for a user to the organization. The invite must be accepted by the user before they have access to the organization. 2150 */ 2151 public inviteUser<ThrowOnError extends boolean = false>( 2152 options: Options<InviteUserData, ThrowOnError>, 2153 ) { 2154 return (options.client ?? this.client).post< 2155 InviteUserResponses, 2156 unknown, 2157 ThrowOnError 2158 >({ 2159 security: [{ scheme: 'bearer', type: 'http' }], 2160 url: '/organization/invites', 2161 ...options, 2162 headers: { 2163 'Content-Type': 'application/json', 2164 ...options.headers, 2165 }, 2166 }); 2167 } 2168 2169 /** 2170 * Delete invite 2171 * 2172 * Delete an invite. If the invite has already been accepted, it cannot be deleted. 2173 */ 2174 public deleteInvite<ThrowOnError extends boolean = false>( 2175 options: Options<DeleteInviteData, ThrowOnError>, 2176 ) { 2177 return (options.client ?? this.client).delete< 2178 DeleteInviteResponses, 2179 unknown, 2180 ThrowOnError 2181 >({ 2182 security: [{ scheme: 'bearer', type: 'http' }], 2183 url: '/organization/invites/{invite_id}', 2184 ...options, 2185 }); 2186 } 2187 2188 /** 2189 * Retrieve invite 2190 * 2191 * Retrieves an invite. 2192 */ 2193 public retrieveInvite<ThrowOnError extends boolean = false>( 2194 options: Options<RetrieveInviteData, ThrowOnError>, 2195 ) { 2196 return (options.client ?? this.client).get< 2197 RetrieveInviteResponses, 2198 unknown, 2199 ThrowOnError 2200 >({ 2201 security: [{ scheme: 'bearer', type: 'http' }], 2202 url: '/organization/invites/{invite_id}', 2203 ...options, 2204 }); 2205 } 2206 2207 /** 2208 * List projects 2209 * 2210 * Returns a list of projects. 2211 */ 2212 public listProjects<ThrowOnError extends boolean = false>( 2213 options?: Options<ListProjectsData, ThrowOnError>, 2214 ) { 2215 return (options?.client ?? this.client).get< 2216 ListProjectsResponses, 2217 unknown, 2218 ThrowOnError 2219 >({ 2220 security: [{ scheme: 'bearer', type: 'http' }], 2221 url: '/organization/projects', 2222 ...options, 2223 }); 2224 } 2225 2226 /** 2227 * Create project 2228 * 2229 * Create a new project in the organization. Projects can be created and archived, but cannot be deleted. 2230 */ 2231 public createProject<ThrowOnError extends boolean = false>( 2232 options: Options<CreateProjectData, ThrowOnError>, 2233 ) { 2234 return (options.client ?? this.client).post< 2235 CreateProjectResponses, 2236 unknown, 2237 ThrowOnError 2238 >({ 2239 security: [{ scheme: 'bearer', type: 'http' }], 2240 url: '/organization/projects', 2241 ...options, 2242 headers: { 2243 'Content-Type': 'application/json', 2244 ...options.headers, 2245 }, 2246 }); 2247 } 2248 2249 /** 2250 * Retrieve project 2251 * 2252 * Retrieves a project. 2253 */ 2254 public retrieveProject<ThrowOnError extends boolean = false>( 2255 options: Options<RetrieveProjectData, ThrowOnError>, 2256 ) { 2257 return (options.client ?? this.client).get< 2258 RetrieveProjectResponses, 2259 unknown, 2260 ThrowOnError 2261 >({ 2262 security: [{ scheme: 'bearer', type: 'http' }], 2263 url: '/organization/projects/{project_id}', 2264 ...options, 2265 }); 2266 } 2267 2268 /** 2269 * Modify project 2270 * 2271 * Modifies a project in the organization. 2272 */ 2273 public modifyProject<ThrowOnError extends boolean = false>( 2274 options: Options<ModifyProjectData, ThrowOnError>, 2275 ) { 2276 return (options.client ?? this.client).post< 2277 ModifyProjectResponses, 2278 ModifyProjectErrors, 2279 ThrowOnError 2280 >({ 2281 security: [{ scheme: 'bearer', type: 'http' }], 2282 url: '/organization/projects/{project_id}', 2283 ...options, 2284 headers: { 2285 'Content-Type': 'application/json', 2286 ...options.headers, 2287 }, 2288 }); 2289 } 2290 2291 /** 2292 * List project API keys 2293 * 2294 * Returns a list of API keys in the project. 2295 */ 2296 public listProjectApiKeys<ThrowOnError extends boolean = false>( 2297 options: Options<ListProjectApiKeysData, ThrowOnError>, 2298 ) { 2299 return (options.client ?? this.client).get< 2300 ListProjectApiKeysResponses, 2301 unknown, 2302 ThrowOnError 2303 >({ 2304 security: [{ scheme: 'bearer', type: 'http' }], 2305 url: '/organization/projects/{project_id}/api_keys', 2306 ...options, 2307 }); 2308 } 2309 2310 /** 2311 * Delete project API key 2312 * 2313 * Deletes an API key from the project. 2314 */ 2315 public deleteProjectApiKey<ThrowOnError extends boolean = false>( 2316 options: Options<DeleteProjectApiKeyData, ThrowOnError>, 2317 ) { 2318 return (options.client ?? this.client).delete< 2319 DeleteProjectApiKeyResponses, 2320 DeleteProjectApiKeyErrors, 2321 ThrowOnError 2322 >({ 2323 security: [{ scheme: 'bearer', type: 'http' }], 2324 url: '/organization/projects/{project_id}/api_keys/{key_id}', 2325 ...options, 2326 }); 2327 } 2328 2329 /** 2330 * Retrieve project API key 2331 * 2332 * Retrieves an API key in the project. 2333 */ 2334 public retrieveProjectApiKey<ThrowOnError extends boolean = false>( 2335 options: Options<RetrieveProjectApiKeyData, ThrowOnError>, 2336 ) { 2337 return (options.client ?? this.client).get< 2338 RetrieveProjectApiKeyResponses, 2339 unknown, 2340 ThrowOnError 2341 >({ 2342 security: [{ scheme: 'bearer', type: 'http' }], 2343 url: '/organization/projects/{project_id}/api_keys/{key_id}', 2344 ...options, 2345 }); 2346 } 2347 2348 /** 2349 * Archive project 2350 * 2351 * Archives a project in the organization. Archived projects cannot be used or updated. 2352 */ 2353 public archiveProject<ThrowOnError extends boolean = false>( 2354 options: Options<ArchiveProjectData, ThrowOnError>, 2355 ) { 2356 return (options.client ?? this.client).post< 2357 ArchiveProjectResponses, 2358 unknown, 2359 ThrowOnError 2360 >({ 2361 security: [{ scheme: 'bearer', type: 'http' }], 2362 url: '/organization/projects/{project_id}/archive', 2363 ...options, 2364 }); 2365 } 2366 2367 /** 2368 * List project certificates 2369 * 2370 * List certificates for this project. 2371 */ 2372 public listProjectCertificates<ThrowOnError extends boolean = false>( 2373 options: Options<ListProjectCertificatesData, ThrowOnError>, 2374 ) { 2375 return (options.client ?? this.client).get< 2376 ListProjectCertificatesResponses, 2377 unknown, 2378 ThrowOnError 2379 >({ 2380 security: [{ scheme: 'bearer', type: 'http' }], 2381 url: '/organization/projects/{project_id}/certificates', 2382 ...options, 2383 }); 2384 } 2385 2386 /** 2387 * Activate certificates for project 2388 * 2389 * Activate certificates at the project level. 2390 * 2391 * You can atomically and idempotently activate up to 10 certificates at a time. 2392 * 2393 */ 2394 public activateProjectCertificates<ThrowOnError extends boolean = false>( 2395 options: Options<ActivateProjectCertificatesData, ThrowOnError>, 2396 ) { 2397 return (options.client ?? this.client).post< 2398 ActivateProjectCertificatesResponses, 2399 unknown, 2400 ThrowOnError 2401 >({ 2402 security: [{ scheme: 'bearer', type: 'http' }], 2403 url: '/organization/projects/{project_id}/certificates/activate', 2404 ...options, 2405 headers: { 2406 'Content-Type': 'application/json', 2407 ...options.headers, 2408 }, 2409 }); 2410 } 2411 2412 /** 2413 * Deactivate certificates for project 2414 * 2415 * Deactivate certificates at the project level. You can atomically and 2416 * idempotently deactivate up to 10 certificates at a time. 2417 * 2418 */ 2419 public deactivateProjectCertificates<ThrowOnError extends boolean = false>( 2420 options: Options<DeactivateProjectCertificatesData, ThrowOnError>, 2421 ) { 2422 return (options.client ?? this.client).post< 2423 DeactivateProjectCertificatesResponses, 2424 unknown, 2425 ThrowOnError 2426 >({ 2427 security: [{ scheme: 'bearer', type: 'http' }], 2428 url: '/organization/projects/{project_id}/certificates/deactivate', 2429 ...options, 2430 headers: { 2431 'Content-Type': 'application/json', 2432 ...options.headers, 2433 }, 2434 }); 2435 } 2436 2437 /** 2438 * List project rate limits 2439 * 2440 * Returns the rate limits per model for a project. 2441 */ 2442 public listProjectRateLimits<ThrowOnError extends boolean = false>( 2443 options: Options<ListProjectRateLimitsData, ThrowOnError>, 2444 ) { 2445 return (options.client ?? this.client).get< 2446 ListProjectRateLimitsResponses, 2447 unknown, 2448 ThrowOnError 2449 >({ 2450 security: [{ scheme: 'bearer', type: 'http' }], 2451 url: '/organization/projects/{project_id}/rate_limits', 2452 ...options, 2453 }); 2454 } 2455 2456 /** 2457 * Modify project rate limit 2458 * 2459 * Updates a project rate limit. 2460 */ 2461 public updateProjectRateLimits<ThrowOnError extends boolean = false>( 2462 options: Options<UpdateProjectRateLimitsData, ThrowOnError>, 2463 ) { 2464 return (options.client ?? this.client).post< 2465 UpdateProjectRateLimitsResponses, 2466 UpdateProjectRateLimitsErrors, 2467 ThrowOnError 2468 >({ 2469 security: [{ scheme: 'bearer', type: 'http' }], 2470 url: '/organization/projects/{project_id}/rate_limits/{rate_limit_id}', 2471 ...options, 2472 headers: { 2473 'Content-Type': 'application/json', 2474 ...options.headers, 2475 }, 2476 }); 2477 } 2478 2479 /** 2480 * List project service accounts 2481 * 2482 * Returns a list of service accounts in the project. 2483 */ 2484 public listProjectServiceAccounts<ThrowOnError extends boolean = false>( 2485 options: Options<ListProjectServiceAccountsData, ThrowOnError>, 2486 ) { 2487 return (options.client ?? this.client).get< 2488 ListProjectServiceAccountsResponses, 2489 ListProjectServiceAccountsErrors, 2490 ThrowOnError 2491 >({ 2492 security: [{ scheme: 'bearer', type: 'http' }], 2493 url: '/organization/projects/{project_id}/service_accounts', 2494 ...options, 2495 }); 2496 } 2497 2498 /** 2499 * Create project service account 2500 * 2501 * Creates a new service account in the project. This also returns an unredacted API key for the service account. 2502 */ 2503 public createProjectServiceAccount<ThrowOnError extends boolean = false>( 2504 options: Options<CreateProjectServiceAccountData, ThrowOnError>, 2505 ) { 2506 return (options.client ?? this.client).post< 2507 CreateProjectServiceAccountResponses, 2508 CreateProjectServiceAccountErrors, 2509 ThrowOnError 2510 >({ 2511 security: [{ scheme: 'bearer', type: 'http' }], 2512 url: '/organization/projects/{project_id}/service_accounts', 2513 ...options, 2514 headers: { 2515 'Content-Type': 'application/json', 2516 ...options.headers, 2517 }, 2518 }); 2519 } 2520 2521 /** 2522 * Delete project service account 2523 * 2524 * Deletes a service account from the project. 2525 */ 2526 public deleteProjectServiceAccount<ThrowOnError extends boolean = false>( 2527 options: Options<DeleteProjectServiceAccountData, ThrowOnError>, 2528 ) { 2529 return (options.client ?? this.client).delete< 2530 DeleteProjectServiceAccountResponses, 2531 unknown, 2532 ThrowOnError 2533 >({ 2534 security: [{ scheme: 'bearer', type: 'http' }], 2535 url: '/organization/projects/{project_id}/service_accounts/{service_account_id}', 2536 ...options, 2537 }); 2538 } 2539 2540 /** 2541 * Retrieve project service account 2542 * 2543 * Retrieves a service account in the project. 2544 */ 2545 public retrieveProjectServiceAccount<ThrowOnError extends boolean = false>( 2546 options: Options<RetrieveProjectServiceAccountData, ThrowOnError>, 2547 ) { 2548 return (options.client ?? this.client).get< 2549 RetrieveProjectServiceAccountResponses, 2550 unknown, 2551 ThrowOnError 2552 >({ 2553 security: [{ scheme: 'bearer', type: 'http' }], 2554 url: '/organization/projects/{project_id}/service_accounts/{service_account_id}', 2555 ...options, 2556 }); 2557 } 2558 2559 /** 2560 * List project users 2561 * 2562 * Returns a list of users in the project. 2563 */ 2564 public listProjectUsers<ThrowOnError extends boolean = false>( 2565 options: Options<ListProjectUsersData, ThrowOnError>, 2566 ) { 2567 return (options.client ?? this.client).get< 2568 ListProjectUsersResponses, 2569 ListProjectUsersErrors, 2570 ThrowOnError 2571 >({ 2572 security: [{ scheme: 'bearer', type: 'http' }], 2573 url: '/organization/projects/{project_id}/users', 2574 ...options, 2575 }); 2576 } 2577 2578 /** 2579 * Create project user 2580 * 2581 * Adds a user to the project. Users must already be members of the organization to be added to a project. 2582 */ 2583 public createProjectUser<ThrowOnError extends boolean = false>( 2584 options: Options<CreateProjectUserData, ThrowOnError>, 2585 ) { 2586 return (options.client ?? this.client).post< 2587 CreateProjectUserResponses, 2588 CreateProjectUserErrors, 2589 ThrowOnError 2590 >({ 2591 security: [{ scheme: 'bearer', type: 'http' }], 2592 url: '/organization/projects/{project_id}/users', 2593 ...options, 2594 headers: { 2595 'Content-Type': 'application/json', 2596 ...options.headers, 2597 }, 2598 }); 2599 } 2600 2601 /** 2602 * Delete project user 2603 * 2604 * Deletes a user from the project. 2605 */ 2606 public deleteProjectUser<ThrowOnError extends boolean = false>( 2607 options: Options<DeleteProjectUserData, ThrowOnError>, 2608 ) { 2609 return (options.client ?? this.client).delete< 2610 DeleteProjectUserResponses, 2611 DeleteProjectUserErrors, 2612 ThrowOnError 2613 >({ 2614 security: [{ scheme: 'bearer', type: 'http' }], 2615 url: '/organization/projects/{project_id}/users/{user_id}', 2616 ...options, 2617 }); 2618 } 2619 2620 /** 2621 * Retrieve project user 2622 * 2623 * Retrieves a user in the project. 2624 */ 2625 public retrieveProjectUser<ThrowOnError extends boolean = false>( 2626 options: Options<RetrieveProjectUserData, ThrowOnError>, 2627 ) { 2628 return (options.client ?? this.client).get< 2629 RetrieveProjectUserResponses, 2630 unknown, 2631 ThrowOnError 2632 >({ 2633 security: [{ scheme: 'bearer', type: 'http' }], 2634 url: '/organization/projects/{project_id}/users/{user_id}', 2635 ...options, 2636 }); 2637 } 2638 2639 /** 2640 * Modify project user 2641 * 2642 * Modifies a user's role in the project. 2643 */ 2644 public modifyProjectUser<ThrowOnError extends boolean = false>( 2645 options: Options<ModifyProjectUserData, ThrowOnError>, 2646 ) { 2647 return (options.client ?? this.client).post< 2648 ModifyProjectUserResponses, 2649 ModifyProjectUserErrors, 2650 ThrowOnError 2651 >({ 2652 security: [{ scheme: 'bearer', type: 'http' }], 2653 url: '/organization/projects/{project_id}/users/{user_id}', 2654 ...options, 2655 headers: { 2656 'Content-Type': 'application/json', 2657 ...options.headers, 2658 }, 2659 }); 2660 } 2661 2662 /** 2663 * Audio speeches 2664 * 2665 * Get audio speeches usage details for the organization. 2666 */ 2667 public usageAudioSpeeches<ThrowOnError extends boolean = false>( 2668 options: Options<UsageAudioSpeechesData, ThrowOnError>, 2669 ) { 2670 return (options.client ?? this.client).get< 2671 UsageAudioSpeechesResponses, 2672 unknown, 2673 ThrowOnError 2674 >({ 2675 security: [{ scheme: 'bearer', type: 'http' }], 2676 url: '/organization/usage/audio_speeches', 2677 ...options, 2678 }); 2679 } 2680 2681 /** 2682 * Audio transcriptions 2683 * 2684 * Get audio transcriptions usage details for the organization. 2685 */ 2686 public usageAudioTranscriptions<ThrowOnError extends boolean = false>( 2687 options: Options<UsageAudioTranscriptionsData, ThrowOnError>, 2688 ) { 2689 return (options.client ?? this.client).get< 2690 UsageAudioTranscriptionsResponses, 2691 unknown, 2692 ThrowOnError 2693 >({ 2694 security: [{ scheme: 'bearer', type: 'http' }], 2695 url: '/organization/usage/audio_transcriptions', 2696 ...options, 2697 }); 2698 } 2699 2700 /** 2701 * Code interpreter sessions 2702 * 2703 * Get code interpreter sessions usage details for the organization. 2704 */ 2705 public usageCodeInterpreterSessions<ThrowOnError extends boolean = false>( 2706 options: Options<UsageCodeInterpreterSessionsData, ThrowOnError>, 2707 ) { 2708 return (options.client ?? this.client).get< 2709 UsageCodeInterpreterSessionsResponses, 2710 unknown, 2711 ThrowOnError 2712 >({ 2713 security: [{ scheme: 'bearer', type: 'http' }], 2714 url: '/organization/usage/code_interpreter_sessions', 2715 ...options, 2716 }); 2717 } 2718 2719 /** 2720 * Completions 2721 * 2722 * Get completions usage details for the organization. 2723 */ 2724 public usageCompletions<ThrowOnError extends boolean = false>( 2725 options: Options<UsageCompletionsData, ThrowOnError>, 2726 ) { 2727 return (options.client ?? this.client).get< 2728 UsageCompletionsResponses, 2729 unknown, 2730 ThrowOnError 2731 >({ 2732 security: [{ scheme: 'bearer', type: 'http' }], 2733 url: '/organization/usage/completions', 2734 ...options, 2735 }); 2736 } 2737 2738 /** 2739 * Embeddings 2740 * 2741 * Get embeddings usage details for the organization. 2742 */ 2743 public usageEmbeddings<ThrowOnError extends boolean = false>( 2744 options: Options<UsageEmbeddingsData, ThrowOnError>, 2745 ) { 2746 return (options.client ?? this.client).get< 2747 UsageEmbeddingsResponses, 2748 unknown, 2749 ThrowOnError 2750 >({ 2751 security: [{ scheme: 'bearer', type: 'http' }], 2752 url: '/organization/usage/embeddings', 2753 ...options, 2754 }); 2755 } 2756 2757 /** 2758 * Images 2759 * 2760 * Get images usage details for the organization. 2761 */ 2762 public usageImages<ThrowOnError extends boolean = false>( 2763 options: Options<UsageImagesData, ThrowOnError>, 2764 ) { 2765 return (options.client ?? this.client).get< 2766 UsageImagesResponses, 2767 unknown, 2768 ThrowOnError 2769 >({ 2770 security: [{ scheme: 'bearer', type: 'http' }], 2771 url: '/organization/usage/images', 2772 ...options, 2773 }); 2774 } 2775 2776 /** 2777 * Moderations 2778 * 2779 * Get moderations usage details for the organization. 2780 */ 2781 public usageModerations<ThrowOnError extends boolean = false>( 2782 options: Options<UsageModerationsData, ThrowOnError>, 2783 ) { 2784 return (options.client ?? this.client).get< 2785 UsageModerationsResponses, 2786 unknown, 2787 ThrowOnError 2788 >({ 2789 security: [{ scheme: 'bearer', type: 'http' }], 2790 url: '/organization/usage/moderations', 2791 ...options, 2792 }); 2793 } 2794 2795 /** 2796 * Vector stores 2797 * 2798 * Get vector stores usage details for the organization. 2799 */ 2800 public usageVectorStores<ThrowOnError extends boolean = false>( 2801 options: Options<UsageVectorStoresData, ThrowOnError>, 2802 ) { 2803 return (options.client ?? this.client).get< 2804 UsageVectorStoresResponses, 2805 unknown, 2806 ThrowOnError 2807 >({ 2808 security: [{ scheme: 'bearer', type: 'http' }], 2809 url: '/organization/usage/vector_stores', 2810 ...options, 2811 }); 2812 } 2813 2814 /** 2815 * List users 2816 * 2817 * Lists all of the users in the organization. 2818 */ 2819 public listUsers<ThrowOnError extends boolean = false>( 2820 options?: Options<ListUsersData, ThrowOnError>, 2821 ) { 2822 return (options?.client ?? this.client).get< 2823 ListUsersResponses, 2824 unknown, 2825 ThrowOnError 2826 >({ 2827 security: [{ scheme: 'bearer', type: 'http' }], 2828 url: '/organization/users', 2829 ...options, 2830 }); 2831 } 2832 2833 /** 2834 * Delete user 2835 * 2836 * Deletes a user from the organization. 2837 */ 2838 public deleteUser<ThrowOnError extends boolean = false>( 2839 options: Options<DeleteUserData, ThrowOnError>, 2840 ) { 2841 return (options.client ?? this.client).delete< 2842 DeleteUserResponses, 2843 unknown, 2844 ThrowOnError 2845 >({ 2846 security: [{ scheme: 'bearer', type: 'http' }], 2847 url: '/organization/users/{user_id}', 2848 ...options, 2849 }); 2850 } 2851 2852 /** 2853 * Retrieve user 2854 * 2855 * Retrieves a user by their identifier. 2856 */ 2857 public retrieveUser<ThrowOnError extends boolean = false>( 2858 options: Options<RetrieveUserData, ThrowOnError>, 2859 ) { 2860 return (options.client ?? this.client).get< 2861 RetrieveUserResponses, 2862 unknown, 2863 ThrowOnError 2864 >({ 2865 security: [{ scheme: 'bearer', type: 'http' }], 2866 url: '/organization/users/{user_id}', 2867 ...options, 2868 }); 2869 } 2870 2871 /** 2872 * Modify user 2873 * 2874 * Modifies a user's role in the organization. 2875 */ 2876 public modifyUser<ThrowOnError extends boolean = false>( 2877 options: Options<ModifyUserData, ThrowOnError>, 2878 ) { 2879 return (options.client ?? this.client).post< 2880 ModifyUserResponses, 2881 unknown, 2882 ThrowOnError 2883 >({ 2884 security: [{ scheme: 'bearer', type: 'http' }], 2885 url: '/organization/users/{user_id}', 2886 ...options, 2887 headers: { 2888 'Content-Type': 'application/json', 2889 ...options.headers, 2890 }, 2891 }); 2892 } 2893 2894 /** 2895 * Create session 2896 * 2897 * Create an ephemeral API token for use in client-side applications with the 2898 * Realtime API. Can be configured with the same session parameters as the 2899 * `session.update` client event. 2900 * 2901 * It responds with a session object, plus a `client_secret` key which contains 2902 * a usable ephemeral API token that can be used to authenticate browser clients 2903 * for the Realtime API. 2904 * 2905 */ 2906 public createRealtimeSession<ThrowOnError extends boolean = false>( 2907 options: Options<CreateRealtimeSessionData, ThrowOnError>, 2908 ) { 2909 return (options.client ?? this.client).post< 2910 CreateRealtimeSessionResponses, 2911 unknown, 2912 ThrowOnError 2913 >({ 2914 security: [{ scheme: 'bearer', type: 'http' }], 2915 url: '/realtime/sessions', 2916 ...options, 2917 headers: { 2918 'Content-Type': 'application/json', 2919 ...options.headers, 2920 }, 2921 }); 2922 } 2923 2924 /** 2925 * Create transcription session 2926 * 2927 * Create an ephemeral API token for use in client-side applications with the 2928 * Realtime API specifically for realtime transcriptions. 2929 * Can be configured with the same session parameters as the `transcription_session.update` client event. 2930 * 2931 * It responds with a session object, plus a `client_secret` key which contains 2932 * a usable ephemeral API token that can be used to authenticate browser clients 2933 * for the Realtime API. 2934 * 2935 */ 2936 public createRealtimeTranscriptionSession< 2937 ThrowOnError extends boolean = false, 2938 >(options: Options<CreateRealtimeTranscriptionSessionData, ThrowOnError>) { 2939 return (options.client ?? this.client).post< 2940 CreateRealtimeTranscriptionSessionResponses, 2941 unknown, 2942 ThrowOnError 2943 >({ 2944 security: [{ scheme: 'bearer', type: 'http' }], 2945 url: '/realtime/transcription_sessions', 2946 ...options, 2947 headers: { 2948 'Content-Type': 'application/json', 2949 ...options.headers, 2950 }, 2951 }); 2952 } 2953 2954 /** 2955 * Create a model response 2956 * 2957 * Creates a model response. Provide [text](https://platform.openai.com/docs/guides/text) or 2958 * [image](https://platform.openai.com/docs/guides/images) inputs to generate [text](https://platform.openai.com/docs/guides/text) 2959 * or [JSON](https://platform.openai.com/docs/guides/structured-outputs) outputs. Have the model call 2960 * your own [custom code](https://platform.openai.com/docs/guides/function-calling) or use built-in 2961 * [tools](https://platform.openai.com/docs/guides/tools) like [web search](https://platform.openai.com/docs/guides/tools-web-search) 2962 * or [file search](https://platform.openai.com/docs/guides/tools-file-search) to use your own data 2963 * as input for the model's response. 2964 * 2965 */ 2966 public createResponse<ThrowOnError extends boolean = false>( 2967 options: Options<CreateResponseData, ThrowOnError>, 2968 ) { 2969 return (options.client ?? this.client).post< 2970 CreateResponseResponses, 2971 unknown, 2972 ThrowOnError 2973 >({ 2974 security: [{ scheme: 'bearer', type: 'http' }], 2975 url: '/responses', 2976 ...options, 2977 headers: { 2978 'Content-Type': 'application/json', 2979 ...options.headers, 2980 }, 2981 }); 2982 } 2983 2984 /** 2985 * Delete a model response 2986 * 2987 * Deletes a model response with the given ID. 2988 * 2989 */ 2990 public deleteResponse<ThrowOnError extends boolean = false>( 2991 options: Options<DeleteResponseData, ThrowOnError>, 2992 ) { 2993 return (options.client ?? this.client).delete< 2994 DeleteResponseResponses, 2995 DeleteResponseErrors, 2996 ThrowOnError 2997 >({ 2998 security: [{ scheme: 'bearer', type: 'http' }], 2999 url: '/responses/{response_id}', 3000 ...options, 3001 }); 3002 } 3003 3004 /** 3005 * Get a model response 3006 * 3007 * Retrieves a model response with the given ID. 3008 * 3009 */ 3010 public getResponse<ThrowOnError extends boolean = false>( 3011 options: Options<GetResponseData, ThrowOnError>, 3012 ) { 3013 return (options.client ?? this.client).get< 3014 GetResponseResponses, 3015 unknown, 3016 ThrowOnError 3017 >({ 3018 security: [{ scheme: 'bearer', type: 'http' }], 3019 url: '/responses/{response_id}', 3020 ...options, 3021 }); 3022 } 3023 3024 /** 3025 * Cancel a response 3026 * 3027 * Cancels a model response with the given ID. Only responses created with 3028 * the `background` parameter set to `true` can be cancelled. 3029 * [Learn more](https://platform.openai.com/docs/guides/background). 3030 * 3031 */ 3032 public cancelResponse<ThrowOnError extends boolean = false>( 3033 options: Options<CancelResponseData, ThrowOnError>, 3034 ) { 3035 return (options.client ?? this.client).post< 3036 CancelResponseResponses, 3037 CancelResponseErrors, 3038 ThrowOnError 3039 >({ 3040 security: [{ scheme: 'bearer', type: 'http' }], 3041 url: '/responses/{response_id}/cancel', 3042 ...options, 3043 }); 3044 } 3045 3046 /** 3047 * List input items 3048 * 3049 * Returns a list of input items for a given response. 3050 */ 3051 public listInputItems<ThrowOnError extends boolean = false>( 3052 options: Options<ListInputItemsData, ThrowOnError>, 3053 ) { 3054 return (options.client ?? this.client).get< 3055 ListInputItemsResponses, 3056 unknown, 3057 ThrowOnError 3058 >({ 3059 security: [{ scheme: 'bearer', type: 'http' }], 3060 url: '/responses/{response_id}/input_items', 3061 ...options, 3062 }); 3063 } 3064 3065 /** 3066 * Create thread 3067 * 3068 * Create a thread. 3069 */ 3070 public createThread<ThrowOnError extends boolean = false>( 3071 options?: Options<CreateThreadData, ThrowOnError>, 3072 ) { 3073 return (options?.client ?? this.client).post< 3074 CreateThreadResponses, 3075 unknown, 3076 ThrowOnError 3077 >({ 3078 security: [{ scheme: 'bearer', type: 'http' }], 3079 url: '/threads', 3080 ...options, 3081 headers: { 3082 'Content-Type': 'application/json', 3083 ...options?.headers, 3084 }, 3085 }); 3086 } 3087 3088 /** 3089 * Create thread and run 3090 * 3091 * Create a thread and run it in one request. 3092 */ 3093 public createThreadAndRun<ThrowOnError extends boolean = false>( 3094 options: Options<CreateThreadAndRunData, ThrowOnError>, 3095 ) { 3096 return (options.client ?? this.client).post< 3097 CreateThreadAndRunResponses, 3098 unknown, 3099 ThrowOnError 3100 >({ 3101 security: [{ scheme: 'bearer', type: 'http' }], 3102 url: '/threads/runs', 3103 ...options, 3104 headers: { 3105 'Content-Type': 'application/json', 3106 ...options.headers, 3107 }, 3108 }); 3109 } 3110 3111 /** 3112 * Delete thread 3113 * 3114 * Delete a thread. 3115 */ 3116 public deleteThread<ThrowOnError extends boolean = false>( 3117 options: Options<DeleteThreadData, ThrowOnError>, 3118 ) { 3119 return (options.client ?? this.client).delete< 3120 DeleteThreadResponses, 3121 unknown, 3122 ThrowOnError 3123 >({ 3124 security: [{ scheme: 'bearer', type: 'http' }], 3125 url: '/threads/{thread_id}', 3126 ...options, 3127 }); 3128 } 3129 3130 /** 3131 * Retrieve thread 3132 * 3133 * Retrieves a thread. 3134 */ 3135 public getThread<ThrowOnError extends boolean = false>( 3136 options: Options<GetThreadData, ThrowOnError>, 3137 ) { 3138 return (options.client ?? this.client).get< 3139 GetThreadResponses, 3140 unknown, 3141 ThrowOnError 3142 >({ 3143 security: [{ scheme: 'bearer', type: 'http' }], 3144 url: '/threads/{thread_id}', 3145 ...options, 3146 }); 3147 } 3148 3149 /** 3150 * Modify thread 3151 * 3152 * Modifies a thread. 3153 */ 3154 public modifyThread<ThrowOnError extends boolean = false>( 3155 options: Options<ModifyThreadData, ThrowOnError>, 3156 ) { 3157 return (options.client ?? this.client).post< 3158 ModifyThreadResponses, 3159 unknown, 3160 ThrowOnError 3161 >({ 3162 security: [{ scheme: 'bearer', type: 'http' }], 3163 url: '/threads/{thread_id}', 3164 ...options, 3165 headers: { 3166 'Content-Type': 'application/json', 3167 ...options.headers, 3168 }, 3169 }); 3170 } 3171 3172 /** 3173 * List messages 3174 * 3175 * Returns a list of messages for a given thread. 3176 */ 3177 public listMessages<ThrowOnError extends boolean = false>( 3178 options: Options<ListMessagesData, ThrowOnError>, 3179 ) { 3180 return (options.client ?? this.client).get< 3181 ListMessagesResponses, 3182 unknown, 3183 ThrowOnError 3184 >({ 3185 security: [{ scheme: 'bearer', type: 'http' }], 3186 url: '/threads/{thread_id}/messages', 3187 ...options, 3188 }); 3189 } 3190 3191 /** 3192 * Create message 3193 * 3194 * Create a message. 3195 */ 3196 public createMessage<ThrowOnError extends boolean = false>( 3197 options: Options<CreateMessageData, ThrowOnError>, 3198 ) { 3199 return (options.client ?? this.client).post< 3200 CreateMessageResponses, 3201 unknown, 3202 ThrowOnError 3203 >({ 3204 security: [{ scheme: 'bearer', type: 'http' }], 3205 url: '/threads/{thread_id}/messages', 3206 ...options, 3207 headers: { 3208 'Content-Type': 'application/json', 3209 ...options.headers, 3210 }, 3211 }); 3212 } 3213 3214 /** 3215 * Delete message 3216 * 3217 * Deletes a message. 3218 */ 3219 public deleteMessage<ThrowOnError extends boolean = false>( 3220 options: Options<DeleteMessageData, ThrowOnError>, 3221 ) { 3222 return (options.client ?? this.client).delete< 3223 DeleteMessageResponses, 3224 unknown, 3225 ThrowOnError 3226 >({ 3227 security: [{ scheme: 'bearer', type: 'http' }], 3228 url: '/threads/{thread_id}/messages/{message_id}', 3229 ...options, 3230 }); 3231 } 3232 3233 /** 3234 * Retrieve message 3235 * 3236 * Retrieve a message. 3237 */ 3238 public getMessage<ThrowOnError extends boolean = false>( 3239 options: Options<GetMessageData, ThrowOnError>, 3240 ) { 3241 return (options.client ?? this.client).get< 3242 GetMessageResponses, 3243 unknown, 3244 ThrowOnError 3245 >({ 3246 security: [{ scheme: 'bearer', type: 'http' }], 3247 url: '/threads/{thread_id}/messages/{message_id}', 3248 ...options, 3249 }); 3250 } 3251 3252 /** 3253 * Modify message 3254 * 3255 * Modifies a message. 3256 */ 3257 public modifyMessage<ThrowOnError extends boolean = false>( 3258 options: Options<ModifyMessageData, ThrowOnError>, 3259 ) { 3260 return (options.client ?? this.client).post< 3261 ModifyMessageResponses, 3262 unknown, 3263 ThrowOnError 3264 >({ 3265 security: [{ scheme: 'bearer', type: 'http' }], 3266 url: '/threads/{thread_id}/messages/{message_id}', 3267 ...options, 3268 headers: { 3269 'Content-Type': 'application/json', 3270 ...options.headers, 3271 }, 3272 }); 3273 } 3274 3275 /** 3276 * List runs 3277 * 3278 * Returns a list of runs belonging to a thread. 3279 */ 3280 public listRuns<ThrowOnError extends boolean = false>( 3281 options: Options<ListRunsData, ThrowOnError>, 3282 ) { 3283 return (options.client ?? this.client).get< 3284 ListRunsResponses, 3285 unknown, 3286 ThrowOnError 3287 >({ 3288 security: [{ scheme: 'bearer', type: 'http' }], 3289 url: '/threads/{thread_id}/runs', 3290 ...options, 3291 }); 3292 } 3293 3294 /** 3295 * Create run 3296 * 3297 * Create a run. 3298 */ 3299 public createRun<ThrowOnError extends boolean = false>( 3300 options: Options<CreateRunData, ThrowOnError>, 3301 ) { 3302 return (options.client ?? this.client).post< 3303 CreateRunResponses, 3304 unknown, 3305 ThrowOnError 3306 >({ 3307 security: [{ scheme: 'bearer', type: 'http' }], 3308 url: '/threads/{thread_id}/runs', 3309 ...options, 3310 headers: { 3311 'Content-Type': 'application/json', 3312 ...options.headers, 3313 }, 3314 }); 3315 } 3316 3317 /** 3318 * Retrieve run 3319 * 3320 * Retrieves a run. 3321 */ 3322 public getRun<ThrowOnError extends boolean = false>( 3323 options: Options<GetRunData, ThrowOnError>, 3324 ) { 3325 return (options.client ?? this.client).get< 3326 GetRunResponses, 3327 unknown, 3328 ThrowOnError 3329 >({ 3330 security: [{ scheme: 'bearer', type: 'http' }], 3331 url: '/threads/{thread_id}/runs/{run_id}', 3332 ...options, 3333 }); 3334 } 3335 3336 /** 3337 * Modify run 3338 * 3339 * Modifies a run. 3340 */ 3341 public modifyRun<ThrowOnError extends boolean = false>( 3342 options: Options<ModifyRunData, ThrowOnError>, 3343 ) { 3344 return (options.client ?? this.client).post< 3345 ModifyRunResponses, 3346 unknown, 3347 ThrowOnError 3348 >({ 3349 security: [{ scheme: 'bearer', type: 'http' }], 3350 url: '/threads/{thread_id}/runs/{run_id}', 3351 ...options, 3352 headers: { 3353 'Content-Type': 'application/json', 3354 ...options.headers, 3355 }, 3356 }); 3357 } 3358 3359 /** 3360 * Cancel a run 3361 * 3362 * Cancels a run that is `in_progress`. 3363 */ 3364 public cancelRun<ThrowOnError extends boolean = false>( 3365 options: Options<CancelRunData, ThrowOnError>, 3366 ) { 3367 return (options.client ?? this.client).post< 3368 CancelRunResponses, 3369 unknown, 3370 ThrowOnError 3371 >({ 3372 security: [{ scheme: 'bearer', type: 'http' }], 3373 url: '/threads/{thread_id}/runs/{run_id}/cancel', 3374 ...options, 3375 }); 3376 } 3377 3378 /** 3379 * List run steps 3380 * 3381 * Returns a list of run steps belonging to a run. 3382 */ 3383 public listRunSteps<ThrowOnError extends boolean = false>( 3384 options: Options<ListRunStepsData, ThrowOnError>, 3385 ) { 3386 return (options.client ?? this.client).get< 3387 ListRunStepsResponses, 3388 unknown, 3389 ThrowOnError 3390 >({ 3391 security: [{ scheme: 'bearer', type: 'http' }], 3392 url: '/threads/{thread_id}/runs/{run_id}/steps', 3393 ...options, 3394 }); 3395 } 3396 3397 /** 3398 * Retrieve run step 3399 * 3400 * Retrieves a run step. 3401 */ 3402 public getRunStep<ThrowOnError extends boolean = false>( 3403 options: Options<GetRunStepData, ThrowOnError>, 3404 ) { 3405 return (options.client ?? this.client).get< 3406 GetRunStepResponses, 3407 unknown, 3408 ThrowOnError 3409 >({ 3410 security: [{ scheme: 'bearer', type: 'http' }], 3411 url: '/threads/{thread_id}/runs/{run_id}/steps/{step_id}', 3412 ...options, 3413 }); 3414 } 3415 3416 /** 3417 * Submit tool outputs to run 3418 * 3419 * When a run has the `status: "requires_action"` and `required_action.type` is `submit_tool_outputs`, this endpoint can be used to submit the outputs from the tool calls once they're all completed. All outputs must be submitted in a single request. 3420 * 3421 */ 3422 public submitToolOuputsToRun<ThrowOnError extends boolean = false>( 3423 options: Options<SubmitToolOuputsToRunData, ThrowOnError>, 3424 ) { 3425 return (options.client ?? this.client).post< 3426 SubmitToolOuputsToRunResponses, 3427 unknown, 3428 ThrowOnError 3429 >({ 3430 security: [{ scheme: 'bearer', type: 'http' }], 3431 url: '/threads/{thread_id}/runs/{run_id}/submit_tool_outputs', 3432 ...options, 3433 headers: { 3434 'Content-Type': 'application/json', 3435 ...options.headers, 3436 }, 3437 }); 3438 } 3439 3440 /** 3441 * Create upload 3442 * 3443 * Creates an intermediate [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object 3444 * that you can add [Parts](https://platform.openai.com/docs/api-reference/uploads/part-object) to. 3445 * Currently, an Upload can accept at most 8 GB in total and expires after an 3446 * hour after you create it. 3447 * 3448 * Once you complete the Upload, we will create a 3449 * [File](https://platform.openai.com/docs/api-reference/files/object) object that contains all the parts 3450 * you uploaded. This File is usable in the rest of our platform as a regular 3451 * File object. 3452 * 3453 * For certain `purpose` values, the correct `mime_type` must be specified. 3454 * Please refer to documentation for the 3455 * [supported MIME types for your use case](https://platform.openai.com/docs/assistants/tools/file-search#supported-files). 3456 * 3457 * For guidance on the proper filename extensions for each purpose, please 3458 * follow the documentation on [creating a 3459 * File](https://platform.openai.com/docs/api-reference/files/create). 3460 * 3461 */ 3462 public createUpload<ThrowOnError extends boolean = false>( 3463 options: Options<CreateUploadData, ThrowOnError>, 3464 ) { 3465 return (options.client ?? this.client).post< 3466 CreateUploadResponses, 3467 unknown, 3468 ThrowOnError 3469 >({ 3470 security: [{ scheme: 'bearer', type: 'http' }], 3471 url: '/uploads', 3472 ...options, 3473 headers: { 3474 'Content-Type': 'application/json', 3475 ...options.headers, 3476 }, 3477 }); 3478 } 3479 3480 /** 3481 * Cancel upload 3482 * 3483 * Cancels the Upload. No Parts may be added after an Upload is cancelled. 3484 * 3485 */ 3486 public cancelUpload<ThrowOnError extends boolean = false>( 3487 options: Options<CancelUploadData, ThrowOnError>, 3488 ) { 3489 return (options.client ?? this.client).post< 3490 CancelUploadResponses, 3491 unknown, 3492 ThrowOnError 3493 >({ 3494 security: [{ scheme: 'bearer', type: 'http' }], 3495 url: '/uploads/{upload_id}/cancel', 3496 ...options, 3497 }); 3498 } 3499 3500 /** 3501 * Complete upload 3502 * 3503 * Completes the [Upload](https://platform.openai.com/docs/api-reference/uploads/object). 3504 * 3505 * Within the returned Upload object, there is a nested [File](https://platform.openai.com/docs/api-reference/files/object) object that is ready to use in the rest of the platform. 3506 * 3507 * You can specify the order of the Parts by passing in an ordered list of the Part IDs. 3508 * 3509 * The number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed. 3510 * 3511 */ 3512 public completeUpload<ThrowOnError extends boolean = false>( 3513 options: Options<CompleteUploadData, ThrowOnError>, 3514 ) { 3515 return (options.client ?? this.client).post< 3516 CompleteUploadResponses, 3517 unknown, 3518 ThrowOnError 3519 >({ 3520 security: [{ scheme: 'bearer', type: 'http' }], 3521 url: '/uploads/{upload_id}/complete', 3522 ...options, 3523 headers: { 3524 'Content-Type': 'application/json', 3525 ...options.headers, 3526 }, 3527 }); 3528 } 3529 3530 /** 3531 * Add upload part 3532 * 3533 * Adds a [Part](https://platform.openai.com/docs/api-reference/uploads/part-object) to an [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object. A Part represents a chunk of bytes from the file you are trying to upload. 3534 * 3535 * Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB. 3536 * 3537 * It is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](https://platform.openai.com/docs/api-reference/uploads/complete). 3538 * 3539 */ 3540 public addUploadPart<ThrowOnError extends boolean = false>( 3541 options: Options<AddUploadPartData, ThrowOnError>, 3542 ) { 3543 return (options.client ?? this.client).post< 3544 AddUploadPartResponses, 3545 unknown, 3546 ThrowOnError 3547 >({ 3548 ...formDataBodySerializer, 3549 security: [{ scheme: 'bearer', type: 'http' }], 3550 url: '/uploads/{upload_id}/parts', 3551 ...options, 3552 headers: { 3553 'Content-Type': null, 3554 ...options.headers, 3555 }, 3556 }); 3557 } 3558 3559 /** 3560 * List vector stores 3561 * 3562 * Returns a list of vector stores. 3563 */ 3564 public listVectorStores<ThrowOnError extends boolean = false>( 3565 options?: Options<ListVectorStoresData, ThrowOnError>, 3566 ) { 3567 return (options?.client ?? this.client).get< 3568 ListVectorStoresResponses, 3569 unknown, 3570 ThrowOnError 3571 >({ 3572 security: [{ scheme: 'bearer', type: 'http' }], 3573 url: '/vector_stores', 3574 ...options, 3575 }); 3576 } 3577 3578 /** 3579 * Create vector store 3580 * 3581 * Create a vector store. 3582 */ 3583 public createVectorStore<ThrowOnError extends boolean = false>( 3584 options: Options<CreateVectorStoreData, ThrowOnError>, 3585 ) { 3586 return (options.client ?? this.client).post< 3587 CreateVectorStoreResponses, 3588 unknown, 3589 ThrowOnError 3590 >({ 3591 security: [{ scheme: 'bearer', type: 'http' }], 3592 url: '/vector_stores', 3593 ...options, 3594 headers: { 3595 'Content-Type': 'application/json', 3596 ...options.headers, 3597 }, 3598 }); 3599 } 3600 3601 /** 3602 * Delete vector store 3603 * 3604 * Delete a vector store. 3605 */ 3606 public deleteVectorStore<ThrowOnError extends boolean = false>( 3607 options: Options<DeleteVectorStoreData, ThrowOnError>, 3608 ) { 3609 return (options.client ?? this.client).delete< 3610 DeleteVectorStoreResponses, 3611 unknown, 3612 ThrowOnError 3613 >({ 3614 security: [{ scheme: 'bearer', type: 'http' }], 3615 url: '/vector_stores/{vector_store_id}', 3616 ...options, 3617 }); 3618 } 3619 3620 /** 3621 * Retrieve vector store 3622 * 3623 * Retrieves a vector store. 3624 */ 3625 public getVectorStore<ThrowOnError extends boolean = false>( 3626 options: Options<GetVectorStoreData, ThrowOnError>, 3627 ) { 3628 return (options.client ?? this.client).get< 3629 GetVectorStoreResponses, 3630 unknown, 3631 ThrowOnError 3632 >({ 3633 security: [{ scheme: 'bearer', type: 'http' }], 3634 url: '/vector_stores/{vector_store_id}', 3635 ...options, 3636 }); 3637 } 3638 3639 /** 3640 * Modify vector store 3641 * 3642 * Modifies a vector store. 3643 */ 3644 public modifyVectorStore<ThrowOnError extends boolean = false>( 3645 options: Options<ModifyVectorStoreData, ThrowOnError>, 3646 ) { 3647 return (options.client ?? this.client).post< 3648 ModifyVectorStoreResponses, 3649 unknown, 3650 ThrowOnError 3651 >({ 3652 security: [{ scheme: 'bearer', type: 'http' }], 3653 url: '/vector_stores/{vector_store_id}', 3654 ...options, 3655 headers: { 3656 'Content-Type': 'application/json', 3657 ...options.headers, 3658 }, 3659 }); 3660 } 3661 3662 /** 3663 * Create vector store file batch 3664 * 3665 * Create a vector store file batch. 3666 */ 3667 public createVectorStoreFileBatch<ThrowOnError extends boolean = false>( 3668 options: Options<CreateVectorStoreFileBatchData, ThrowOnError>, 3669 ) { 3670 return (options.client ?? this.client).post< 3671 CreateVectorStoreFileBatchResponses, 3672 unknown, 3673 ThrowOnError 3674 >({ 3675 security: [{ scheme: 'bearer', type: 'http' }], 3676 url: '/vector_stores/{vector_store_id}/file_batches', 3677 ...options, 3678 headers: { 3679 'Content-Type': 'application/json', 3680 ...options.headers, 3681 }, 3682 }); 3683 } 3684 3685 /** 3686 * Retrieve vector store file batch 3687 * 3688 * Retrieves a vector store file batch. 3689 */ 3690 public getVectorStoreFileBatch<ThrowOnError extends boolean = false>( 3691 options: Options<GetVectorStoreFileBatchData, ThrowOnError>, 3692 ) { 3693 return (options.client ?? this.client).get< 3694 GetVectorStoreFileBatchResponses, 3695 unknown, 3696 ThrowOnError 3697 >({ 3698 security: [{ scheme: 'bearer', type: 'http' }], 3699 url: '/vector_stores/{vector_store_id}/file_batches/{batch_id}', 3700 ...options, 3701 }); 3702 } 3703 3704 /** 3705 * Cancel vector store file batch 3706 * 3707 * Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible. 3708 */ 3709 public cancelVectorStoreFileBatch<ThrowOnError extends boolean = false>( 3710 options: Options<CancelVectorStoreFileBatchData, ThrowOnError>, 3711 ) { 3712 return (options.client ?? this.client).post< 3713 CancelVectorStoreFileBatchResponses, 3714 unknown, 3715 ThrowOnError 3716 >({ 3717 security: [{ scheme: 'bearer', type: 'http' }], 3718 url: '/vector_stores/{vector_store_id}/file_batches/{batch_id}/cancel', 3719 ...options, 3720 }); 3721 } 3722 3723 /** 3724 * List vector store files in a batch 3725 * 3726 * Returns a list of vector store files in a batch. 3727 */ 3728 public listFilesInVectorStoreBatch<ThrowOnError extends boolean = false>( 3729 options: Options<ListFilesInVectorStoreBatchData, ThrowOnError>, 3730 ) { 3731 return (options.client ?? this.client).get< 3732 ListFilesInVectorStoreBatchResponses, 3733 unknown, 3734 ThrowOnError 3735 >({ 3736 security: [{ scheme: 'bearer', type: 'http' }], 3737 url: '/vector_stores/{vector_store_id}/file_batches/{batch_id}/files', 3738 ...options, 3739 }); 3740 } 3741 3742 /** 3743 * List vector store files 3744 * 3745 * Returns a list of vector store files. 3746 */ 3747 public listVectorStoreFiles<ThrowOnError extends boolean = false>( 3748 options: Options<ListVectorStoreFilesData, ThrowOnError>, 3749 ) { 3750 return (options.client ?? this.client).get< 3751 ListVectorStoreFilesResponses, 3752 unknown, 3753 ThrowOnError 3754 >({ 3755 security: [{ scheme: 'bearer', type: 'http' }], 3756 url: '/vector_stores/{vector_store_id}/files', 3757 ...options, 3758 }); 3759 } 3760 3761 /** 3762 * Create vector store file 3763 * 3764 * Create a vector store file by attaching a [File](https://platform.openai.com/docs/api-reference/files) to a [vector store](https://platform.openai.com/docs/api-reference/vector-stores/object). 3765 */ 3766 public createVectorStoreFile<ThrowOnError extends boolean = false>( 3767 options: Options<CreateVectorStoreFileData, ThrowOnError>, 3768 ) { 3769 return (options.client ?? this.client).post< 3770 CreateVectorStoreFileResponses, 3771 unknown, 3772 ThrowOnError 3773 >({ 3774 security: [{ scheme: 'bearer', type: 'http' }], 3775 url: '/vector_stores/{vector_store_id}/files', 3776 ...options, 3777 headers: { 3778 'Content-Type': 'application/json', 3779 ...options.headers, 3780 }, 3781 }); 3782 } 3783 3784 /** 3785 * Delete vector store file 3786 * 3787 * Delete a vector store file. This will remove the file from the vector store but the file itself will not be deleted. To delete the file, use the [delete file](https://platform.openai.com/docs/api-reference/files/delete) endpoint. 3788 */ 3789 public deleteVectorStoreFile<ThrowOnError extends boolean = false>( 3790 options: Options<DeleteVectorStoreFileData, ThrowOnError>, 3791 ) { 3792 return (options.client ?? this.client).delete< 3793 DeleteVectorStoreFileResponses, 3794 unknown, 3795 ThrowOnError 3796 >({ 3797 security: [{ scheme: 'bearer', type: 'http' }], 3798 url: '/vector_stores/{vector_store_id}/files/{file_id}', 3799 ...options, 3800 }); 3801 } 3802 3803 /** 3804 * Retrieve vector store file 3805 * 3806 * Retrieves a vector store file. 3807 */ 3808 public getVectorStoreFile<ThrowOnError extends boolean = false>( 3809 options: Options<GetVectorStoreFileData, ThrowOnError>, 3810 ) { 3811 return (options.client ?? this.client).get< 3812 GetVectorStoreFileResponses, 3813 unknown, 3814 ThrowOnError 3815 >({ 3816 security: [{ scheme: 'bearer', type: 'http' }], 3817 url: '/vector_stores/{vector_store_id}/files/{file_id}', 3818 ...options, 3819 }); 3820 } 3821 3822 /** 3823 * Update vector store file attributes 3824 * 3825 * Update attributes on a vector store file. 3826 */ 3827 public updateVectorStoreFileAttributes<ThrowOnError extends boolean = false>( 3828 options: Options<UpdateVectorStoreFileAttributesData, ThrowOnError>, 3829 ) { 3830 return (options.client ?? this.client).post< 3831 UpdateVectorStoreFileAttributesResponses, 3832 unknown, 3833 ThrowOnError 3834 >({ 3835 security: [{ scheme: 'bearer', type: 'http' }], 3836 url: '/vector_stores/{vector_store_id}/files/{file_id}', 3837 ...options, 3838 headers: { 3839 'Content-Type': 'application/json', 3840 ...options.headers, 3841 }, 3842 }); 3843 } 3844 3845 /** 3846 * Retrieve vector store file content 3847 * 3848 * Retrieve the parsed contents of a vector store file. 3849 */ 3850 public retrieveVectorStoreFileContent<ThrowOnError extends boolean = false>( 3851 options: Options<RetrieveVectorStoreFileContentData, ThrowOnError>, 3852 ) { 3853 return (options.client ?? this.client).get< 3854 RetrieveVectorStoreFileContentResponses, 3855 unknown, 3856 ThrowOnError 3857 >({ 3858 security: [{ scheme: 'bearer', type: 'http' }], 3859 url: '/vector_stores/{vector_store_id}/files/{file_id}/content', 3860 ...options, 3861 }); 3862 } 3863 3864 /** 3865 * Search vector store 3866 * 3867 * Search a vector store for relevant chunks based on a query and file attributes filter. 3868 */ 3869 public searchVectorStore<ThrowOnError extends boolean = false>( 3870 options: Options<SearchVectorStoreData, ThrowOnError>, 3871 ) { 3872 return (options.client ?? this.client).post< 3873 SearchVectorStoreResponses, 3874 unknown, 3875 ThrowOnError 3876 >({ 3877 security: [{ scheme: 'bearer', type: 'http' }], 3878 url: '/vector_stores/{vector_store_id}/search', 3879 ...options, 3880 headers: { 3881 'Content-Type': 'application/json', 3882 ...options.headers, 3883 }, 3884 }); 3885 } 3886}