java/resources/containers/methods/create/index.md +0 −259 deleted
File Deleted View Diff
1## Create container
2
3`ContainerCreateResponse containers().create(ContainerCreateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`
4
5**post** `/containers`
6
7Create Container
8
9### Parameters
10
11- `ContainerCreateParams params`
12
13 - `String name`
14
15 Name of the container to create.
16
17 - `Optional<ExpiresAfter> expiresAfter`
18
19 Container expiration time in seconds relative to the 'anchor' time.
20
21 - `Anchor anchor`
22
23 Time anchor for the expiration time. Currently only 'last_active_at' is supported.
24
25 - `LAST_ACTIVE_AT("last_active_at")`
26
27 - `long minutes`
28
29 - `Optional<List<String>> fileIds`
30
31 IDs of files to copy to the container.
32
33 - `Optional<MemoryLimit> memoryLimit`
34
35 Optional memory limit for the container. Defaults to "1g".
36
37 - `_1G("1g")`
38
39 - `_4G("4g")`
40
41 - `_16G("16g")`
42
43 - `_64G("64g")`
44
45 - `Optional<NetworkPolicy> networkPolicy`
46
47 Network access policy for the container.
48
49 - `class ContainerNetworkPolicyDisabled:`
50
51 - `JsonValue; type "disabled"constant`
52
53 Disable outbound network access. Always `disabled`.
54
55 - `DISABLED("disabled")`
56
57 - `class ContainerNetworkPolicyAllowlist:`
58
59 - `List<String> allowedDomains`
60
61 A list of allowed domains when type is `allowlist`.
62
63 - `JsonValue; type "allowlist"constant`
64
65 Allow outbound network access only to specified domains. Always `allowlist`.
66
67 - `ALLOWLIST("allowlist")`
68
69 - `Optional<List<ContainerNetworkPolicyDomainSecret>> domainSecrets`
70
71 Optional domain-scoped secrets for allowlisted domains.
72
73 - `String domain`
74
75 The domain associated with the secret.
76
77 - `String name`
78
79 The name of the secret to inject for the domain.
80
81 - `String value`
82
83 The secret value to inject for the domain.
84
85 - `Optional<List<Skill>> skills`
86
87 An optional list of skills referenced by id or inline data.
88
89 - `class SkillReference:`
90
91 - `String skillId`
92
93 The ID of the referenced skill.
94
95 - `JsonValue; type "skill_reference"constant`
96
97 References a skill created with the /v1/skills endpoint.
98
99 - `SKILL_REFERENCE("skill_reference")`
100
101 - `Optional<String> version`
102
103 Optional skill version. Use a positive integer or 'latest'. Omit for default.
104
105 - `class InlineSkill:`
106
107 - `String description`
108
109 The description of the skill.
110
111 - `String name`
112
113 The name of the skill.
114
115 - `InlineSkillSource source`
116
117 Inline skill payload
118
119 - `String data`
120
121 Base64-encoded skill zip bundle.
122
123 - `JsonValue; mediaType "application/zip"constant`
124
125 The media type of the inline skill payload. Must be `application/zip`.
126
127 - `APPLICATION_ZIP("application/zip")`
128
129 - `JsonValue; type "base64"constant`
130
131 The type of the inline skill source. Must be `base64`.
132
133 - `BASE64("base64")`
134
135 - `JsonValue; type "inline"constant`
136
137 Defines an inline skill for this request.
138
139 - `INLINE("inline")`
140
141### Returns
142
143- `class ContainerCreateResponse:`
144
145 - `String id`
146
147 Unique identifier for the container.
148
149 - `long createdAt`
150
151 Unix timestamp (in seconds) when the container was created.
152
153 - `String name`
154
155 Name of the container.
156
157 - `String object_`
158
159 The type of this object.
160
161 - `String status`
162
163 Status of the container (e.g., active, deleted).
164
165 - `Optional<ExpiresAfter> expiresAfter`
166
167 The container will expire after this time period.
168 The anchor is the reference point for the expiration.
169 The minutes is the number of minutes after the anchor before the container expires.
170
171 - `Optional<Anchor> anchor`
172
173 The reference point for the expiration.
174
175 - `LAST_ACTIVE_AT("last_active_at")`
176
177 - `Optional<Long> minutes`
178
179 The number of minutes after the anchor before the container expires.
180
181 - `Optional<Long> lastActiveAt`
182
183 Unix timestamp (in seconds) when the container was last active.
184
185 - `Optional<MemoryLimit> memoryLimit`
186
187 The memory limit configured for the container.
188
189 - `_1G("1g")`
190
191 - `_4G("4g")`
192
193 - `_16G("16g")`
194
195 - `_64G("64g")`
196
197 - `Optional<NetworkPolicy> networkPolicy`
198
199 Network access policy for the container.
200
201 - `Type type`
202
203 The network policy mode.
204
205 - `ALLOWLIST("allowlist")`
206
207 - `DISABLED("disabled")`
208
209 - `Optional<List<String>> allowedDomains`
210
211 Allowed outbound domains when `type` is `allowlist`.
212
213### Example
214
215```java
216package com.openai.example;
217
218import com.openai.client.OpenAIClient;
219import com.openai.client.okhttp.OpenAIOkHttpClient;
220import com.openai.models.containers.ContainerCreateParams;
221import com.openai.models.containers.ContainerCreateResponse;
222
223public final class Main {
224 private Main() {}
225
226 public static void main(String[] args) {
227 OpenAIClient client = OpenAIOkHttpClient.fromEnv();
228
229 ContainerCreateParams params = ContainerCreateParams.builder()
230 .name("name")
231 .build();
232 ContainerCreateResponse container = client.containers().create(params);
233 }
234}
235```
236
237#### Response
238
239```json
240{
241 "id": "id",
242 "created_at": 0,
243 "name": "name",
244 "object": "object",
245 "status": "status",
246 "expires_after": {
247 "anchor": "last_active_at",
248 "minutes": 0
249 },
250 "last_active_at": 0,
251 "memory_limit": "1g",
252 "network_policy": {
253 "type": "allowlist",
254 "allowed_domains": [
255 "string"
256 ]
257 }
258}
259```