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