microsoft-foundry.rest.security.o-auth2-auth
Containers
Get a container
GET
/openai/v1/containers/{container_id}
Retrieves a container by its identifier.
パス パラメーター
container_id
string
必須
The ID of the container.
応答
The request has succeeded.
本文
Content-Type: application/json
id
string
必須
Unique identifier for the container.
object
string
必須
The type of this object.
name
string
必須
Name of the container.
created_at
integer
必須
Unix timestamp (in seconds) when the container was created.
status
string
必須
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
last_active_at
minutes
integer
memory_limit
enum
The memory limit configured for the container.
1g4g16g64g
network_policy
disabled | allowlist
Network access policy for the container.
次のいずれか:
disabled
OpenAI.ContainerNetworkPolicyDisabledParam
type
enum
必須
Disable outbound network access. Always disabled.
disabled
allowlist
OpenAI.ContainerNetworkPolicyAllowlistParam
type
enum
必須
Allow outbound network access only to specified domains. Always allowlist.
allowlist
allowed_domains
string[]
必須
A list of allowed domains when type is allowlist.
要求
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)
回答
{
"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"
}