全部產品
Search
文件中心

Alibaba Cloud Model Studio:刪除響應

更新時間:May 16, 2026

根據 Response ID 刪除一個已儲存的模型響應。

华北2(北京)

SDK 調用配置的base_urlhttps://dashscope.aliyuncs.com/compatible-mode/v1

HTTP 要求地址:DELETE https://dashscope.aliyuncs.com/compatible-mode/v1/responses/{response_id}

路徑參數

response_id string (必選)

要刪除的 Response ID,格式為 resp_xxx。僅當原建立請求中 store=true 時返回的 Response ID 可被刪除。

Python

import os
from openai import OpenAI

client = OpenAI(
    # 若沒有配置環境變數,請用百鍊API Key將下行替換為:api_key="sk-xxx"
    api_key=os.getenv("DASHSCOPE_API_KEY"),
    base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
)

response = client.responses.delete("resp_xxx")
print(response)

Node.js

import OpenAI from "openai";

const openai = new OpenAI({
    // 若沒有配置環境變數,請用百鍊API Key將下行替換為:apiKey: "sk-xxx"
    apiKey: process.env.DASHSCOPE_API_KEY,
    baseURL: "https://dashscope.aliyuncs.com/compatible-mode/v1"
});

async function main() {
    const response = await openai.responses.del("resp_xxx");
    console.log(response);
}

main();

curl

curl -X DELETE https://dashscope.aliyuncs.com/compatible-mode/v1/responses/resp_xxx \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY"

返回結果

{
    "deleted": true,
    "id": "resp_4ca7fa5e-6ff5-9787-bc18-af6ca5eff36c"
}

id string

被刪除的 Response ID。

deleted boolean

是否刪除成功,成功為 true

錯誤響應

當指定的 Response ID 不存在時,返回以下錯誤:

{
    "error": {
        "message": "Response with id 'resp_xxx' not found.",
        "type": "InvalidParameter"
    }
}