跳转到主要内容
文件

删除文件

DELETE
/files/{file_id}
Python
import os
from openai import OpenAI

client = OpenAI(
  api_key=os.getenv("DASHSCOPE_API_KEY"),
  base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
)

result = client.files.delete(
  "file-batch-xxx"
)
print(result.model_dump_json())
{
  "object": "file",
  "deleted": true,
  "id": "file-batch-xxx"
}

鉴权

string
header
必填

千问云 API Key。详见获取 API Key

路径参数

string
必填

待删除文件的 ID。

file-batch-xxx

响应

200-application/json
enum<string>

固定值 file

file
boolean

文件是否已成功删除。

string

已删除文件的 ID。

file-batch-xxx