跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.mirobody.ai/llms.txt

Use this file to discover all available pages before exploring further.

接入 Base URL

集群Base URL状态
🇨🇳 中国https://mcp.thetahealth.cn✅ 已上线
🌐 海外暂未对外开放🚧 API 筹备中(前端 mirobody.thetahealth.ai 已上线)

鉴权

所有受保护接口都需要 HTTP header:
Authorization: Bearer <access_token>
WebSocket 因浏览器无法设置 Header,统一改用 query:
?token=<access_token>
详见 鉴权 部分 AI 接口还需要 BYOK header
X-LLM-Provider: dashscope | volcengine | openai | gemini
X-LLM-Api-Key:  <您的 LLM 厂商 key>
详见 BYOK 协议

标准响应壳

{ "success": true|false, "code": 0|<负数>, "msg": "ok|<error>", "data": <object|array|null> }
  • code == 0 表示成功;非 0 时 msg 即错误描述。
  • HTTP 状态码:业务错误一般仍是 200;鉴权失败统一返回 401

路径风格

前缀内容响应壳
/api/*核心对话、会话、用户配置、家庭共享{success, code, msg, data}
/api/v1/holywell/*健康业务(journal / health-indicator / file-upload){code, msg, data}(多数无 success
/api/v1/data/*/api/v1/food/*数据视图与营养分析{code, msg, data}
/files/*公共文件上传管线{code, msg, data}
/oauth/*/email/*鉴权OAuth 端点用 OAuth 2.0 标准格式

SSE 协议

流式接口(/api/chat/api/v1/food/analyze 等)返回 Content-Type: text/event-stream
  • 每条事件结构:data: <json>\n\n
  • 流以 data: {"type":"end","content":""}\n\n 结束
  • reply 是增量片段,前端需拼接
  • 禁用代理缓冲:X-Accel-Buffering: noCache-Control: no-cache, no-transform
事件类型对照:
type时机content
id流首条本轮提问的 message id
queryTitle工具调用 / 阶段标题工具名或阶段描述
queryDetail工具调用结果字符串(一般是 JSON 化的工具返回)
reply模型答复增量文本片段
thinking内部思考文本片段
costStatistics临近结束{ model, input_tokens, output_tokens, total_tokens, total_cost }
error异常错误描述
end流结束

国际化

按优先级判定语言:
  1. body 中的 language
  2. Header X-Language
  3. Header Accept-Language
  4. 用户 profile 字段
  5. 兜底 en
时区同理(body timezone → 用户 profile → 默认)。

限流

  • 每用户 × 每路径 × 每分钟 计数。
  • 超限返回 HTTP 429 + Retry-After(秒)。
  • 客户端应严格遵守 Retry-After,并做指数退避。
详细推荐 RPM 见 限流

异步轮询节奏

当前不提供 Webhook 推送;所有异步状态需轮询:
  • 上传 / 解析进度:WebSocket 通道
  • 日记 AI 状态:轮询 /journal/list,看 ai_status1
  • 推荐间隔:2~5 秒,最多 60 秒,超过仍未完成视为后台失败。
  • 不建议 < 1s 高频探活,会触发限流。

错误码速查

HTTP业务 code含义
2000成功
200非 0业务错误,msg 详述
400-参数 / 文件格式非法
401-token 无效或缺失
403-无该用户的访问权限(query_user_id 未授权)
429-限流
500-服务器内部错误 / LLM 上游超时