go/resources/containers/methods/create/index.md +0 −262 deleted
File Deleted View Diff
1## Create container
2
3`client.Containers.New(ctx, body) (*ContainerNewResponse, error)`
4
5**post** `/containers`
6
7Create Container
8
9### Parameters
10
11- `body ContainerNewParams`
12
13 - `Name param.Field[string]`
14
15 Name of the container to create.
16
17 - `ExpiresAfter param.Field[ContainerNewParamsExpiresAfter]`
18
19 Container expiration time in seconds relative to the 'anchor' time.
20
21 - `Anchor string`
22
23 Time anchor for the expiration time. Currently only 'last_active_at' is supported.
24
25 - `const ContainerNewParamsExpiresAfterAnchorLastActiveAt ContainerNewParamsExpiresAfterAnchor = "last_active_at"`
26
27 - `Minutes int64`
28
29 - `FileIDs param.Field[[]string]`
30
31 IDs of files to copy to the container.
32
33 - `MemoryLimit param.Field[ContainerNewParamsMemoryLimit]`
34
35 Optional memory limit for the container. Defaults to "1g".
36
37 - `const ContainerNewParamsMemoryLimit1g ContainerNewParamsMemoryLimit = "1g"`
38
39 - `const ContainerNewParamsMemoryLimit4g ContainerNewParamsMemoryLimit = "4g"`
40
41 - `const ContainerNewParamsMemoryLimit16g ContainerNewParamsMemoryLimit = "16g"`
42
43 - `const ContainerNewParamsMemoryLimit64g ContainerNewParamsMemoryLimit = "64g"`
44
45 - `NetworkPolicy param.Field[ContainerNewParamsNetworkPolicyUnion]`
46
47 Network access policy for the container.
48
49 - `type ContainerNetworkPolicyDisabled struct{…}`
50
51 - `Type Disabled`
52
53 Disable outbound network access. Always `disabled`.
54
55 - `const DisabledDisabled Disabled = "disabled"`
56
57 - `type ContainerNetworkPolicyAllowlist struct{…}`
58
59 - `AllowedDomains []string`
60
61 A list of allowed domains when type is `allowlist`.
62
63 - `Type Allowlist`
64
65 Allow outbound network access only to specified domains. Always `allowlist`.
66
67 - `const AllowlistAllowlist Allowlist = "allowlist"`
68
69 - `DomainSecrets []ContainerNetworkPolicyDomainSecret`
70
71 Optional domain-scoped secrets for allowlisted domains.
72
73 - `Domain string`
74
75 The domain associated with the secret.
76
77 - `Name string`
78
79 The name of the secret to inject for the domain.
80
81 - `Value string`
82
83 The secret value to inject for the domain.
84
85 - `Skills param.Field[[]ContainerNewParamsSkillUnion]`
86
87 An optional list of skills referenced by id or inline data.
88
89 - `type SkillReference struct{…}`
90
91 - `SkillID string`
92
93 The ID of the referenced skill.
94
95 - `Type SkillReference`
96
97 References a skill created with the /v1/skills endpoint.
98
99 - `const SkillReferenceSkillReference SkillReference = "skill_reference"`
100
101 - `Version string`
102
103 Optional skill version. Use a positive integer or 'latest'. Omit for default.
104
105 - `type InlineSkill struct{…}`
106
107 - `Description string`
108
109 The description of the skill.
110
111 - `Name string`
112
113 The name of the skill.
114
115 - `Source InlineSkillSource`
116
117 Inline skill payload
118
119 - `Data string`
120
121 Base64-encoded skill zip bundle.
122
123 - `MediaType ApplicationZip`
124
125 The media type of the inline skill payload. Must be `application/zip`.
126
127 - `const ApplicationZipApplicationZip ApplicationZip = "application/zip"`
128
129 - `Type Base64`
130
131 The type of the inline skill source. Must be `base64`.
132
133 - `const Base64Base64 Base64 = "base64"`
134
135 - `Type Inline`
136
137 Defines an inline skill for this request.
138
139 - `const InlineInline Inline = "inline"`
140
141### Returns
142
143- `type ContainerNewResponse struct{…}`
144
145 - `ID string`
146
147 Unique identifier for the container.
148
149 - `CreatedAt int64`
150
151 Unix timestamp (in seconds) when the container was created.
152
153 - `Name string`
154
155 Name of the container.
156
157 - `Object string`
158
159 The type of this object.
160
161 - `Status string`
162
163 Status of the container (e.g., active, deleted).
164
165 - `ExpiresAfter ContainerNewResponseExpiresAfter`
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 - `Anchor string`
172
173 The reference point for the expiration.
174
175 - `const ContainerNewResponseExpiresAfterAnchorLastActiveAt ContainerNewResponseExpiresAfterAnchor = "last_active_at"`
176
177 - `Minutes int64`
178
179 The number of minutes after the anchor before the container expires.
180
181 - `LastActiveAt int64`
182
183 Unix timestamp (in seconds) when the container was last active.
184
185 - `MemoryLimit ContainerNewResponseMemoryLimit`
186
187 The memory limit configured for the container.
188
189 - `const ContainerNewResponseMemoryLimit1g ContainerNewResponseMemoryLimit = "1g"`
190
191 - `const ContainerNewResponseMemoryLimit4g ContainerNewResponseMemoryLimit = "4g"`
192
193 - `const ContainerNewResponseMemoryLimit16g ContainerNewResponseMemoryLimit = "16g"`
194
195 - `const ContainerNewResponseMemoryLimit64g ContainerNewResponseMemoryLimit = "64g"`
196
197 - `NetworkPolicy ContainerNewResponseNetworkPolicy`
198
199 Network access policy for the container.
200
201 - `Type string`
202
203 The network policy mode.
204
205 - `const ContainerNewResponseNetworkPolicyTypeAllowlist ContainerNewResponseNetworkPolicyType = "allowlist"`
206
207 - `const ContainerNewResponseNetworkPolicyTypeDisabled ContainerNewResponseNetworkPolicyType = "disabled"`
208
209 - `AllowedDomains []string`
210
211 Allowed outbound domains when `type` is `allowlist`.
212
213### Example
214
215```go
216package main
217
218import (
219 "context"
220 "fmt"
221
222 "github.com/openai/openai-go"
223 "github.com/openai/openai-go/option"
224)
225
226func main() {
227 client := openai.NewClient(
228 option.WithAPIKey("My API Key"),
229 )
230 container, err := client.Containers.New(context.TODO(), openai.ContainerNewParams{
231 Name: "name",
232 })
233 if err != nil {
234 panic(err.Error())
235 }
236 fmt.Printf("%+v\n", container.ID)
237}
238```
239
240#### Response
241
242```json
243{
244 "id": "id",
245 "created_at": 0,
246 "name": "name",
247 "object": "object",
248 "status": "status",
249 "expires_after": {
250 "anchor": "last_active_at",
251 "minutes": 0
252 },
253 "last_active_at": 0,
254 "memory_limit": "1g",
255 "network_policy": {
256 "type": "allowlist",
257 "allowed_domains": [
258 "string"
259 ]
260 }
261}
262```