Implementation:Openai Openai python Container Retrieve Response
| Knowledge Sources | |
|---|---|
| Domains | API_Types, Python |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Concrete type for the container retrieve response object provided by the openai-python SDK.
Description
The ContainerRetrieveResponse Pydantic model represents the response when retrieving a single container by ID. It shares the same structure as ContainerCreateResponse and ContainerListResponse: required fields id, created_at, name, object, and status, plus optional expires_after (nested ExpiresAfter), last_active_at, memory_limit, and network_policy (nested NetworkPolicy). The NetworkPolicy model specifies either "allowlist" or "disabled" type with optional allowed domain list.
Usage
Import this type when inspecting the return value of client.containers.retrieve().
Code Reference
Source Location
- Repository: openai-python
- File: src/openai/types/container_retrieve_response.py
Signature
class ExpiresAfter(BaseModel):
anchor: Optional[Literal["last_active_at"]] = None
minutes: Optional[int] = None
class NetworkPolicy(BaseModel):
type: Literal["allowlist", "disabled"]
allowed_domains: Optional[List[str]] = None
class ContainerRetrieveResponse(BaseModel):
id: str
created_at: int
name: str
object: str
status: str
expires_after: Optional[ExpiresAfter] = None
last_active_at: Optional[int] = None
memory_limit: Optional[Literal["1g", "4g", "16g", "64g"]] = None
network_policy: Optional[NetworkPolicy] = None
Import
from openai.types import ContainerRetrieveResponse
I/O Contract
Fields
| Name | Type | Required | Description |
|---|---|---|---|
| id | str | Yes | Unique identifier for the container |
| created_at | int | Yes | Unix timestamp (seconds) when the container was created |
| name | str | Yes | Name of the container |
| object | str | Yes | The object type |
| status | str | Yes | Status of the container (e.g., active, deleted) |
| expires_after | Optional[ExpiresAfter] | No | Expiration policy with anchor and minutes |
| last_active_at | Optional[int] | No | Unix timestamp when the container was last active |
| memory_limit | Optional[Literal["1g", "4g", "16g", "64g"]] | No | Configured memory limit |
| network_policy | Optional[NetworkPolicy] | No | Network access policy (type and allowed domains) |
Usage Examples
from openai import OpenAI
client = OpenAI()
container = client.containers.retrieve("container_abc123")
print(f"Name: {container.name}")
print(f"Status: {container.status}")
print(f"Created: {container.created_at}")
if container.network_policy:
print(f"Network: {container.network_policy.type}")
if container.network_policy.allowed_domains:
print(f" Domains: {container.network_policy.allowed_domains}")