python/resources/containers/methods/retrieve/index.md +0 −122 deleted
File Deleted View Diff
1## Retrieve container
2
3`containers.retrieve(strcontainer_id) -> ContainerRetrieveResponse`
4
5**get** `/containers/{container_id}`
6
7Retrieve Container
8
9### Parameters
10
11- `container_id: str`
12
13### Returns
14
15- `class ContainerRetrieveResponse: …`
16
17 - `id: str`
18
19 Unique identifier for the container.
20
21 - `created_at: int`
22
23 Unix timestamp (in seconds) when the container was created.
24
25 - `name: str`
26
27 Name of the container.
28
29 - `object: str`
30
31 The type of this object.
32
33 - `status: str`
34
35 Status of the container (e.g., active, deleted).
36
37 - `expires_after: Optional[ExpiresAfter]`
38
39 The container will expire after this time period.
40 The anchor is the reference point for the expiration.
41 The minutes is the number of minutes after the anchor before the container expires.
42
43 - `anchor: Optional[Literal["last_active_at"]]`
44
45 The reference point for the expiration.
46
47 - `"last_active_at"`
48
49 - `minutes: Optional[int]`
50
51 The number of minutes after the anchor before the container expires.
52
53 - `last_active_at: Optional[int]`
54
55 Unix timestamp (in seconds) when the container was last active.
56
57 - `memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]]`
58
59 The memory limit configured for the container.
60
61 - `"1g"`
62
63 - `"4g"`
64
65 - `"16g"`
66
67 - `"64g"`
68
69 - `network_policy: Optional[NetworkPolicy]`
70
71 Network access policy for the container.
72
73 - `type: Literal["allowlist", "disabled"]`
74
75 The network policy mode.
76
77 - `"allowlist"`
78
79 - `"disabled"`
80
81 - `allowed_domains: Optional[List[str]]`
82
83 Allowed outbound domains when `type` is `allowlist`.
84
85### Example
86
87```python
88import os
89from openai import OpenAI
90
91client = OpenAI(
92 api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
93)
94container = client.containers.retrieve(
95 "container_id",
96)
97print(container.id)
98```
99
100#### Response
101
102```json
103{
104 "id": "id",
105 "created_at": 0,
106 "name": "name",
107 "object": "object",
108 "status": "status",
109 "expires_after": {
110 "anchor": "last_active_at",
111 "minutes": 0
112 },
113 "last_active_at": 0,
114 "memory_limit": "1g",
115 "network_policy": {
116 "type": "allowlist",
117 "allowed_domains": [
118 "string"
119 ]
120 }
121}
122```