-
Notifications
You must be signed in to change notification settings - Fork 42
/
OpenAISpec.json
3272 lines (3272 loc) · 159 KB
/
OpenAISpec.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
"openapi": "3.0.0",
"info": {
"title": "OpenAI API",
"description": "APIs for sampling from and fine-tuning language models",
"version": "1.2.0"
},
"servers": [
{
"url": "https://api.openai.com/v1"
}
],
"tags": [
{
"name": "OpenAI",
"description": "The OpenAI REST API"
}
],
"paths": {
"/engines": {
"get": {
"operationId": "listEngines",
"deprecated": true,
"tags": [
"OpenAI"
],
"summary": "Lists the currently available (non-finetuned) models, and provides basic information about each one such as the owner and availability.",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ListEnginesResponse"
}
}
}
}
},
"x-oaiMeta": {
"name": "List engines",
"group": "engines",
"path": "list",
"examples": {
"curl": "curl https://api.openai.com/v1/engines \\\n -H 'Authorization: Bearer YOUR_API_KEY'\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Engine.list()\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.listEngines();\n"
},
"response": "{\n \"data\": [\n {\n \"id\": \"engine-id-0\",\n \"object\": \"engine\",\n \"owner\": \"organization-owner\",\n \"ready\": true\n },\n {\n \"id\": \"engine-id-2\",\n \"object\": \"engine\",\n \"owner\": \"organization-owner\",\n \"ready\": true\n },\n {\n \"id\": \"engine-id-3\",\n \"object\": \"engine\",\n \"owner\": \"openai\",\n \"ready\": false\n },\n ],\n \"object\": \"list\"\n}\n"
}
}
},
"/engines/{engine_id}": {
"get": {
"operationId": "retrieveEngine",
"deprecated": true,
"tags": [
"OpenAI"
],
"summary": "Retrieves a model instance, providing basic information about it such as the owner and availability.",
"parameters": [
{
"in": "path",
"name": "engine_id",
"required": true,
"schema": {
"type": "string",
"example": "davinci"
},
"description": "The ID of the engine to use for this request\n"
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Engine"
}
}
}
}
},
"x-oaiMeta": {
"name": "Retrieve engine",
"group": "engines",
"path": "retrieve",
"examples": {
"curl": "curl https://api.openai.com/v1/engines/VAR_model_id \\\n -H 'Authorization: Bearer YOUR_API_KEY'\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Engine.retrieve(\"VAR_model_id\")\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.retrieveEngine(\"VAR_model_id\");\n"
},
"response": "{\n \"id\": \"VAR_model_id\",\n \"object\": \"engine\",\n \"owner\": \"openai\",\n \"ready\": true\n}\n"
}
}
},
"/completions": {
"post": {
"operationId": "createCompletion",
"tags": [
"OpenAI"
],
"summary": "Creates a completion for the provided prompt and parameters",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateCompletionRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateCompletionResponse"
}
}
}
}
},
"x-oaiMeta": {
"name": "Create completion",
"group": "completions",
"path": "create",
"examples": {
"curl": "curl https://api.openai.com/v1/completions \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Bearer YOUR_API_KEY' \\\n -d '{\n \"model\": \"VAR_model_id\",\n \"prompt\": \"Say this is a test\",\n \"max_tokens\": 7,\n \"temperature\": 0\n}'\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Completion.create(\n model=\"VAR_model_id\",\n prompt=\"Say this is a test\",\n max_tokens=7,\n temperature=0\n)\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createCompletion({\n model: \"VAR_model_id\",\n prompt: \"Say this is a test\",\n max_tokens: 7,\n temperature: 0,\n});\n"
},
"parameters": "{\n \"model\": \"VAR_model_id\",\n \"prompt\": \"Say this is a test\",\n \"max_tokens\": 7,\n \"temperature\": 0,\n \"top_p\": 1,\n \"n\": 1,\n \"stream\": false,\n \"logprobs\": null,\n \"stop\": \"\\n\"\n}\n",
"response": "{\n \"id\": \"cmpl-uqkvlQyYK7bGYrRHQ0eXlWi7\",\n \"object\": \"text_completion\",\n \"created\": 1589478378,\n \"model\": \"VAR_model_id\",\n \"choices\": [\n {\n \"text\": \"\\n\\nThis is indeed a test\",\n \"index\": 0,\n \"logprobs\": null,\n \"finish_reason\": \"length\"\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 5,\n \"completion_tokens\": 7,\n \"total_tokens\": 12\n }\n}\n"
}
}
},
"/chat/completions": {
"post": {
"operationId": "createChatCompletion",
"tags": [
"OpenAI"
],
"summary": "Creates a completion for the chat message",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateChatCompletionRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateChatCompletionResponse"
}
}
}
}
},
"x-oaiMeta": {
"name": "Create chat completion",
"group": "chat",
"path": "create",
"beta": true,
"examples": {
"curl": "curl https://api.openai.com/v1/chat/completions \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Bearer YOUR_API_KEY' \\\n -d '{\n \"model\": \"gpt-3.5-turbo\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n}'\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\n\ncompletion = openai.ChatCompletion.create(\n model=\"gpt-3.5-turbo\",\n messages=[\n {\"role\": \"user\", \"content\": \"Hello!\"}\n ]\n)\n\nprint(completion.choices[0].message)\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\n\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\n\nconst completion = await openai.createChatCompletion({\n model: \"gpt-3.5-turbo\",\n messages: [{role: \"user\", content: \"Hello world\"}],\n});\nconsole.log(completion.data.choices[0].message);\n"
},
"parameters": "{\n \"model\": \"gpt-3.5-turbo\",\n \"messages\": [{\"role\": \"user\", \"content\": \"Hello!\"}]\n}\n",
"response": "{\n \"id\": \"chatcmpl-123\",\n \"object\": \"chat.completion\",\n \"created\": 1677652288,\n \"choices\": [{\n \"index\": 0,\n \"message\": {\n \"role\": \"assistant\",\n \"content\": \"\\n\\nHello there, how may I assist you today?\",\n },\n \"finish_reason\": \"stop\"\n }],\n \"usage\": {\n \"prompt_tokens\": 9,\n \"completion_tokens\": 12,\n \"total_tokens\": 21\n }\n}\n"
}
}
},
"/edits": {
"post": {
"operationId": "createEdit",
"tags": [
"OpenAI"
],
"summary": "Creates a new edit for the provided input, instruction, and parameters.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateEditRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateEditResponse"
}
}
}
}
},
"x-oaiMeta": {
"name": "Create edit",
"group": "edits",
"path": "create",
"examples": {
"curl": "curl https://api.openai.com/v1/edits \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Bearer YOUR_API_KEY' \\\n -d '{\n \"model\": \"VAR_model_id\",\n \"input\": \"What day of the wek is it?\",\n \"instruction\": \"Fix the spelling mistakes\"\n}'\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Edit.create(\n model=\"VAR_model_id\",\n input=\"What day of the wek is it?\",\n instruction=\"Fix the spelling mistakes\"\n)\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createEdit({\n model: \"VAR_model_id\",\n input: \"What day of the wek is it?\",\n instruction: \"Fix the spelling mistakes\",\n});\n"
},
"parameters": "{\n \"model\": \"VAR_model_id\",\n \"input\": \"What day of the wek is it?\",\n \"instruction\": \"Fix the spelling mistakes\",\n}\n",
"response": "{\n \"object\": \"edit\",\n \"created\": 1589478378,\n \"choices\": [\n {\n \"text\": \"What day of the week is it?\",\n \"index\": 0,\n }\n ],\n \"usage\": {\n \"prompt_tokens\": 25,\n \"completion_tokens\": 32,\n \"total_tokens\": 57\n }\n}\n"
}
}
},
"/images/generations": {
"post": {
"operationId": "createImage",
"tags": [
"OpenAI"
],
"summary": "Creates an image given a prompt.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateImageRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ImagesResponse"
}
}
}
}
},
"x-oaiMeta": {
"name": "Create image",
"group": "images",
"path": "create",
"beta": true,
"examples": {
"curl": "curl https://api.openai.com/v1/images/generations \\\n -H 'Content-Type: application/json' \\\n -H 'Authorization: Bearer YOUR_API_KEY' \\\n -d '{\n \"prompt\": \"A cute baby sea otter\",\n \"n\": 2,\n \"size\": \"1024x1024\"\n}'\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Image.create(\n prompt=\"A cute baby sea otter\",\n n=2,\n size=\"1024x1024\"\n)\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createImage({\n prompt: \"A cute baby sea otter\",\n n: 2,\n size: \"1024x1024\",\n});\n"
},
"parameters": "{\n \"prompt\": \"A cute baby sea otter\",\n \"n\": 2,\n \"size\": \"1024x1024\"\n}\n",
"response": "{\n \"created\": 1589478378,\n \"data\": [\n {\n \"url\": \"https://...\"\n },\n {\n \"url\": \"https://...\"\n }\n ]\n}\n"
}
}
},
"/images/edits": {
"post": {
"operationId": "createImageEdit",
"tags": [
"OpenAI"
],
"summary": "Creates an edited or extended image given an original image and a prompt.",
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/CreateImageEditRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ImagesResponse"
}
}
}
}
},
"x-oaiMeta": {
"name": "Create image edit",
"group": "images",
"path": "create-edit",
"beta": true,
"examples": {
"curl": "curl https://api.openai.com/v1/images/edits \\\n -H 'Authorization: Bearer YOUR_API_KEY' \\\n -F image='@otter.png' \\\n -F mask='@mask.png' \\\n -F prompt=\"A cute baby sea otter wearing a beret\" \\\n -F n=2 \\\n -F size=\"1024x1024\"\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Image.create_edit(\n image=open(\"otter.png\", \"rb\"),\n mask=open(\"mask.png\", \"rb\"),\n prompt=\"A cute baby sea otter wearing a beret\",\n n=2,\n size=\"1024x1024\"\n)\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createImageEdit(\n fs.createReadStream(\"otter.png\"),\n fs.createReadStream(\"mask.png\"),\n \"A cute baby sea otter wearing a beret\",\n 2,\n \"1024x1024\"\n);\n"
},
"response": "{\n \"created\": 1589478378,\n \"data\": [\n {\n \"url\": \"https://...\"\n },\n {\n \"url\": \"https://...\"\n }\n ]\n}\n"
}
}
},
"/images/variations": {
"post": {
"operationId": "createImageVariation",
"tags": [
"OpenAI"
],
"summary": "Creates a variation of a given image.",
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/CreateImageVariationRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ImagesResponse"
}
}
}
}
},
"x-oaiMeta": {
"name": "Create image variation",
"group": "images",
"path": "create-variation",
"beta": true,
"examples": {
"curl": "curl https://api.openai.com/v1/images/variations \\\n -H 'Authorization: Bearer YOUR_API_KEY' \\\n -F image='@otter.png' \\\n -F n=2 \\\n -F size=\"1024x1024\"\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Image.create_variation(\n image=open(\"otter.png\", \"rb\"),\n n=2,\n size=\"1024x1024\"\n)\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createImageVariation(\n fs.createReadStream(\"otter.png\"),\n 2,\n \"1024x1024\"\n);\n"
},
"response": "{\n \"created\": 1589478378,\n \"data\": [\n {\n \"url\": \"https://...\"\n },\n {\n \"url\": \"https://...\"\n }\n ]\n}\n"
}
}
},
"/embeddings": {
"post": {
"operationId": "createEmbedding",
"tags": [
"OpenAI"
],
"summary": "Creates an embedding vector representing the input text.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateEmbeddingRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateEmbeddingResponse"
}
}
}
}
},
"x-oaiMeta": {
"name": "Create embeddings",
"group": "embeddings",
"path": "create",
"examples": {
"curl": "curl https://api.openai.com/v1/embeddings \\\n -X POST \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"input\": \"The food was delicious and the waiter...\",\n \"model\": \"text-embedding-ada-002\"}'\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Embedding.create(\n model=\"text-embedding-ada-002\",\n input=\"The food was delicious and the waiter...\"\n)\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createEmbedding({\n model: \"text-embedding-ada-002\",\n input: \"The food was delicious and the waiter...\",\n});\n"
},
"parameters": "{\n \"model\": \"text-embedding-ada-002\",\n \"input\": \"The food was delicious and the waiter...\"\n}\n",
"response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"object\": \"embedding\",\n \"embedding\": [\n 0.0023064255,\n -0.009327292,\n .... (1536 floats total for ada-002)\n -0.0028842222,\n ],\n \"index\": 0\n }\n ],\n \"model\": \"text-embedding-ada-002\",\n \"usage\": {\n \"prompt_tokens\": 8,\n \"total_tokens\": 8\n }\n}\n"
}
}
},
"/audio/transcriptions": {
"post": {
"operationId": "createTranscription",
"tags": [
"OpenAI"
],
"summary": "Transcribes audio into the input language.",
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/CreateTranscriptionRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateTranscriptionResponse"
}
}
}
}
},
"x-oaiMeta": {
"name": "Create transcription",
"group": "audio",
"path": "create",
"beta": true,
"examples": {
"curl": "curl https://api.openai.com/v1/audio/transcriptions \\\n -X POST \\\n -H 'Authorization: Bearer TOKEN' \\\n -H 'Content-Type: multipart/form-data' \\\n -F file=@/path/to/file/audio.mp3 \\\n -F model=whisper-1\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\naudio_file = open(\"audio.mp3\", \"rb\")\ntranscript = openai.Audio.transcribe(\"whisper-1\", audio_file)\n",
"node": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst resp = await openai.createTranscription(\n fs.createReadStream(\"audio.mp3\"),\n \"whisper-1\"\n);\n"
},
"parameters": "{\n \"file\": \"audio.mp3\",\n \"model\": \"whisper-1\"\n}\n",
"response": "{\n \"text\": \"Imagine the wildest idea that you've ever had, and you're curious about how it might scale to something that's a 100, a 1,000 times bigger. This is a place where you can get to do that.\"\n}\n"
}
}
},
"/audio/translations": {
"post": {
"operationId": "createTranslation",
"tags": [
"OpenAI"
],
"summary": "Translates audio into into English.",
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/CreateTranslationRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateTranslationResponse"
}
}
}
}
},
"x-oaiMeta": {
"name": "Create translation",
"group": "audio",
"path": "create",
"beta": true,
"examples": {
"curl": "curl https://api.openai.com/v1/audio/translations \\\n -X POST \\\n -H 'Authorization: Bearer TOKEN' \\\n -H 'Content-Type: multipart/form-data' \\\n -F file=@/path/to/file/german.m4a \\\n -F model=whisper-1\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\naudio_file = open(\"german.m4a\", \"rb\")\ntranscript = openai.Audio.translate(\"whisper-1\", audio_file)\n",
"node": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst resp = await openai.createTranslation(\n fs.createReadStream(\"audio.mp3\"),\n \"whisper-1\"\n);\n"
},
"parameters": "{\n \"file\": \"german.m4a\",\n \"model\": \"whisper-1\"\n}\n",
"response": "{\n \"text\": \"Hello, my name is Wolfgang and I come from Germany. Where are you heading today?\"\n}\n"
}
}
},
"/engines/{engine_id}/search": {
"post": {
"operationId": "createSearch",
"deprecated": true,
"tags": [
"OpenAI"
],
"summary": "The search endpoint computes similarity scores between provided query and documents. Documents can be passed directly to the API if there are no more than 200 of them.\n\nTo go beyond the 200 document limit, documents can be processed offline and then used for efficient retrieval at query time. When `file` is set, the search endpoint searches over all the documents in the given file and returns up to the `max_rerank` number of documents. These documents will be returned along with their search scores.\n\nThe similarity score is a positive score that usually ranges from 0 to 300 (but can sometimes go higher), where a score above 200 usually means the document is semantically similar to the query.\n",
"parameters": [
{
"in": "path",
"name": "engine_id",
"required": true,
"schema": {
"type": "string",
"example": "davinci"
},
"description": "The ID of the engine to use for this request. You can select one of `ada`, `babbage`, `curie`, or `davinci`."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateSearchRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateSearchResponse"
}
}
}
}
},
"x-oaiMeta": {
"name": "Create search",
"group": "searches",
"path": "create",
"examples": {
"curl": "curl https://api.openai.com/v1/engines/davinci/search \\\n -H \"Content-Type: application/json\" \\\n -H 'Authorization: Bearer YOUR_API_KEY' \\\n -d '{\n \"documents\": [\"White House\", \"hospital\", \"school\"],\n \"query\": \"the president\"\n}'\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Engine(\"davinci\").search(\n documents=[\"White House\", \"hospital\", \"school\"],\n query=\"the president\"\n)\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createSearch(\"davinci\", {\n documents: [\"White House\", \"hospital\", \"school\"],\n query: \"the president\",\n});\n"
},
"parameters": "{\n \"documents\": [\n \"White House\",\n \"hospital\",\n \"school\"\n ],\n \"query\": \"the president\"\n}\n",
"response": "{\n \"data\": [\n {\n \"document\": 0,\n \"object\": \"search_result\",\n \"score\": 215.412\n },\n {\n \"document\": 1,\n \"object\": \"search_result\",\n \"score\": 40.316\n },\n {\n \"document\": 2,\n \"object\": \"search_result\",\n \"score\": 55.226\n }\n ],\n \"object\": \"list\"\n}\n"
}
}
},
"/files": {
"get": {
"operationId": "listFiles",
"tags": [
"OpenAI"
],
"summary": "Returns a list of files that belong to the user's organization.",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ListFilesResponse"
}
}
}
}
},
"x-oaiMeta": {
"name": "List files",
"group": "files",
"path": "list",
"examples": {
"curl": "curl https://api.openai.com/v1/files \\\n -H 'Authorization: Bearer YOUR_API_KEY'\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.File.list()\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.listFiles();\n"
},
"response": "{\n \"data\": [\n {\n \"id\": \"file-ccdDZrC3iZVNiQVeEA6Z66wf\",\n \"object\": \"file\",\n \"bytes\": 175,\n \"created_at\": 1613677385,\n \"filename\": \"train.jsonl\",\n \"purpose\": \"search\"\n },\n {\n \"id\": \"file-XjGxS3KTG0uNmNOK362iJua3\",\n \"object\": \"file\",\n \"bytes\": 140,\n \"created_at\": 1613779121,\n \"filename\": \"puppy.jsonl\",\n \"purpose\": \"search\"\n }\n ],\n \"object\": \"list\"\n}\n"
}
},
"post": {
"operationId": "createFile",
"tags": [
"OpenAI"
],
"summary": "Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of all the files uploaded by one organization can be up to 1 GB. Please contact us if you need to increase the storage limit.\n",
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/CreateFileRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OpenAIFile"
}
}
}
}
},
"x-oaiMeta": {
"name": "Upload file",
"group": "files",
"path": "upload",
"examples": {
"curl": "curl https://api.openai.com/v1/files \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -F purpose=\"fine-tune\" \\\n -F file='@mydata.jsonl'\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.File.create(\n file=open(\"mydata.jsonl\", \"rb\"),\n purpose='fine-tune'\n)\n",
"node.js": "const fs = require(\"fs\");\nconst { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createFile(\n fs.createReadStream(\"mydata.jsonl\"),\n \"fine-tune\"\n);\n"
},
"response": "{\n \"id\": \"file-XjGxS3KTG0uNmNOK362iJua3\",\n \"object\": \"file\",\n \"bytes\": 140,\n \"created_at\": 1613779121,\n \"filename\": \"mydata.jsonl\",\n \"purpose\": \"fine-tune\"\n}\n"
}
}
},
"/files/{file_id}": {
"delete": {
"operationId": "deleteFile",
"tags": [
"OpenAI"
],
"summary": "Delete a file.",
"parameters": [
{
"in": "path",
"name": "file_id",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the file to use for this request"
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DeleteFileResponse"
}
}
}
}
},
"x-oaiMeta": {
"name": "Delete file",
"group": "files",
"path": "delete",
"examples": {
"curl": "curl https://api.openai.com/v1/files/file-XjGxS3KTG0uNmNOK362iJua3 \\\n -X DELETE \\\n -H 'Authorization: Bearer YOUR_API_KEY'\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.File.delete(\"file-XjGxS3KTG0uNmNOK362iJua3\")\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.deleteFile(\"file-XjGxS3KTG0uNmNOK362iJua3\");\n"
},
"response": "{\n \"id\": \"file-XjGxS3KTG0uNmNOK362iJua3\",\n \"object\": \"file\",\n \"deleted\": true\n}\n"
}
},
"get": {
"operationId": "retrieveFile",
"tags": [
"OpenAI"
],
"summary": "Returns information about a specific file.",
"parameters": [
{
"in": "path",
"name": "file_id",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the file to use for this request"
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/OpenAIFile"
}
}
}
}
},
"x-oaiMeta": {
"name": "Retrieve file",
"group": "files",
"path": "retrieve",
"examples": {
"curl": "curl https://api.openai.com/v1/files/file-XjGxS3KTG0uNmNOK362iJua3 \\\n -H 'Authorization: Bearer YOUR_API_KEY'\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.File.retrieve(\"file-XjGxS3KTG0uNmNOK362iJua3\")\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.retrieveFile(\"file-XjGxS3KTG0uNmNOK362iJua3\");\n"
},
"response": "{\n \"id\": \"file-XjGxS3KTG0uNmNOK362iJua3\",\n \"object\": \"file\",\n \"bytes\": 140,\n \"created_at\": 1613779657,\n \"filename\": \"mydata.jsonl\",\n \"purpose\": \"fine-tune\"\n}\n"
}
}
},
"/files/{file_id}/content": {
"get": {
"operationId": "downloadFile",
"tags": [
"OpenAI"
],
"summary": "Returns the contents of the specified file",
"parameters": [
{
"in": "path",
"name": "file_id",
"required": true,
"schema": {
"type": "string"
},
"description": "The ID of the file to use for this request"
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "string"
}
}
}
}
},
"x-oaiMeta": {
"name": "Retrieve file content",
"group": "files",
"path": "retrieve-content",
"examples": {
"curl": "curl https://api.openai.com/v1/files/file-XjGxS3KTG0uNmNOK362iJua3/content \\\n -H 'Authorization: Bearer YOUR_API_KEY' > file.jsonl\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\ncontent = openai.File.download(\"file-XjGxS3KTG0uNmNOK362iJua3\")\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.downloadFile(\"file-XjGxS3KTG0uNmNOK362iJua3\");\n"
}
}
}
},
"/answers": {
"post": {
"operationId": "createAnswer",
"deprecated": true,
"tags": [
"OpenAI"
],
"summary": "Answers the specified question using the provided documents and examples.\n\nThe endpoint first [searches](/docs/api-reference/searches) over provided documents or files to find relevant context. The relevant context is combined with the provided examples and question to create the prompt for [completion](/docs/api-reference/completions).\n",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateAnswerRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateAnswerResponse"
}
}
}
}
},
"x-oaiMeta": {
"name": "Create answer",
"group": "answers",
"path": "create",
"examples": {
"curl": "curl https://api.openai.com/v1/answers \\\n -X POST \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"documents\": [\"Puppy A is happy.\", \"Puppy B is sad.\"],\n \"question\": \"which puppy is happy?\",\n \"search_model\": \"ada\",\n \"model\": \"curie\",\n \"examples_context\": \"In 2017, U.S. life expectancy was 78.6 years.\",\n \"examples\": [[\"What is human life expectancy in the United States?\",\"78 years.\"]],\n \"max_tokens\": 5,\n \"stop\": [\"\\n\", \"<|endoftext|>\"]\n }'\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Answer.create(\n search_model=\"ada\",\n model=\"curie\",\n question=\"which puppy is happy?\",\n documents=[\"Puppy A is happy.\", \"Puppy B is sad.\"],\n examples_context=\"In 2017, U.S. life expectancy was 78.6 years.\",\n examples=[[\"What is human life expectancy in the United States?\",\"78 years.\"]],\n max_tokens=5,\n stop=[\"\\n\", \"<|endoftext|>\"],\n)\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createAnswer({\n search_model: \"ada\",\n model: \"curie\",\n question: \"which puppy is happy?\",\n documents: [\"Puppy A is happy.\", \"Puppy B is sad.\"],\n examples_context: \"In 2017, U.S. life expectancy was 78.6 years.\",\n examples: [[\"What is human life expectancy in the United States?\",\"78 years.\"]],\n max_tokens: 5,\n stop: [\"\\n\", \"<|endoftext|>\"],\n});\n"
},
"parameters": "{\n \"documents\": [\"Puppy A is happy.\", \"Puppy B is sad.\"],\n \"question\": \"which puppy is happy?\",\n \"search_model\": \"ada\",\n \"model\": \"curie\",\n \"examples_context\": \"In 2017, U.S. life expectancy was 78.6 years.\",\n \"examples\": [[\"What is human life expectancy in the United States?\",\"78 years.\"]],\n \"max_tokens\": 5,\n \"stop\": [\"\\n\", \"<|endoftext|>\"]\n}\n",
"response": "{\n \"answers\": [\n \"puppy A.\"\n ],\n \"completion\": \"cmpl-2euVa1kmKUuLpSX600M41125Mo9NI\",\n \"model\": \"curie:2020-05-03\",\n \"object\": \"answer\",\n \"search_model\": \"ada\",\n \"selected_documents\": [\n {\n \"document\": 0,\n \"text\": \"Puppy A is happy. \"\n },\n {\n \"document\": 1,\n \"text\": \"Puppy B is sad. \"\n }\n ]\n}\n"
}
}
},
"/classifications": {
"post": {
"operationId": "createClassification",
"deprecated": true,
"tags": [
"OpenAI"
],
"summary": "Classifies the specified `query` using provided examples.\n\nThe endpoint first [searches](/docs/api-reference/searches) over the labeled examples\nto select the ones most relevant for the particular query. Then, the relevant examples\nare combined with the query to construct a prompt to produce the final label via the\n[completions](/docs/api-reference/completions) endpoint.\n\nLabeled examples can be provided via an uploaded `file`, or explicitly listed in the\nrequest using the `examples` parameter for quick tests and small scale use cases.\n",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateClassificationRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateClassificationResponse"
}
}
}
}
},
"x-oaiMeta": {
"name": "Create classification",
"group": "classifications",
"path": "create",
"examples": {
"curl": "curl https://api.openai.com/v1/classifications \\\n -X POST \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -H 'Content-Type: application/json' \\\n -d '{\n \"examples\": [\n [\"A happy moment\", \"Positive\"],\n [\"I am sad.\", \"Negative\"],\n [\"I am feeling awesome\", \"Positive\"]],\n \"query\": \"It is a raining day :(\",\n \"search_model\": \"ada\",\n \"model\": \"curie\",\n \"labels\":[\"Positive\", \"Negative\", \"Neutral\"]\n }'\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.Classification.create(\n search_model=\"ada\",\n model=\"curie\",\n examples=[\n [\"A happy moment\", \"Positive\"],\n [\"I am sad.\", \"Negative\"],\n [\"I am feeling awesome\", \"Positive\"]\n ],\n query=\"It is a raining day :(\",\n labels=[\"Positive\", \"Negative\", \"Neutral\"],\n)\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createClassification({\n search_model: \"ada\",\n model: \"curie\",\n examples: [\n [\"A happy moment\", \"Positive\"],\n [\"I am sad.\", \"Negative\"],\n [\"I am feeling awesome\", \"Positive\"]\n ],\n query:\"It is a raining day :(\",\n labels: [\"Positive\", \"Negative\", \"Neutral\"],\n});\n"
},
"parameters": "{\n \"examples\": [\n [\"A happy moment\", \"Positive\"],\n [\"I am sad.\", \"Negative\"],\n [\"I am feeling awesome\", \"Positive\"]\n ],\n \"labels\": [\"Positive\", \"Negative\", \"Neutral\"],\n \"query\": \"It is a raining day :(\",\n \"search_model\": \"ada\",\n \"model\": \"curie\"\n}\n",
"response": "{\n \"completion\": \"cmpl-2euN7lUVZ0d4RKbQqRV79IiiE6M1f\",\n \"label\": \"Negative\",\n \"model\": \"curie:2020-05-03\",\n \"object\": \"classification\",\n \"search_model\": \"ada\",\n \"selected_examples\": [\n {\n \"document\": 1,\n \"label\": \"Negative\",\n \"text\": \"I am sad.\"\n },\n {\n \"document\": 0,\n \"label\": \"Positive\",\n \"text\": \"A happy moment\"\n },\n {\n \"document\": 2,\n \"label\": \"Positive\",\n \"text\": \"I am feeling awesome\"\n }\n ]\n}\n"
}
}
},
"/fine-tunes": {
"post": {
"operationId": "createFineTune",
"tags": [
"OpenAI"
],
"summary": "Creates a job that fine-tunes a specified model from a given dataset.\n\nResponse includes details of the enqueued job including job status and the name of the fine-tuned models once complete.\n\n[Learn more about Fine-tuning](/docs/guides/fine-tuning)\n",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateFineTuneRequest"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FineTune"
}
}
}
}
},
"x-oaiMeta": {
"name": "Create fine-tune",
"group": "fine-tunes",
"path": "create",
"examples": {
"curl": "curl https://api.openai.com/v1/fine-tunes \\\n -X POST \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"training_file\": \"file-XGinujblHPwGLSztz8cPS8XY\"\n}'\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.FineTune.create(training_file=\"file-XGinujblHPwGLSztz8cPS8XY\")\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.createFineTune({\n training_file: \"file-XGinujblHPwGLSztz8cPS8XY\",\n});\n"
},
"response": "{\n \"id\": \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\",\n \"object\": \"fine-tune\",\n \"model\": \"curie\",\n \"created_at\": 1614807352,\n \"events\": [\n {\n \"object\": \"fine-tune-event\",\n \"created_at\": 1614807352,\n \"level\": \"info\",\n \"message\": \"Job enqueued. Waiting for jobs ahead to complete. Queue number: 0.\"\n }\n ],\n \"fine_tuned_model\": null,\n \"hyperparams\": {\n \"batch_size\": 4,\n \"learning_rate_multiplier\": 0.1,\n \"n_epochs\": 4,\n \"prompt_loss_weight\": 0.1,\n },\n \"organization_id\": \"org-...\",\n \"result_files\": [],\n \"status\": \"pending\",\n \"validation_files\": [],\n \"training_files\": [\n {\n \"id\": \"file-XGinujblHPwGLSztz8cPS8XY\",\n \"object\": \"file\",\n \"bytes\": 1547276,\n \"created_at\": 1610062281,\n \"filename\": \"my-data-train.jsonl\",\n \"purpose\": \"fine-tune-train\"\n }\n ],\n \"updated_at\": 1614807352,\n}\n"
}
},
"get": {
"operationId": "listFineTunes",
"tags": [
"OpenAI"
],
"summary": "List your organization's fine-tuning jobs\n",
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ListFineTunesResponse"
}
}
}
}
},
"x-oaiMeta": {
"name": "List fine-tunes",
"group": "fine-tunes",
"path": "list",
"examples": {
"curl": "curl https://api.openai.com/v1/fine-tunes \\\n -H 'Authorization: Bearer YOUR_API_KEY'\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.FineTune.list()\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.listFineTunes();\n"
},
"response": "{\n \"object\": \"list\",\n \"data\": [\n {\n \"id\": \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\",\n \"object\": \"fine-tune\",\n \"model\": \"curie\",\n \"created_at\": 1614807352,\n \"fine_tuned_model\": null,\n \"hyperparams\": { ... },\n \"organization_id\": \"org-...\",\n \"result_files\": [],\n \"status\": \"pending\",\n \"validation_files\": [],\n \"training_files\": [ { ... } ],\n \"updated_at\": 1614807352,\n },\n { ... },\n { ... }\n ]\n}\n"
}
}
},
"/fine-tunes/{fine_tune_id}": {
"get": {
"operationId": "retrieveFineTune",
"tags": [
"OpenAI"
],
"summary": "Gets info about the fine-tune job.\n\n[Learn more about Fine-tuning](/docs/guides/fine-tuning)\n",
"parameters": [
{
"in": "path",
"name": "fine_tune_id",
"required": true,
"schema": {
"type": "string",
"example": "ft-AF1WoRqd3aJAHsqc9NY7iL8F"
},
"description": "The ID of the fine-tune job\n"
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FineTune"
}
}
}
}
},
"x-oaiMeta": {
"name": "Retrieve fine-tune",
"group": "fine-tunes",
"path": "retrieve",
"examples": {
"curl": "curl https://api.openai.com/v1/fine-tunes/ft-AF1WoRqd3aJAHsqc9NY7iL8F \\\n -H \"Authorization: Bearer YOUR_API_KEY\"\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.FineTune.retrieve(id=\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.retrieveFineTune(\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\");\n"
},
"response": "{\n \"id\": \"ft-AF1WoRqd3aJAHsqc9NY7iL8F\",\n \"object\": \"fine-tune\",\n \"model\": \"curie\",\n \"created_at\": 1614807352,\n \"events\": [\n {\n \"object\": \"fine-tune-event\",\n \"created_at\": 1614807352,\n \"level\": \"info\",\n \"message\": \"Job enqueued. Waiting for jobs ahead to complete. Queue number: 0.\"\n },\n {\n \"object\": \"fine-tune-event\",\n \"created_at\": 1614807356,\n \"level\": \"info\",\n \"message\": \"Job started.\"\n },\n {\n \"object\": \"fine-tune-event\",\n \"created_at\": 1614807861,\n \"level\": \"info\",\n \"message\": \"Uploaded snapshot: curie:ft-acmeco-2021-03-03-21-44-20.\"\n },\n {\n \"object\": \"fine-tune-event\",\n \"created_at\": 1614807864,\n \"level\": \"info\",\n \"message\": \"Uploaded result files: file-QQm6ZpqdNwAaVC3aSz5sWwLT.\"\n },\n {\n \"object\": \"fine-tune-event\",\n \"created_at\": 1614807864,\n \"level\": \"info\",\n \"message\": \"Job succeeded.\"\n }\n ],\n \"fine_tuned_model\": \"curie:ft-acmeco-2021-03-03-21-44-20\",\n \"hyperparams\": {\n \"batch_size\": 4,\n \"learning_rate_multiplier\": 0.1,\n \"n_epochs\": 4,\n \"prompt_loss_weight\": 0.1,\n },\n \"organization_id\": \"org-...\",\n \"result_files\": [\n {\n \"id\": \"file-QQm6ZpqdNwAaVC3aSz5sWwLT\",\n \"object\": \"file\",\n \"bytes\": 81509,\n \"created_at\": 1614807863,\n \"filename\": \"compiled_results.csv\",\n \"purpose\": \"fine-tune-results\"\n }\n ],\n \"status\": \"succeeded\",\n \"validation_files\": [],\n \"training_files\": [\n {\n \"id\": \"file-XGinujblHPwGLSztz8cPS8XY\",\n \"object\": \"file\",\n \"bytes\": 1547276,\n \"created_at\": 1610062281,\n \"filename\": \"my-data-train.jsonl\",\n \"purpose\": \"fine-tune-train\"\n }\n ],\n \"updated_at\": 1614807865,\n}\n"
}
}
},
"/fine-tunes/{fine_tune_id}/cancel": {
"post": {
"operationId": "cancelFineTune",
"tags": [
"OpenAI"
],
"summary": "Immediately cancel a fine-tune job.\n",
"parameters": [
{
"in": "path",
"name": "fine_tune_id",
"required": true,
"schema": {
"type": "string",
"example": "ft-AF1WoRqd3aJAHsqc9NY7iL8F"
},
"description": "The ID of the fine-tune job to cancel\n"
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/FineTune"
}
}
}
}
},
"x-oaiMeta": {
"name": "Cancel fine-tune",
"group": "fine-tunes",
"path": "cancel",
"examples": {
"curl": "curl https://api.openai.com/v1/fine-tunes/ft-AF1WoRqd3aJAHsqc9NY7iL8F/cancel \\\n -X POST \\\n -H \"Authorization: Bearer YOUR_API_KEY\"\n",
"python": "import os\nimport openai\nopenai.api_key = os.getenv(\"OPENAI_API_KEY\")\nopenai.FineTune.cancel(id=\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\")\n",
"node.js": "const { Configuration, OpenAIApi } = require(\"openai\");\nconst configuration = new Configuration({\n apiKey: process.env.OPENAI_API_KEY,\n});\nconst openai = new OpenAIApi(configuration);\nconst response = await openai.cancelFineTune(\"ft-AF1WoRqd3aJAHsqc9NY7iL8F\");\n"
},
"response": "{\n \"id\": \"ft-xhrpBbvVUzYGo8oUO1FY4nI7\",\n \"object\": \"fine-tune\",\n \"model\": \"curie\",\n \"created_at\": 1614807770,\n \"events\": [ { ... } ],\n \"fine_tuned_model\": null,\n \"hyperparams\": { ... },\n \"organization_id\": \"org-...\",\n \"result_files\": [],\n \"status\": \"cancelled\",\n \"validation_files\": [],\n \"training_files\": [\n {\n \"id\": \"file-XGinujblHPwGLSztz8cPS8XY\",\n \"object\": \"file\",\n \"bytes\": 1547276,\n \"created_at\": 1610062281,\n \"filename\": \"my-data-train.jsonl\",\n \"purpose\": \"fine-tune-train\"\n }\n ],\n \"updated_at\": 1614807789,\n}\n"
}
}
},
"/fine-tunes/{fine_tune_id}/events": {
"get": {
"operationId": "listFineTuneEvents",
"tags": [
"OpenAI"
],
"summary": "Get fine-grained status updates for a fine-tune job.\n",
"parameters": [
{
"in": "path",