Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Openai Openai python Container Create Params

From Leeroopedia
Knowledge Sources
Domains API_Types, Python
Last Updated 2026-02-15 00:00 GMT

Overview

Concrete type for container creation parameters provided by the openai-python SDK.

Description

The ContainerCreateParams TypedDict defines the parameters for creating a new container via client.containers.create(). It requires a name and offers optional configuration for expires_after (time-based expiration relative to last activity), file_ids (files to copy into the container), memory_limit (1g, 4g, 16g, or 64g), network_policy (disabled or allowlist with specific domains), and skills (referenced by ID or inline). The nested ExpiresAfter TypedDict configures expiration with a "last_active_at" anchor and a minutes value. NetworkPolicy and Skill are TypeAlias unions for their respective sub-types.

Usage

Import this type when constructing or type-hinting parameters for container creation calls.

Code Reference

Source Location

Signature

class ContainerCreateParams(TypedDict, total=False):
    name: Required[str]
    expires_after: ExpiresAfter
    file_ids: SequenceNotStr[str]
    memory_limit: Literal["1g", "4g", "16g", "64g"]
    network_policy: NetworkPolicy
    skills: Iterable[Skill]

class ExpiresAfter(TypedDict, total=False):
    anchor: Required[Literal["last_active_at"]]
    minutes: Required[int]

NetworkPolicy = Union[ContainerNetworkPolicyDisabledParam, ContainerNetworkPolicyAllowlistParam]
Skill = Union[SkillReferenceParam, InlineSkillParam]

Import

from openai.types import ContainerCreateParams

I/O Contract

Fields

Name Type Required Description
name str Yes Name of the container to create
expires_after ExpiresAfter No Expiration policy relative to last activity
file_ids SequenceNotStr[str] No IDs of files to copy to the container
memory_limit Literal["1g", "4g", "16g", "64g"] No Memory limit for the container (default "1g")
network_policy NetworkPolicy No Network access policy (disabled or allowlist)
skills Iterable[Skill] No Skills referenced by ID or inline data

ExpiresAfter Fields

Name Type Required Description
anchor Literal["last_active_at"] Yes Time anchor; only "last_active_at" supported
minutes int Yes Minutes after the anchor before the container expires

Usage Examples

from openai import OpenAI

client = OpenAI()

container = client.containers.create(
    name="my-sandbox",
    memory_limit="4g",
    expires_after={
        "anchor": "last_active_at",
        "minutes": 60,
    },
    file_ids=["file-abc123", "file-def456"],
)
print(container.id)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment