Implementation:Openai Openai python Container Create Response
| Knowledge Sources | |
|---|---|
| Domains | API_Types, Python |
| Last Updated | 2026-02-15 00:00 GMT |
Overview
Concrete type for the container creation response object provided by the openai-python SDK.
Description
The ContainerCreateResponse Pydantic model represents the response returned when a new container is created. It contains the container's id, name, created_at timestamp, object type, and status (e.g., active, deleted). Optional fields include expires_after (with ExpiresAfter nested model defining the anchor and minutes), last_active_at timestamp, memory_limit (1g, 4g, 16g, or 64g), and network_policy (with NetworkPolicy nested model specifying the policy type and optional allowed domains).
Usage
Import this type when inspecting the return value of client.containers.create().
Code Reference
Source Location
- Repository: openai-python
- File: src/openai/types/container_create_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 ContainerCreateResponse(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 ContainerCreateResponse
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()
response = client.containers.create(name="sandbox-env", memory_limit="4g")
print(response.id) # e.g. "container_abc123"
print(response.status) # e.g. "active"
print(response.created_at) # Unix timestamp
if response.network_policy:
print(response.network_policy.type)