跳转到内容
EN

检索文件

先调用「上传文件」,用返回的文件 ID 替换示例文件 ID。

GET/openai/v1/files/{file_id}● 支持

OpenAI 官方文档 ↗

请求参数

  • file_idstring必填

    path: The ID of the file to use for this request.

返回

200 file

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

请求示例

curl
# 先调用「上传文件」,用返回的文件 ID 替换示例文件 ID。
curl https://api.deepraxis.com/openai/v1/files/file_123 \
  -H "Authorization: Bearer $PRAXIS_API_KEY"
Python
# 先调用「上传文件」,用返回的文件 ID 替换示例文件 ID。
from openai import OpenAI

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

file = client.files.retrieve("file_123")
TypeScript
// 先调用「上传文件」,用返回的文件 ID 替换示例文件 ID。
import OpenAI from "openai";

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

const file = await client.files.retrieve("file_123");

响应示例 200

{
  "id": "file_dp_01M41EAAEQ3N9T5T1D5Y6PYXNB",
  "object": "file",
  "bytes": 70,
  "created_at": 1791049935,
  "filename": "pixel.png",
  "purpose": "user_data",
  "status": "processed",
  "status_details": null
}

响应

HTTP 200

OK

application/json

名称 类型 说明
id string The file identifier, which can be referenced in the API endpoints.
bytes integer The size of the file, in bytes.
created_at integer The Unix timestamp (in seconds) for when the file was created.
expires_at integer The Unix timestamp (in seconds) for when the file will expire.
filename string The name of the file.
object string The object type, which is always file.
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.
status string Deprecated. The current status of the file, which can be either uploaded, processed, or error.
status_details string Deprecated. For details on why a fine-tuning training file failed validation, see the error field on fine_tuning.job.