Containers
List container files
Lists container files matching the request filters.
Parâmetros de caminho
container_id
string
exigido
The ID of the container.
Parâmetros de consulta
limit
integer
A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.
order
enum
Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.
after
string
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.
Respostas
The request has succeeded.
Corpo
object
enum
exigido
The type of object returned, must be 'list'.
data
OpenAI.ContainerFileResource[]
exigido
A list of container files.
first_id
string
exigido
The ID of the first file in the list.
last_id
string
exigido
The ID of the last file in the list.
has_more
boolean
exigido
Whether there are more files available.
Solicitar
curl https://api.openai.com/v1/containers/cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04/files \
-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
});
// Automatically fetches more pages as needed.
for await (const fileListResponse of client.containers.files.list('container_id')) {
console.log(fileListResponse.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
)
page = client.containers.files.list(
container_id="container_id",
)
page = page.data[0]
print(page.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"),
)
page, err := client.Containers.Files.List(
context.TODO(),
"container_id",
openai.ContainerFileListParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v
", page)
}
package com.openai.example;
import com.openai.client.OpenAIClient;
import com.openai.client.okhttp.OpenAIOkHttpClient;
import com.openai.models.containers.files.FileListPage;
import com.openai.models.containers.files.FileListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
OpenAIClient client = OpenAIOkHttpClient.fromEnv();
FileListPage page = client.containers().files().list("container_id");
}
}
require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
page = openai.containers.files.list("container_id")
puts(page)
Resposta
{
"object": "list",
"data": [
{
"id": "cfile_682e0e8a43c88191a7978f477a09bdf5",
"object": "container.file",
"created_at": 1747848842,
"bytes": 880,
"container_id": "cntr_682e0e7318108198aa783fd921ff305e08e78805b9fdbb04",
"path": "/mnt/data/88e12fa445d32636f190a0b33daed6cb-tsconfig.json",
"source": "user"
}
],
"first_id": "cfile_682e0e8a43c88191a7978f477a09bdf5",
"has_more": false,
"last_id": "cfile_682e0e8a43c88191a7978f477a09bdf5"
}