Containers
Get a container
Retrieves a container by its identifier.
Padparameters
container_id
string
vereist
The ID of the container.
Antwoorden
The request has succeeded.
Hoofdtekst
id
string
vereist
Unique identifier for the container.
object
string
vereist
The type of this object.
name
string
vereist
Name of the container.
created_at
integer
vereist
Unix timestamp (in seconds) when the container was created.
status
string
vereist
Status of the container (e.g., active, deleted).
last_active_at
integer
Unix timestamp (in seconds) when the container was last active.
expires_after
OpenAI.ContainerResourceExpiresAfter
anchor
enum
memory_limit
enum
The memory limit configured for the container.
network_policy
disabled | allowlist
Network access policy for the container.
disabled
OpenAI.ContainerNetworkPolicyDisabledParam
type
enum
vereist
Disable outbound network access. Always disabled.
allowlist
OpenAI.ContainerNetworkPolicyAllowlistParam
type
enum
vereist
Allow outbound network access only to specified domains. Always allowlist.
allowed_domains
string[]
vereist
A list of allowed domains when type is allowlist.
Aanvraag
curl https://api.openai.com/v1/containers/cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863 \
-H "Authorization: Bearer $OPENAI_API_KEY"
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted
});
const container = await client.containers.retrieve('container_id');
console.log(container.id);
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
container = client.containers.retrieve(
"container_id",
)
print(container.id)
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.Get(context.TODO(), "container_id")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v
", container.ID)
}
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.containers.ContainerRetrieveParams;
import com.openai.models.containers.ContainerRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
ContainerRetrieveResponse container = client.containers().retrieve("container_id");
}
}
require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
container = openai.containers.retrieve("container_id")
puts(container)
Respons
{
"id": "cntr_682dfebaacac8198bbfe9c2474fb6f4a085685cbe3cb5863",
"object": "container",
"created_at": 1747844794,
"status": "running",
"expires_after": {
"anchor": "last_active_at",
"minutes": 20
},
"last_active_at": 1747844794,
"memory_limit": "4g",
"name": "My Container"
}