纯本地换算,支持最多 15 位整数、2 位小数与正负号、零值边界。mode=plain 输出中文小写读法(一亿零壹万),mode=capital 输出人民币大写(壹亿元整),默认 both 一次给全。适用于财务票据与校对场景。
http://rainapi.top/api/cn-num在本站内直接写 /api/cn-num 就能调用;从别处调用请复制上方完整地址。 浏览器网页代码可以直接跨域请求,无需额外配置。响应头包含Access-Control-Allow-Origin: *,浏览器可 fetch。
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| n 例: 12345.67 | string | 必填 | 数字,最多 15 位整数 + 2 位小数,可带负号 |
| mode 例: capital | string | 可选 | plain(中文读法)| capital(大写金额)| both(默认) |
| 字段 | 类型 | 说明 |
|---|---|---|
| number | string | 输入回显 |
| plain / result | string | 中文小写读法(both 时为 plain 字段) |
| capital | string | 人民币大写(both 时为 capital 字段) |
GET /api/cn-num?n=12345.67{
"code": 200,
"number": "12345.67",
"mode": "both",
"plain": "一万二千三百四十五点六七",
"capital": "壹万贰仟叁佰肆拾伍元陆角柒分"
}| HTTP | code | 含义 |
|---|---|---|
| 400 | 400 | 缺少 n 或数字格式非法 |
| 429 | 429 | 超出频率限制 |
Retry-After: 30公开服务面向零散调用与轻量场景。批量任务请自行加入退避(收到 429 后等待 Retry-After 秒再重试), 或先本地缓存已查询过的结果。持续高频使用建议申请独立配额(未来提供)。
curl -s 'http://rainapi.top/api/cn-num?n=12345.67'