Conversations
/v1/conversations· 跨端会话同步(chat 站使用)
轻量的会话云同步接口:保存会话标题、消息数组与任意客户端元数据。它不是模型接口, 不产生生成计费;会话内容只对所属用户可见。
对象#
{
"id": "0f3c2f3a-8a0e-4c1e-9f0a-2b7c9d1e4a11",
"user_id": 24,
"title": "关于向量数据库",
"messages": [
{
"role": "user",
"content": "什么是向量数据库?",
"timestamp": "2026-11-19T02:00:00Z",
"id": "msg_local_1",
"reasoning": "",
"sources": []
}
],
"metadata": {"model": "nexith-core"},
"created_at": "2026-11-19T02:00:00Z",
"updated_at": "2026-11-19T02:05:00Z"
}messages[].extra 的客户端附加字段(消息 id、推理、引用、产物…)会原样保存并回传,
服务端不解析。
GET /v1/conversations#
列出当前用户的会话,按 updated_at 倒序,最多 100 条。
{"data": [ /* Conversation */ ], "total": 1}POST /v1/conversations#
{
"title": "新会话",
"messages": [],
"metadata": {"model": "nexith-core"}
}返回创建后的完整对象。
GET /v1/conversations/:id#
返回单个会话;不属于当前用户返回 404 not_found。
PATCH /v1/conversations/:id#
可更新字段(均可选):title、messages、metadata。
{"title": "改名后的标题"}DELETE /v1/conversations/:id#
成功返回 204 No Content;不存在返回 404。
认证与错误#
- 需要认证(JWT 或
nx-Key),按user_id隔离。 - 统一错误格式见 错误与限流。