BangAI API 文档

契约 v1.1(v1.0 向后兼容)· 基路径 /v1 · 鉴权 Authorization: Bearer <API_KEY>(未配置 Key 时鉴权禁用)

端点总览

方法路径说明
GET/v1/health服务健康(开放)
POST/v1/chat/completions轻量直通(primary_reasoner)
POST/v1/reason深推理全 D1(60-120s)
POST/v1/scenes场景注册(v1.1)
GET/v1/scenes场景列表(v1.1)
DELETE/v1/scenes/{id}注销场景(v1.1)
POST/v1/auth/login登录(ops 用户体系,P1)
POST/v1/proxy/chat对话(前端代理,无 Key)
POST/v1/proxy/reason深推理(前端代理)
POST/v1/proxy/reason/stream深推理 SSE 流(processing→result→done)

POST /v1/reason(深推理)

curl -X POST https://www.bbangai.cn/v1/reason \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $BANGAI_API_KEY" \
  -d '{"scene_id":"general","task_type":"general","input":"1+1等于几?"}'
# 响应:final_answer + claims(trust_label) + audit_hash + metering

POST /v1/chat/completions(OpenAI 兼容)

curl -X POST https://www.bbangai.cn/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $BANGAI_API_KEY" \
  -d '{"messages":[{"role":"user","content":"你好"}]}'

错误码(统一格式 {"error":{"code","message"}})

HTTPcode说明
400validation_error / http_error请求非法
401unauthorized缺/错 Key
402quota_exceeded配额不足(计量)
404not_found资源不存在
409scene_already_exists场景重复注册
429rate_limited限流
500internal_error服务内部错误

可信标注(claims.trust_label)

标签语义(分级提示,非统计概率)
RELIABLE有证据支持或评审一致
PLAUSIBLE逻辑自洽但缺外部证据
UNVERIFIED无证据可验证
CONTRADICTED与证据矛盾
SYCOPHANTIC立场漂移/谄媚风险