{"openapi":"3.1.0","info":{"title":"claudebaby 数据面 API","version":"1.0.0","description":"统一 REST 入口。MCP 与 REST 是同一份工具的两个门面：同一个平台进程、同一批工具、同一个 envelope。"},"servers":[{"url":"https://claudebaby.cn"}],"security":[{"ApiKeyAuth":[]}],"tags":[{"name":"data","description":"取数（按平台路由）"},{"name":"meta","description":"公开元数据，无需鉴权"}],"paths":{"/v1/{domain}/{platform}/{endpoint}":{"parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string","enum":["ecommerce","keyword","serp","social"]}},{"name":"platform","in":"path","required":true,"schema":{"type":"string","enum":["1688","amazon","bilibili","douyin","gongzhonghao","instagram","kuaishou","lemon8","linkedin","reddit","shopee","temu","threads","tiktok","tiktokshop","toutiao","walmart","weibo","x","xiaohongshu","xigua","youtube","zhihu"]}},{"name":"endpoint","in":"path","required":true,"schema":{"type":"string"}}],"get":{"tags":["data"],"summary":"取数（GET）","responses":{"200":{"description":"取数结果（envelope 与 MCP structuredContent 一致）"},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"`insufficient_balance`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`job_not_ready`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"`upstream_unavailable` / `capacity_exceeded`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"`upstream_timeout`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"tags":["data"],"summary":"取数（POST，复杂查询体）","responses":{"200":{"description":"取数结果（envelope 与 MCP structuredContent 一致）"},"400":{"description":"`invalid_request`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"`unauthorized`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"`insufficient_balance`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"`not_found`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"`job_not_ready`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"`rate_limited`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"`upstream_unavailable` / `capacity_exceeded`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"504":{"description":"`upstream_timeout`","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/meta/platforms":{"get":{"tags":["meta"],"summary":"平台清单","security":[],"responses":{"200":{"description":"平台与域的对应关系"}}}},"/.well-known/mcp.json":{"get":{"tags":["meta"],"summary":"MCP 端点清单（平台级）","security":[],"responses":{"200":{"description":"MCP 挂载点与平台清单"}}}},"/pricing.json":{"get":{"tags":["meta"],"summary":"机器可解析价目表","security":[],"responses":{"200":{"description":"套餐 / 充值包 / 积分系数 / 每平台单价"}}}}},"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"`Bearer <API Key>`；也接受 `X-API-Key: <API Key>`。"}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message","retryable"],"properties":{"code":{"type":"string","enum":["invalid_request","unauthorized","insufficient_balance","not_found","rate_limited","job_not_ready","upstream_unavailable","upstream_timeout","capacity_exceeded","internal_error"],"description":"稳定错误码；Agent 按它决定重试 / 降级。"},"message":{"type":"string"},"retryable":{"type":"boolean"},"details":{"type":"object"}}}}}}},"x-error-codes":[{"code":"invalid_request","http_status":400,"retryable":false,"message":"The request parameters are invalid."},{"code":"unauthorized","http_status":401,"retryable":false,"message":"Missing or invalid API key."},{"code":"insufficient_balance","http_status":402,"retryable":false,"message":"Account balance is insufficient for this request."},{"code":"not_found","http_status":404,"retryable":false,"message":"The requested resource does not exist."},{"code":"rate_limited","http_status":429,"retryable":true,"message":"Rate limit exceeded for this plan, please retry later."},{"code":"job_not_ready","http_status":409,"retryable":true,"message":"The job is still running."},{"code":"upstream_unavailable","http_status":503,"retryable":true,"message":"The data source is temporarily unavailable."},{"code":"upstream_timeout","http_status":504,"retryable":true,"message":"The data source did not respond in time."},{"code":"capacity_exceeded","http_status":503,"retryable":false,"message":"Service capacity is saturated, please retry later."},{"code":"internal_error","http_status":500,"retryable":true,"message":"An internal error occurred."}],"x-credit":{"price_per_credit_yuan":0.02,"credits_per_yuan":50,"min_charge_credits":1,"formula":"charges = max(1, credit_factor * quantity)","pricing_url":"https://claudebaby.cn/pricing.json"},"x-request-id":"每个响应都带 X-Request-Id，报障时提供它即可定位整条链路。"}