{"openapi":"3.1.0","info":{"title":"AIPanda OpenAPI","version":"1.0.0","description":"AIPanda OpenAPI v1 开放八字和六爻能力。接入流程：\n1. 由平台运营人员创建 App、授权能力并生成 API Key；\n2. 调用八字或六爻接口创建由程序确定性计算的 Subject；\n3. 使用 Subject ID 创建首次 AI Response；\n4. 使用 previous_response_id 围绕同一 Subject 连续追问；\n5. 查询结果并提交反馈。\n\n排盘事实由本地算法计算，AI 只解释已确认事实，不负责重新排盘。完整接入示例请访问 /docs。"},"servers":[{"url":"https://api.qbb.me","description":"Production"},{"url":"/","description":"Current environment"}],"security":[{"bearerAuth":[]}],"tags":[{"name":"BaZi","description":"创建和查询由程序确定性计算的八字命盘 Subject。"},{"name":"LiuYao","description":"围绕一个明确问题创建和查询由程序计算的六爻卦盘 Subject。"},{"name":"Responses","description":"对 Subject 进行首次 AI 解读，或通过 previous_response_id 连续追问。"},{"name":"Feedback","description":"回传第三方用户对 AI Response 的评价和纠正信息。"}],"paths":{"/v1/bazi/charts":{"post":{"tags":["BaZi"],"summary":"Create a deterministic BaZi chart","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBaziChart"}}}},"responses":{"201":{"description":"Chart created"},"400":{"$ref":"#/components/responses/Error"}}}},"/v1/bazi/charts/{chart_id}":{"get":{"tags":["BaZi"],"summary":"Get a BaZi chart","parameters":[{"$ref":"#/components/parameters/ChartId"}],"responses":{"200":{"description":"Chart"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["BaZi"],"summary":"Delete a BaZi chart","parameters":[{"$ref":"#/components/parameters/ChartId"}],"responses":{"204":{"description":"Deleted"},"404":{"$ref":"#/components/responses/Error"}}}},"/v1/liuyao/casts":{"post":{"tags":["LiuYao"],"summary":"Create a deterministic LiuYao cast","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateLiuyaoCast"}}}},"responses":{"201":{"description":"Cast created"},"400":{"$ref":"#/components/responses/Error"}}}},"/v1/liuyao/casts/{cast_id}":{"get":{"tags":["LiuYao"],"summary":"Get a LiuYao cast","parameters":[{"$ref":"#/components/parameters/CastId"}],"responses":{"200":{"description":"Cast"},"404":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["LiuYao"],"summary":"Delete a LiuYao cast and its Responses","parameters":[{"$ref":"#/components/parameters/CastId"}],"responses":{"204":{"description":"Deleted"},"404":{"$ref":"#/components/responses/Error"}}}},"/v1/responses":{"post":{"tags":["Responses"],"summary":"Create an interpretation or follow-up","description":"For the first response send capability and subject_id. For a follow-up send previous_response_id.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateResponse"}}}},"responses":{"201":{"description":"Response created"},"409":{"$ref":"#/components/responses/Error"}}}},"/v1/responses/{response_id}":{"get":{"tags":["Responses"],"summary":"Get a response","parameters":[{"$ref":"#/components/parameters/ResponseId"}],"responses":{"200":{"description":"Response"},"404":{"$ref":"#/components/responses/Error"}}}},"/v1/feedback":{"post":{"tags":["Feedback"],"summary":"Submit response feedback","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFeedback"}}}},"responses":{"201":{"description":"Feedback recorded"},"404":{"$ref":"#/components/responses/Error"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"ap_test_ or ap_live_ API key"}},"parameters":{"IdempotencyKey":{"name":"Idempotency-Key","in":"header","required":true,"description":"一次业务写入使用一个稳定且唯一的值。网络重试必须复用相同 Key 和相同请求体。","schema":{"type":"string","maxLength":255},"example":"order-20260813-0001"},"ChartId":{"name":"chart_id","in":"path","required":true,"schema":{"type":"string","pattern":"^bzc_"}},"CastId":{"name":"cast_id","in":"path","required":true,"schema":{"type":"string","pattern":"^lyc_"}},"ResponseId":{"name":"response_id","in":"path","required":true,"schema":{"type":"string","pattern":"^resp_"}}},"schemas":{"CreateBaziChart":{"type":"object","required":["birth"],"additionalProperties":false,"properties":{"birth":{"type":"object","required":["year","month","day","hour","gender"],"additionalProperties":false,"properties":{"year":{"type":"integer","minimum":1900,"maximum":2100},"month":{"type":"integer","minimum":1,"maximum":12},"day":{"type":"integer","minimum":1,"maximum":31,"description":"必须是对应公历或农历月份中真实存在的日期。"},"hour":{"type":"integer","minimum":0,"maximum":23},"minute":{"type":"integer","minimum":0,"maximum":59,"default":0},"gender":{"enum":["男","女"]},"calendar_type":{"enum":["solar","lunar"],"default":"solar"},"is_leap_month":{"type":"boolean","default":false},"birthplace":{"type":"string","maxLength":120},"time_confidence":{"enum":["exact","approximate"],"default":"exact"}}},"end_user_id":{"type":"string","maxLength":128},"metadata":{"type":"object","additionalProperties":{"type":"string"}}}},"CreateLiuyaoCast":{"type":"object","required":["question","method"],"additionalProperties":false,"properties":{"question":{"type":"string","maxLength":1000},"method":{"enum":["dayan","manual_lines"]},"lines":{"type":"array","minItems":6,"maxItems":6,"items":{"type":"integer","enum":[6,7,8,9]}},"cast_at":{"type":"string","format":"date-time"},"end_user_id":{"type":"string","maxLength":128},"metadata":{"type":"object","additionalProperties":{"type":"string"}}}},"CreateResponse":{"oneOf":[{"type":"object","required":["capability","subject_id","input"],"additionalProperties":false,"properties":{"capability":{"enum":["bazi","liuyao"]},"subject_id":{"type":"string"},"input":{"type":"string","maxLength":1000},"end_user_id":{"type":"string","maxLength":128}}},{"type":"object","required":["previous_response_id","input"],"additionalProperties":false,"properties":{"previous_response_id":{"type":"string"},"input":{"type":"string","maxLength":1000},"end_user_id":{"type":"string","maxLength":128}}}]},"CreateFeedback":{"type":"object","required":["response_id","rating"],"additionalProperties":false,"properties":{"response_id":{"type":"string"},"rating":{"enum":["positive","negative"]},"tags":{"type":"array","maxItems":10,"items":{"type":"string"}},"comment":{"type":"string","maxLength":2000},"correction":{"type":"string","maxLength":4000}}},"Error":{"type":"object","properties":{"error":{"type":"object","required":["code","message","request_id"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"request_id":{"type":"string"},"retryable":{"type":"boolean"},"retry_after_ms":{"type":"integer"}}}}}},"responses":{"Error":{"description":"AIPanda API error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}