java/resources/containers/index.md +0 −957 deleted
File Deleted View Diff
1# Containers
2
3## List containers
4
5`ContainerListPage containers().list(ContainerListParamsparams = ContainerListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`
6
7**get** `/containers`
8
9List Containers
10
11### Parameters
12
13- `ContainerListParams params`
14
15 - `Optional<String> after`
16
17 A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
18
19 - `Optional<Long> limit`
20
21 A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
22
23 - `Optional<String> name`
24
25 Filter results by container name.
26
27 - `Optional<Order> order`
28
29 Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
30
31 - `ASC("asc")`
32
33 - `DESC("desc")`
34
35### Returns
36
37- `class ContainerListResponse:`
38
39 - `String id`
40
41 Unique identifier for the container.
42
43 - `long createdAt`
44
45 Unix timestamp (in seconds) when the container was created.
46
47 - `String name`
48
49 Name of the container.
50
51 - `String object_`
52
53 The type of this object.
54
55 - `String status`
56
57 Status of the container (e.g., active, deleted).
58
59 - `Optional<ExpiresAfter> expiresAfter`
60
61 The container will expire after this time period.
62 The anchor is the reference point for the expiration.
63 The minutes is the number of minutes after the anchor before the container expires.
64
65 - `Optional<Anchor> anchor`
66
67 The reference point for the expiration.
68
69 - `LAST_ACTIVE_AT("last_active_at")`
70
71 - `Optional<Long> minutes`
72
73 The number of minutes after the anchor before the container expires.
74
75 - `Optional<Long> lastActiveAt`
76
77 Unix timestamp (in seconds) when the container was last active.
78
79 - `Optional<MemoryLimit> memoryLimit`
80
81 The memory limit configured for the container.
82
83 - `_1G("1g")`
84
85 - `_4G("4g")`
86
87 - `_16G("16g")`
88
89 - `_64G("64g")`
90
91 - `Optional<NetworkPolicy> networkPolicy`
92
93 Network access policy for the container.
94
95 - `Type type`
96
97 The network policy mode.
98
99 - `ALLOWLIST("allowlist")`
100
101 - `DISABLED("disabled")`
102
103 - `Optional<List<String>> allowedDomains`
104
105 Allowed outbound domains when `type` is `allowlist`.
106
107### Example
108
109```java
110package com.openai.example;
111
112import com.openai.client.OpenAIClient;
113import com.openai.client.okhttp.OpenAIOkHttpClient;
114import com.openai.models.containers.ContainerListPage;
115import com.openai.models.containers.ContainerListParams;
116
117public final class Main {
118 private Main() {}
119
120 public static void main(String[] args) {
121 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
122
123 ContainerListPage page = client.containers().list();
124 }
125}
126```
127
128#### Response
129
130```json
131{
132 "data": [
133 {
134 "id": "id",
135 "created_at": 0,
136 "name": "name",
137 "object": "object",
138 "status": "status",
139 "expires_after": {
140 "anchor": "last_active_at",
141 "minutes": 0
142 },
143 "last_active_at": 0,
144 "memory_limit": "1g",
145 "network_policy": {
146 "type": "allowlist",
147 "allowed_domains": [
148 "string"
149 ]
150 }
151 }
152 ],
153 "first_id": "first_id",
154 "has_more": true,
155 "last_id": "last_id",
156 "object": "list"
157}
158```
159
160## Create container
161
162`ContainerCreateResponse containers().create(ContainerCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`
163
164**post** `/containers`
165
166Create Container
167
168### Parameters
169
170- `ContainerCreateParams params`
171
172 - `String name`
173
174 Name of the container to create.
175
176 - `Optional<ExpiresAfter> expiresAfter`
177
178 Container expiration time in seconds relative to the 'anchor' time.
179
180 - `Anchor anchor`
181
182 Time anchor for the expiration time. Currently only 'last_active_at' is supported.
183
184 - `LAST_ACTIVE_AT("last_active_at")`
185
186 - `long minutes`
187
188 - `Optional<List<String>> fileIds`
189
190 IDs of files to copy to the container.
191
192 - `Optional<MemoryLimit> memoryLimit`
193
194 Optional memory limit for the container. Defaults to "1g".
195
196 - `_1G("1g")`
197
198 - `_4G("4g")`
199
200 - `_16G("16g")`
201
202 - `_64G("64g")`
203
204 - `Optional<NetworkPolicy> networkPolicy`
205
206 Network access policy for the container.
207
208 - `class ContainerNetworkPolicyDisabled:`
209
210 - `JsonValue; type "disabled"constant`
211
212 Disable outbound network access. Always `disabled`.
213
214 - `DISABLED("disabled")`
215
216 - `class ContainerNetworkPolicyAllowlist:`
217
218 - `List<String> allowedDomains`
219
220 A list of allowed domains when type is `allowlist`.
221
222 - `JsonValue; type "allowlist"constant`
223
224 Allow outbound network access only to specified domains. Always `allowlist`.
225
226 - `ALLOWLIST("allowlist")`
227
228 - `Optional<List<ContainerNetworkPolicyDomainSecret>> domainSecrets`
229
230 Optional domain-scoped secrets for allowlisted domains.
231
232 - `String domain`
233
234 The domain associated with the secret.
235
236 - `String name`
237
238 The name of the secret to inject for the domain.
239
240 - `String value`
241
242 The secret value to inject for the domain.
243
244 - `Optional<List<Skill>> skills`
245
246 An optional list of skills referenced by id or inline data.
247
248 - `class SkillReference:`
249
250 - `String skillId`
251
252 The ID of the referenced skill.
253
254 - `JsonValue; type "skill_reference"constant`
255
256 References a skill created with the /v1/skills endpoint.
257
258 - `SKILL_REFERENCE("skill_reference")`
259
260 - `Optional<String> version`
261
262 Optional skill version. Use a positive integer or 'latest'. Omit for default.
263
264 - `class InlineSkill:`
265
266 - `String description`
267
268 The description of the skill.
269
270 - `String name`
271
272 The name of the skill.
273
274 - `InlineSkillSource source`
275
276 Inline skill payload
277
278 - `String data`
279
280 Base64-encoded skill zip bundle.
281
282 - `JsonValue; mediaType "application/zip"constant`
283
284 The media type of the inline skill payload. Must be `application/zip`.
285
286 - `APPLICATION_ZIP("application/zip")`
287
288 - `JsonValue; type "base64"constant`
289
290 The type of the inline skill source. Must be `base64`.
291
292 - `BASE64("base64")`
293
294 - `JsonValue; type "inline"constant`
295
296 Defines an inline skill for this request.
297
298 - `INLINE("inline")`
299
300### Returns
301
302- `class ContainerCreateResponse:`
303
304 - `String id`
305
306 Unique identifier for the container.
307
308 - `long createdAt`
309
310 Unix timestamp (in seconds) when the container was created.
311
312 - `String name`
313
314 Name of the container.
315
316 - `String object_`
317
318 The type of this object.
319
320 - `String status`
321
322 Status of the container (e.g., active, deleted).
323
324 - `Optional<ExpiresAfter> expiresAfter`
325
326 The container will expire after this time period.
327 The anchor is the reference point for the expiration.
328 The minutes is the number of minutes after the anchor before the container expires.
329
330 - `Optional<Anchor> anchor`
331
332 The reference point for the expiration.
333
334 - `LAST_ACTIVE_AT("last_active_at")`
335
336 - `Optional<Long> minutes`
337
338 The number of minutes after the anchor before the container expires.
339
340 - `Optional<Long> lastActiveAt`
341
342 Unix timestamp (in seconds) when the container was last active.
343
344 - `Optional<MemoryLimit> memoryLimit`
345
346 The memory limit configured for the container.
347
348 - `_1G("1g")`
349
350 - `_4G("4g")`
351
352 - `_16G("16g")`
353
354 - `_64G("64g")`
355
356 - `Optional<NetworkPolicy> networkPolicy`
357
358 Network access policy for the container.
359
360 - `Type type`
361
362 The network policy mode.
363
364 - `ALLOWLIST("allowlist")`
365
366 - `DISABLED("disabled")`
367
368 - `Optional<List<String>> allowedDomains`
369
370 Allowed outbound domains when `type` is `allowlist`.
371
372### Example
373
374```java
375package com.openai.example;
376
377import com.openai.client.OpenAIClient;
378import com.openai.client.okhttp.OpenAIOkHttpClient;
379import com.openai.models.containers.ContainerCreateParams;
380import com.openai.models.containers.ContainerCreateResponse;
381
382public final class Main {
383 private Main() {}
384
385 public static void main(String[] args) {
386 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
387
388 ContainerCreateParams params = ContainerCreateParams.builder()
389 .name("name")
390 .build();
391 ContainerCreateResponse container = client.containers().create(params);
392 }
393}
394```
395
396#### Response
397
398```json
399{
400 "id": "id",
401 "created_at": 0,
402 "name": "name",
403 "object": "object",
404 "status": "status",
405 "expires_after": {
406 "anchor": "last_active_at",
407 "minutes": 0
408 },
409 "last_active_at": 0,
410 "memory_limit": "1g",
411 "network_policy": {
412 "type": "allowlist",
413 "allowed_domains": [
414 "string"
415 ]
416 }
417}
418```
419
420## Retrieve container
421
422`ContainerRetrieveResponse containers().retrieve(ContainerRetrieveParamsparams = ContainerRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`
423
424**get** `/containers/{container_id}`
425
426Retrieve Container
427
428### Parameters
429
430- `ContainerRetrieveParams params`
431
432 - `Optional<String> containerId`
433
434### Returns
435
436- `class ContainerRetrieveResponse:`
437
438 - `String id`
439
440 Unique identifier for the container.
441
442 - `long createdAt`
443
444 Unix timestamp (in seconds) when the container was created.
445
446 - `String name`
447
448 Name of the container.
449
450 - `String object_`
451
452 The type of this object.
453
454 - `String status`
455
456 Status of the container (e.g., active, deleted).
457
458 - `Optional<ExpiresAfter> expiresAfter`
459
460 The container will expire after this time period.
461 The anchor is the reference point for the expiration.
462 The minutes is the number of minutes after the anchor before the container expires.
463
464 - `Optional<Anchor> anchor`
465
466 The reference point for the expiration.
467
468 - `LAST_ACTIVE_AT("last_active_at")`
469
470 - `Optional<Long> minutes`
471
472 The number of minutes after the anchor before the container expires.
473
474 - `Optional<Long> lastActiveAt`
475
476 Unix timestamp (in seconds) when the container was last active.
477
478 - `Optional<MemoryLimit> memoryLimit`
479
480 The memory limit configured for the container.
481
482 - `_1G("1g")`
483
484 - `_4G("4g")`
485
486 - `_16G("16g")`
487
488 - `_64G("64g")`
489
490 - `Optional<NetworkPolicy> networkPolicy`
491
492 Network access policy for the container.
493
494 - `Type type`
495
496 The network policy mode.
497
498 - `ALLOWLIST("allowlist")`
499
500 - `DISABLED("disabled")`
501
502 - `Optional<List<String>> allowedDomains`
503
504 Allowed outbound domains when `type` is `allowlist`.
505
506### Example
507
508```java
509package com.openai.example;
510
511import com.openai.client.OpenAIClient;
512import com.openai.client.okhttp.OpenAIOkHttpClient;
513import com.openai.models.containers.ContainerRetrieveParams;
514import com.openai.models.containers.ContainerRetrieveResponse;
515
516public final class Main {
517 private Main() {}
518
519 public static void main(String[] args) {
520 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
521
522 ContainerRetrieveResponse container = client.containers().retrieve("container_id");
523 }
524}
525```
526
527#### Response
528
529```json
530{
531 "id": "id",
532 "created_at": 0,
533 "name": "name",
534 "object": "object",
535 "status": "status",
536 "expires_after": {
537 "anchor": "last_active_at",
538 "minutes": 0
539 },
540 "last_active_at": 0,
541 "memory_limit": "1g",
542 "network_policy": {
543 "type": "allowlist",
544 "allowed_domains": [
545 "string"
546 ]
547 }
548}
549```
550
551## Delete a container
552
553`containers().delete(ContainerDeleteParamsparams = ContainerDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`
554
555**delete** `/containers/{container_id}`
556
557Delete Container
558
559### Parameters
560
561- `ContainerDeleteParams params`
562
563 - `Optional<String> containerId`
564
565### Example
566
567```java
568package com.openai.example;
569
570import com.openai.client.OpenAIClient;
571import com.openai.client.okhttp.OpenAIOkHttpClient;
572import com.openai.models.containers.ContainerDeleteParams;
573
574public final class Main {
575 private Main() {}
576
577 public static void main(String[] args) {
578 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
579
580 client.containers().delete("container_id");
581 }
582}
583```
584
585# Files
586
587## List container files
588
589`FileListPage containers().files().list(FileListParamsparams = FileListParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`
590
591**get** `/containers/{container_id}/files`
592
593List Container files
594
595### Parameters
596
597- `FileListParams params`
598
599 - `Optional<String> containerId`
600
601 - `Optional<String> after`
602
603 A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
604
605 - `Optional<Long> limit`
606
607 A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
608
609 - `Optional<Order> order`
610
611 Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order.
612
613 - `ASC("asc")`
614
615 - `DESC("desc")`
616
617### Returns
618
619- `class FileListResponse:`
620
621 - `String id`
622
623 Unique identifier for the file.
624
625 - `long bytes`
626
627 Size of the file in bytes.
628
629 - `String containerId`
630
631 The container this file belongs to.
632
633 - `long createdAt`
634
635 Unix timestamp (in seconds) when the file was created.
636
637 - `JsonValue; object_ "container.file"constant`
638
639 The type of this object (`container.file`).
640
641 - `CONTAINER_FILE("container.file")`
642
643 - `String path`
644
645 Path of the file in the container.
646
647 - `String source`
648
649 Source of the file (e.g., `user`, `assistant`).
650
651### Example
652
653```java
654package com.openai.example;
655
656import com.openai.client.OpenAIClient;
657import com.openai.client.okhttp.OpenAIOkHttpClient;
658import com.openai.models.containers.files.FileListPage;
659import com.openai.models.containers.files.FileListParams;
660
661public final class Main {
662 private Main() {}
663
664 public static void main(String[] args) {
665 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
666
667 FileListPage page = client.containers().files().list("container_id");
668 }
669}
670```
671
672#### Response
673
674```json
675{
676 "data": [
677 {
678 "id": "id",
679 "bytes": 0,
680 "container_id": "container_id",
681 "created_at": 0,
682 "object": "container.file",
683 "path": "path",
684 "source": "source"
685 }
686 ],
687 "first_id": "first_id",
688 "has_more": true,
689 "last_id": "last_id",
690 "object": "list"
691}
692```
693
694## Create container file
695
696`FileCreateResponse containers().files().create(FileCreateParamsparams = FileCreateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`
697
698**post** `/containers/{container_id}/files`
699
700Create a Container File
701
702You can send either a multipart/form-data request with the raw file content, or a JSON request with a file ID.
703
704### Parameters
705
706- `FileCreateParams params`
707
708 - `Optional<String> containerId`
709
710 - `Optional<String> file`
711
712 The File object (not file name) to be uploaded.
713
714 - `Optional<String> fileId`
715
716 Name of the file to create.
717
718### Returns
719
720- `class FileCreateResponse:`
721
722 - `String id`
723
724 Unique identifier for the file.
725
726 - `long bytes`
727
728 Size of the file in bytes.
729
730 - `String containerId`
731
732 The container this file belongs to.
733
734 - `long createdAt`
735
736 Unix timestamp (in seconds) when the file was created.
737
738 - `JsonValue; object_ "container.file"constant`
739
740 The type of this object (`container.file`).
741
742 - `CONTAINER_FILE("container.file")`
743
744 - `String path`
745
746 Path of the file in the container.
747
748 - `String source`
749
750 Source of the file (e.g., `user`, `assistant`).
751
752### Example
753
754```java
755package com.openai.example;
756
757import com.openai.client.OpenAIClient;
758import com.openai.client.okhttp.OpenAIOkHttpClient;
759import com.openai.models.containers.files.FileCreateParams;
760import com.openai.models.containers.files.FileCreateResponse;
761
762public final class Main {
763 private Main() {}
764
765 public static void main(String[] args) {
766 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
767
768 FileCreateResponse file = client.containers().files().create("container_id");
769 }
770}
771```
772
773#### Response
774
775```json
776{
777 "id": "id",
778 "bytes": 0,
779 "container_id": "container_id",
780 "created_at": 0,
781 "object": "container.file",
782 "path": "path",
783 "source": "source"
784}
785```
786
787## Retrieve container file
788
789`FileRetrieveResponse containers().files().retrieve(FileRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`
790
791**get** `/containers/{container_id}/files/{file_id}`
792
793Retrieve Container File
794
795### Parameters
796
797- `FileRetrieveParams params`
798
799 - `String containerId`
800
801 - `Optional<String> fileId`
802
803### Returns
804
805- `class FileRetrieveResponse:`
806
807 - `String id`
808
809 Unique identifier for the file.
810
811 - `long bytes`
812
813 Size of the file in bytes.
814
815 - `String containerId`
816
817 The container this file belongs to.
818
819 - `long createdAt`
820
821 Unix timestamp (in seconds) when the file was created.
822
823 - `JsonValue; object_ "container.file"constant`
824
825 The type of this object (`container.file`).
826
827 - `CONTAINER_FILE("container.file")`
828
829 - `String path`
830
831 Path of the file in the container.
832
833 - `String source`
834
835 Source of the file (e.g., `user`, `assistant`).
836
837### Example
838
839```java
840package com.openai.example;
841
842import com.openai.client.OpenAIClient;
843import com.openai.client.okhttp.OpenAIOkHttpClient;
844import com.openai.models.containers.files.FileRetrieveParams;
845import com.openai.models.containers.files.FileRetrieveResponse;
846
847public final class Main {
848 private Main() {}
849
850 public static void main(String[] args) {
851 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
852
853 FileRetrieveParams params = FileRetrieveParams.builder()
854 .containerId("container_id")
855 .fileId("file_id")
856 .build();
857 FileRetrieveResponse file = client.containers().files().retrieve(params);
858 }
859}
860```
861
862#### Response
863
864```json
865{
866 "id": "id",
867 "bytes": 0,
868 "container_id": "container_id",
869 "created_at": 0,
870 "object": "container.file",
871 "path": "path",
872 "source": "source"
873}
874```
875
876## Delete a container file
877
878`containers().files().delete(FileDeleteParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`
879
880**delete** `/containers/{container_id}/files/{file_id}`
881
882Delete Container File
883
884### Parameters
885
886- `FileDeleteParams params`
887
888 - `String containerId`
889
890 - `Optional<String> fileId`
891
892### Example
893
894```java
895package com.openai.example;
896
897import com.openai.client.OpenAIClient;
898import com.openai.client.okhttp.OpenAIOkHttpClient;
899import com.openai.models.containers.files.FileDeleteParams;
900
901public final class Main {
902 private Main() {}
903
904 public static void main(String[] args) {
905 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
906
907 FileDeleteParams params = FileDeleteParams.builder()
908 .containerId("container_id")
909 .fileId("file_id")
910 .build();
911 client.containers().files().delete(params);
912 }
913}
914```
915
916# Content
917
918## Retrieve container file content
919
920`HttpResponse containers().files().content().retrieve(ContentRetrieveParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`
921
922**get** `/containers/{container_id}/files/{file_id}/content`
923
924Retrieve Container File Content
925
926### Parameters
927
928- `ContentRetrieveParams params`
929
930 - `String containerId`
931
932 - `Optional<String> fileId`
933
934### Example
935
936```java
937package com.openai.example;
938
939import com.openai.client.OpenAIClient;
940import com.openai.client.okhttp.OpenAIOkHttpClient;
941import com.openai.core.http.HttpResponse;
942import com.openai.models.containers.files.content.ContentRetrieveParams;
943
944public final class Main {
945 private Main() {}
946
947 public static void main(String[] args) {
948 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
949
950 ContentRetrieveParams params = ContentRetrieveParams.builder()
951 .containerId("container_id")
952 .fileId("file_id")
953 .build();
954 HttpResponse content = client.containers().files().content().retrieve(params);
955 }
956}
957```