跳转到内容
EN

列出文件

GET/file/v1/files● 支持

请求参数

  • 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: File ID cursor for the next page; mutually exclusive with before. Use an ID from the current listing.

  • scope_idstring可选

    query: Session whose output files to list. Accepts sesn_ or ags_ followed by 1 to 251 letters, digits, underscores or hyphens. An existing session with no outputs returns an empty list; a nonexistent or inaccessible session returns 404.

  • idsarray可选

    query: Return only these files, up to 100 IDs separated by commas, so metadata for many known files takes one call instead of one retrieve per file. An ID that is not a live file of your tenant is simply absent from the list, as a retrieve would answer 404; more than 100 IDs returns 400. Combines with the other filters.

  • beforestring可选

    query: File ID cursor for the preceding page; mutually exclusive with after. Use an ID from the current listing.

返回

200 list

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

请求示例

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

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

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

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

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

响应示例 200

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

响应

HTTP 200

OK

application/json

名称 类型 说明
object string Object type; always list.
data array<object> Files of the page, in the requested order.
data[].id string File identifier: file- followed by 24 base62 characters. Use the ID returned by upload or list.
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 | null 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 Upload purpose. Image references in conversations require user_data.
data[].status string Deprecated. The current status of the file, which can be either uploaded, processed, or error.
data[].mime_type string Content-detected MIME type.
data[].scope object | null Session scope for session outputs; null for other files.
data[].relative_path string Path within the session output directory; present for session outputs.
data[].revision integer Session output revision; present for session outputs.
data[].state string processing is not yet usable; active is ready; expired cannot be read.
data[].source string upload is user-provided, generated is platform-produced, session is a session output.
data[].sha256 string Content digest, prefixed sha256:. Available after processing completes.
first_id string Id of the first file of the page; usable as before to read the preceding page.
last_id string Id of the last file of the page; usable as after to read the next page.
has_more boolean Whether more files exist beyond this page.