首页 开发文档 身高预测

身高预测

子女成年身高预测。提供 CMH(儿童身高中位数法,男孩 +13、女孩 -13)与 FPH(父母身高中值法)两套常用公式,并给出 ±5 cm 的正常波动区间。遗传因素通常只决定身高的 60%-80%,营养、睡眠、运动与内分泌等后天因素影响同样显著,结果仅供科普参考。

请求信息
请求地址 https://cx4.cn/openApi/life/height 复制
请求方式 GET / POST
接口标识 life_height
鉴权方式 必须
四种方式任选其一:Header「X-Api-Key」/ Header「Authorization: Bearer 你的key」/ URL 参数「?key=你的key」/ POST 参数「key」
请求参数
参数名 类型 必填 说明 示例
father_height float 是 父亲身高 cm,100-250 175
mother_height float 是 母亲身高 cm,100-250 162
gender string 是 子女性别:male / female,也接受 m / f / 男 / 女 male
method string 否 cmh 儿童身高中位数法 / fph 父母身高中值法 / both 两种都算 cmh
current_height float 否 子女当前身高 cm,传入后可结合年龄做校正 120
current_age int 否 子女当前年龄,与 current_height 配合使用 8
返回参数

下表字段位于返回结构的 data 内;外层 code / message 为全平台统一格式,不在此重复列出。

参数名 类型 说明 示例
ok bool 是否成功 true
gender string 子女性别 male
father_height float 父亲身高 175
mother_height float 母亲身高 162
cmh_height float CMH 法预测值 cm 175
cmh_range array CMH 法波动区间 cm [170,180]
predicted float 最终预测身高 cm 175
note string 说明 遗传约占身高决定因素的 60%-80%
返回示例

成功

{
    "code": 200,
    "message": "操作成功",
    "data": {
        "ok": true,
        "gender": "male",
        "father_height": 175,
        "mother_height": 162,
        "cmh_height": 175,
        "cmh_range": [
            170,
            180
        ],
        "predicted": 175,
        "note": "遗传靶身高仅为统计学估算,实际身高受营养、睡眠、运动与疾病影响,波动范围约 ±5 cm"
    }
}

失败

{
    "code": 400,
    "message": "父母身高都必须大于 0",
    "data": null
}
平台通用状态码
状态码 说明
200调用成功
400缺少必填参数或参数格式有误
401密钥缺失或无效
402余额不足,请充值后重试
403未开通该接口,请在本页开通后调用
404接口不存在或已下架
429触发限流,请稍后重试
500接口调用失败(已扣款的会自动退款)
调用示例

cURL 复制

curl -X POST "https://cx4.cn/openApi/life/height" -H "X-Api-Key: 你的SecretKey" -d "father_height=175&mother_height=162&gender=male&method=cmh¤t_height=120¤t_age=8"

JavaScript 复制

fetch('https://cx4.cn/openApi/life/height', {
  method: 'POST',
  headers: {
    'X-Api-Key': '你的SecretKey',
    'Content-Type': 'application/x-www-form-urlencoded'
  },
  body: 'father_height=175&mother_height=162&gender=male&method=cmh¤t_height=120¤t_age=8'
})
.then(res => res.json())
.then(data => console.log(data));

PHP 复制

post('https://cx4.cn/openApi/life/height', [
    'headers' => ['X-Api-Key' => '你的SecretKey'],
    'form_params' => ['father_height' => '175', 'mother_height' => '162', 'gender' => 'male', 'method' => 'cmh', 'current_height' => '120', 'current_age' => '8'],
]);
echo $response->getBody();

Java 复制

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://cx4.cn/openApi/life/height"))
    .header("X-Api-Key", "你的SecretKey")
    .header("Content-Type", "application/x-www-form-urlencoded")
    .POST(HttpRequest.BodyPublishers.ofString("father_height=175&mother_height=162&gender=male&method=cmh¤t_height=120¤t_age=8"))
    .build();
HttpResponse response = client.send(
        request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());

Python 复制

import requests

res = requests.post('https://cx4.cn/openApi/life/height',
    headers={'X-Api-Key': '你的SecretKey'},
    data={'father_height': '175', 'mother_height': '162', 'gender': 'male', 'method': 'cmh', 'current_height': '120', 'current_age': '8'})
print(res.json())
在线测试 (使用你的密钥真实调用,计费与正常调用一致)

登录后可在线测试: 立即登录

计费说明

¥0.0010

每次调用


每日免费额度:100 次

累计调用:6 次


快速上手

1. 注册并完成邮箱验证:立即注册

2. 登录后复制 Secret Key:去登录

3. 点击右侧「开通接口」按钮

4. 用下方「在线测试」一键体验,或复制下方示例代码直接调用