删除会话
DELETE
/anthropic/v1/sessions/{session_id}● 支持请求参数
session_idstring必填path: 会话 ID(路径或查询参数)。
返回
501
删除空闲或已终止的会话及其事件历史(先保存删除快照),响应与官方一致:200 与 {id, type:"session_deleted"}。运行中的会话返回 409 INVALID_STATE,请先 interrupt 或等待结束;删除后读取与事件列表返回 404,列表不再包含该会话;对已删除或不存在的会话再次删除返回 404。
错误按 Claude Managed Agents 格式返回,参见 错误码
请求示例
curl
curl -X DELETE https://api.deepraxis.com/anthropic/v1/sessions/sample_id_123 \
-H "x-api-key: $PRAXIS_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "anthropic-beta: managed-agents-2026-04-01"Python
from anthropic import Anthropic
client = Anthropic(
base_url="https://api.deepraxis.com/anthropic",
api_key="$PRAXIS_API_KEY",
)
# 官方有、平台未支持:调用得到 501(not_implemented_error),无副作用。
result = client.beta.sessions.delete("sample_id_123")
print(result)TypeScript
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://api.deepraxis.com/anthropic",
apiKey: "$PRAXIS_API_KEY",
});
// 官方有、平台未支持:调用得到 501(not_implemented_error),无副作用。
const result = await client.beta.sessions.delete("sample_id_123");
console.log(result);响应示例 501
{
"type": "error",
"error": {
"type": "not_implemented_error",
"message": "Not implemented: this Managed Agents operation is not implemented on this platform yet (DELETE /v1/sessions/{session_id}); see the docs for the supported subset."
},
"request_id": "47063ee6-ba7d-4481-a9ae-a2e93d04e2a7"
}响应
HTTP 200
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | |
| type | string |