SpyBara
Go Premium

go/resources/containers/methods/create/index.md 2026-05-02 05:57 UTC to 2026-05-05 23:00 UTC

262 added, 0 removed.

2026
Wed 27 06:42 Fri 22 06:33 Wed 20 06:35 Tue 19 06:34 Mon 18 22:01 Mon 11 18:00 Thu 7 21:57 Tue 5 23:00 Sat 2 05:57
Data Information:
  • After 2026-05-05 06:03 UTC, this monitor no longer uses markdownified HTML/MDX. Comparisons across that boundary can therefore show more extensive diffs.

Create container

client.Containers.New(ctx, body) (*ContainerNewResponse, error)

post /containers

Create Container

Parameters

  • body ContainerNewParams

    • Name param.Field[string]

      Name of the container to create.

    • ExpiresAfter param.Field[ContainerNewParamsExpiresAfter]

      Container expiration time in seconds relative to the 'anchor' time.

      • Anchor string

        Time anchor for the expiration time. Currently only 'last_active_at' is supported.

        • const ContainerNewParamsExpiresAfterAnchorLastActiveAt ContainerNewParamsExpiresAfterAnchor = "last_active_at"
      • Minutes int64

    • FileIDs param.Field[[]string]

      IDs of files to copy to the container.

    • MemoryLimit param.Field[ContainerNewParamsMemoryLimit]

      Optional memory limit for the container. Defaults to "1g".

      • const ContainerNewParamsMemoryLimit1g ContainerNewParamsMemoryLimit = "1g"

      • const ContainerNewParamsMemoryLimit4g ContainerNewParamsMemoryLimit = "4g"

      • const ContainerNewParamsMemoryLimit16g ContainerNewParamsMemoryLimit = "16g"

      • const ContainerNewParamsMemoryLimit64g ContainerNewParamsMemoryLimit = "64g"

    • NetworkPolicy param.Field[ContainerNewParamsNetworkPolicyUnion]

      Network access policy for the container.

      • type ContainerNetworkPolicyDisabled struct{…}

        • Type Disabled

          Disable outbound network access. Always disabled.

          • const DisabledDisabled Disabled = "disabled"
      • type ContainerNetworkPolicyAllowlist struct{…}

        • AllowedDomains []string

          A list of allowed domains when type is allowlist.

        • Type Allowlist

          Allow outbound network access only to specified domains. Always allowlist.

          • const AllowlistAllowlist Allowlist = "allowlist"
        • DomainSecrets []ContainerNetworkPolicyDomainSecret

          Optional domain-scoped secrets for allowlisted domains.

          • Domain string

            The domain associated with the secret.

          • Name string

            The name of the secret to inject for the domain.

          • Value string

            The secret value to inject for the domain.

    • Skills param.Field[[]ContainerNewParamsSkillUnion]

      An optional list of skills referenced by id or inline data.

      • type SkillReference struct{…}

        • SkillID string

          The ID of the referenced skill.

        • Type SkillReference

          References a skill created with the /v1/skills endpoint.

          • const SkillReferenceSkillReference SkillReference = "skill_reference"
        • Version string

          Optional skill version. Use a positive integer or 'latest'. Omit for default.

      • type InlineSkill struct{…}

        • Description string

          The description of the skill.

        • Name string

          The name of the skill.

        • Source InlineSkillSource

          Inline skill payload

          • Data string

            Base64-encoded skill zip bundle.

          • MediaType ApplicationZip

            The media type of the inline skill payload. Must be application/zip.

            • const ApplicationZipApplicationZip ApplicationZip = "application/zip"
          • Type Base64

            The type of the inline skill source. Must be base64.

            • const Base64Base64 Base64 = "base64"
        • Type Inline

          Defines an inline skill for this request.

          • const InlineInline Inline = "inline"

Returns

  • type ContainerNewResponse 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 ContainerNewResponseExpiresAfter

      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 string

        The reference point for the expiration.

        • const ContainerNewResponseExpiresAfterAnchorLastActiveAt ContainerNewResponseExpiresAfterAnchor = "last_active_at"
      • Minutes int64

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

    • LastActiveAt int64

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

    • MemoryLimit ContainerNewResponseMemoryLimit

      The memory limit configured for the container.

      • const ContainerNewResponseMemoryLimit1g ContainerNewResponseMemoryLimit = "1g"

      • const ContainerNewResponseMemoryLimit4g ContainerNewResponseMemoryLimit = "4g"

      • const ContainerNewResponseMemoryLimit16g ContainerNewResponseMemoryLimit = "16g"

      • const ContainerNewResponseMemoryLimit64g ContainerNewResponseMemoryLimit = "64g"

    • NetworkPolicy ContainerNewResponseNetworkPolicy

      Network access policy for the container.

      • Type string

        The network policy mode.

        • const ContainerNewResponseNetworkPolicyTypeAllowlist ContainerNewResponseNetworkPolicyType = "allowlist"

        • const ContainerNewResponseNetworkPolicyTypeDisabled ContainerNewResponseNetworkPolicyType = "disabled"

      • AllowedDomains []string

        Allowed outbound domains when type is allowlist.

Example

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"),
  )
  container, err := client.Containers.New(context.TODO(), openai.ContainerNewParams{
    Name: "name",
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", container.ID)
}

Response

{
  "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",
  "network_policy": {
    "type": "allowlist",
    "allowed_domains": [
      "string"
    ]
  }
}