Containers
Get a container
Retrieves a container by its identifier.
Yol parametreleri
container_id
string
gerekli
The ID of the container.
Yanıtlar
The request has succeeded.
Gövde
id
string
gerekli
Unique identifier for the container.
object
string
gerekli
The type of this object.
name
string
gerekli
Name of the container.
created_at
integer
gerekli
Unix timestamp (in seconds) when the container was created.
status
string
gerekli
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
gerekli
Disable outbound network access. Always disabled.
allowlist
OpenAI.ContainerNetworkPolicyAllowlistParam
type
enum
gerekli
Allow outbound network access only to specified domains. Always allowlist.
allowed_domains
string[]
gerekli
A list of allowed domains when type is allowlist.
İstek
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)
Response
{
"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"
}