跳转到内容
EN

取消分片上传

POST/openai/v1/uploads/{upload_id}/cancel◐ 部分支持

OpenAI 官方文档 ↗

请求参数

  • upload_idstring必填

    path: Upload identifier returned by create; belongs to your organization.

返回

200 upload

每片最多 64 MB,总量最多 20 GiB。仅支持 user_data、assistants、vision;未完成上传 7 天后过期。完成后须等文件处理完成才能使用。

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

请求示例

curl
curl -X POST https://api.deepraxis.com/openai/v1/uploads/upload_123/cancel \
  -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",
)

upload = client.uploads.cancel("upload_123")
print(upload.status)
TypeScript
import OpenAI from "openai";

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

const upload = await client.uploads.cancel("upload_123");
console.log(upload.status);

响应示例 200

{
  "id": "upload_oh7BbISfV49xhzfgPNV7UUM1",
  "object": "upload",
  "bytes": 11534336,
  "created_at": 1792685021,
  "expires_at": 1792688621,
  "filename": "document.txt",
  "purpose": "user_data",
  "status": "cancelled",
  "file": null
}

响应

HTTP 200

The upload state and, after completion, the resulting file.

application/json

名称 类型 说明
id string Upload identifier returned by create. Use this value for parts, complete and cancel.
object string Object type; upload identifies an upload session.
bytes integer Declared size of the complete file in bytes.
created_at integer Creation time as Unix seconds.
expires_at integer Expiry time as Unix seconds; unfinished uploads expire after 7 days.
filename string Filename supplied when creating the upload.
purpose string File purpose: user_data for conversation attachments, assistants for assistant files, vision for images.
status string Upload state: pending accepts parts; completed has a file; cancelled was cancelled; expired exceeded its seven-day lifetime.
file object | null Present after complete. A file with status uploaded is still processing; poll files.retrieve until processed before use.
file.id string The file identifier, which can be referenced in the API endpoints.
file.bytes integer The size of the file, in bytes.
file.created_at integer The Unix timestamp (in seconds) for when the file was created.
file.expires_at integer The Unix timestamp (in seconds) for when the file will expire.
file.filename string The name of the file.
file.object string The object type, which is always file.
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.
file.status string Deprecated. The current status of the file, which can be either uploaded, processed, or error.
file.status_details string Deprecated. For details on why a fine-tuning training file failed validation, see the error field on fine_tuning.job.