Skip to content

List containers

client.Containers.List(ctx, query) (*CursorPage[ContainerListResponse], error)
GET/containers

List Containers

ParametersExpand Collapse
query ContainerListParams
After param.Field[string]optional

A 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.

Limit param.Field[int64]optional

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

Order param.Field[ContainerListParamsOrder]optional

Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.

const ContainerListParamsOrderAsc ContainerListParamsOrder = "asc"
const ContainerListParamsOrderDesc ContainerListParamsOrder = "desc"
ReturnsExpand Collapse
type ContainerListResponse struct{…}
ID string

Unique identifier for the container.

CreatedAt int64

Unix timestamp (in seconds) when the container was created.

Name string

Name of the container.

Object string

The type of this object.

Status string

Status of the container (e.g., active, deleted).

ExpiresAfter ContainerListResponseExpiresAfteroptional

The 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.

Anchor stringoptional

The reference point for the expiration.

Minutes int64optional

The number of minutes after the anchor before the container expires.

LastActiveAt int64optional

Unix timestamp (in seconds) when the container was last active.

MemoryLimit ContainerListResponseMemoryLimitoptional

The memory limit configured for the container.

Accepts one of the following:
const ContainerListResponseMemoryLimit1g ContainerListResponseMemoryLimit = "1g"
const ContainerListResponseMemoryLimit4g ContainerListResponseMemoryLimit = "4g"
const ContainerListResponseMemoryLimit16g ContainerListResponseMemoryLimit = "16g"
const ContainerListResponseMemoryLimit64g ContainerListResponseMemoryLimit = "64g"

List containers

package main

import (
  "context"
  "fmt"

  "github.com/openai/openai-go"
  "github.com/openai/openai-go/option"
)

func main() {
  client := openai.NewClient(
    option.WithAPIKey("My API Key"),
  )
  page, err := client.Containers.List(context.TODO(), openai.ContainerListParams{

  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "data": [
    {
      "id": "id",
      "created_at": 0,
      "name": "name",
      "object": "object",
      "status": "status",
      "expires_after": {
        "anchor": "last_active_at",
        "minutes": 0
      },
      "last_active_at": 0,
      "memory_limit": "1g"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}
Returns Examples
{
  "data": [
    {
      "id": "id",
      "created_at": 0,
      "name": "name",
      "object": "object",
      "status": "status",
      "expires_after": {
        "anchor": "last_active_at",
        "minutes": 0
      },
      "last_active_at": 0,
      "memory_limit": "1g"
    }
  ],
  "first_id": "first_id",
  "has_more": true,
  "last_id": "last_id",
  "object": "list"
}