跳转到主要内容
会话

删除会话

DELETE
/conversations/{conversation_id}
Python
import os
from openai import OpenAI

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

result = client.conversations.delete("conv_xxx")
print(result)
{
  "deleted": true,
  "id": "conv_xxx",
  "object": "conversation.deleted"
}

鉴权

string
header
必填

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

路径参数

string
必填

会话 ID。

conv_xxx

响应

200-application/json
boolean

是否删除成功。

string

已删除的会话 ID。

conv_xxx
enum<string>

固定值 conversation.deleted

conversation.deleted