跳转到内容
EN

列出文件

GET/openai/v1/files● 支持

OpenAI 官方文档 ↗

请求参数

  • purposestring可选

    query: Only return files with the given purpose.

    已验证生效。

  • limitinteger可选
    默认 10000

    query: A limit on the number of objects to be returned. Limit can range between 1 and 10,000, and the default is 10,000.

    已验证生效。

  • orderstring可选
    默认 "desc"

    query: Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.

    已验证生效。

    取值 ascdesc
  • afterstring可选

    query: 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.

    已验证生效。

返回

200 list

只接受查询参数 after、order、limit、purpose;其他查询参数返回 400 invalid_request_error,消息为 "Unrecognized request argument supplied: <参数>",param 为该参数。

错误按 OpenAI 格式返回,参见 错误码

请求示例

curl
curl https://api.deepraxis.com/openai/v1/files \
  -H "Authorization: Bearer $PRAXIS_API_KEY"
Python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.deepraxis.com/openai/v1",
    api_key="$PRAXIS_API_KEY",
)

files = client.files.list()
TypeScript
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.deepraxis.com/openai/v1",
  apiKey: "$PRAXIS_API_KEY",
});

const files = await client.files.list();

响应示例 200

{
  "object": "list",
  "data": [
    {
      "id": "file_dp_01M41EAAEQ3N9T5T1D5Y6PYXNB",
      "object": "file",
      "bytes": 70,
      "created_at": 1791049935,
      "filename": "pixel.png",
      "purpose": "user_data",
      "status": "processed",
      "status_details": null
    }
  ],
  "first_id": "file_dp_01M41EAAEQ3N9T5T1D5Y6PYXNB",
  "last_id": "file_dp_01M41EAAEQ3N9T5T1D5Y6PYXNB",
  "has_more": false
}

响应

HTTP 200

OK

application/json

名称 类型 说明
object string
data array<object>
data[].id string The file identifier, which can be referenced in the API endpoints.
data[].bytes integer The size of the file, in bytes.
data[].created_at integer The Unix timestamp (in seconds) for when the file was created.
data[].expires_at integer The Unix timestamp (in seconds) for when the file will expire.
data[].filename string The name of the file.
data[].object string The object type, which is always file.
data[].purpose string The intended purpose of the file. Supported values are assistants, assistants_output, batch, batch_output, fine-tune, fine-tune-results, vision, and user_data.
data[].status string Deprecated. The current status of the file, which can be either uploaded, processed, or error.
data[].status_details string Deprecated. For details on why a fine-tuning training file failed validation, see the error field on fine_tuning.job.
first_id string
last_id string
has_more boolean