Skip to main content

containers

Creates, updates, deletes, gets or lists a containers resource.

Overview

Namecontainers
TypeResource
Idopenai.containers.containers

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringUnique identifier for the container.
namestringName of the container.
created_atinteger (unixtime)Unix timestamp (in seconds) when the container was created.
expires_afterobjectThe container will expire after this time period. The anchor is the reference point for the expiration. The minutes is the number of minutes after the anchor before the container expires.
last_active_atinteger (unixtime)Unix timestamp (in seconds) when the container was last active.
memory_limitstringThe memory limit configured for the container. (1g, 4g, 16g, 64g)
network_policyobjectNetwork access policy for the container.
objectstringThe type of this object.
statusstringStatus of the container (e.g., active, deleted).

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectcontainer_idopenai-organization, openai-projectRetrieves a container.
listselectlimit, order, after, name, openai-organization, openai-projectLists containers.
createinsertnameopenai-organization, openai-projectCreates a container.
deletedeletecontainer_idopenai-organization, openai-projectDelete a container.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
container_idstringThe ID of the container to delete.
afterstringA cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.
limitintegerA limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. Automatically applied from a SQL LIMIT clause - SELECT ... LIMIT 10 sends limit=10 on the wire. Setting it explicitly in a WHERE clause is not required.
namestringFilter results by container name.
openai-organizationstringOptionally scope the request to a specific organization (overrides the default associated with the API key). Addressable in SQL as openai_organization.
openai-projectstringOptionally scope the request to a specific project (overrides the default associated with the API key). Addressable in SQL as openai_project.
orderstringSort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.

SELECT examples

Retrieves a container.

SELECT
id,
name,
created_at,
expires_after,
last_active_at,
memory_limit,
network_policy,
object,
status
FROM openai.containers.containers
WHERE container_id = '{{ container_id }}' -- required
AND "openai-organization" = '{{ openai-organization }}'
AND "openai-project" = '{{ openai-project }}'
;

INSERT examples

Creates a container.

INSERT INTO openai.containers.containers (
name,
file_ids,
expires_after,
skills,
memory_limit,
network_policy,
"openai-organization",
"openai-project"
)
SELECT
'{{ name }}' /* required */,
'{{ file_ids }}',
'{{ expires_after }}',
'{{ skills }}',
'{{ memory_limit }}',
'{{ network_policy }}',
'{{ openai-organization }}',
'{{ openai-project }}'
RETURNING
id,
name,
created_at,
expires_after,
last_active_at,
memory_limit,
network_policy,
object,
status
;

DELETE examples

Delete a container.

DELETE FROM openai.containers.containers
WHERE container_id = '{{ container_id }}' --required
AND "openai-organization" = '{{ openai-organization }}'
AND "openai-project" = '{{ openai-project }}'
;