跳转到内容
EN

删除文件

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

DELETE/anthropic/v1/files/{file_id}● 支持

Anthropic 官方文档 ↗

请求参数

  • file_idstring必填

    path:

返回

200

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

请求示例

curl
# 先调用「上传文件」,用返回的文件 ID 替换示例文件 ID。
curl -X DELETE https://api.deepraxis.com/anthropic/v1/files/file_123 \
  -H "x-api-key: $PRAXIS_API_KEY" \
  -H "anthropic-version: 2023-06-01"
Python
# 先调用「上传文件」,用返回的文件 ID 替换示例文件 ID。
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.deepraxis.com/anthropic",
    api_key="$PRAXIS_API_KEY",
)

client.files.delete("file_123")
TypeScript
// 先调用「上传文件」,用返回的文件 ID 替换示例文件 ID。
import Anthropic from "@anthropic-ai/sdk";

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

await client.files.delete("file_123");

响应示例 200

{
  "id": "file_dp_01M42FVDJD8QGPRQ0059E7V056",
  "type": "file_deleted"
}

响应

HTTP 200

Deleted

application/json

名称 类型 说明
id string ID of the deleted file.
type string Deleted object type. For file deletion, this is always "file_deleted".