Kael API 文档

开发者文档

30 个开发工具 API · RESTful · JSON 响应 · 免费使用

https://www.kael.ink

🔑 认证方式

大多数接口无需认证即可使用(匿名模式:10次/分钟,100次/天)。

注册免费 API Key 获取更高配额(30次/分钟,500次/天):

curl -X POST https://www.kael.ink/api/keys/register \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com", "name": "Your Name"}'

使用时在请求头中添加:

curl -H "x-api-key: kael_YOUR_KEY" https://www.kael.ink/api/uuid

套餐: 匿名(免费)→ Free Key(免费)→ Pro ¥29/月 → Unlimited ¥99/月 · 查看详情

📋 接口目录(26个端点)

🔐 编码 & 加密

GET /api/uuid 生成 UUID v4
参数类型说明
countnumber可选 生成数量(1-100,默认 1)
请求示例
curl "https://www.kael.ink/api/uuid?count=3"
响应
{
  "uuids": [
    "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
    "f6e5d4c3-b2a1-4098-7654-321fedcba987",
    "12345678-abcd-4ef0-9876-543210abcdef"
  ]
}
GET /api/hash 文本哈希
参数类型说明
textstring必填 要哈希的文本
algostring可选 算法:md5, sha1, sha256(默认), sha512
请求示例
curl "https://www.kael.ink/api/hash?text=hello&algo=sha256"
响应
{
  "text": "hello",
  "algorithm": "sha256",
  "hash": "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824"
}
GET /api/encode 编码/解码
参数类型说明
textstring必填 要编码的文本
typestring可选 base64(默认), url, hex, html
decodeboolean可选 true 为解码模式
请求示例
curl "https://www.kael.ink/api/encode?text=你好世界&type=base64"
响应
{
  "original": "你好世界",
  "type": "base64",
  "encoded": "5L2g5aW95LiW55WM"
}
GET /api/jwt/decode JWT 解码(不验签)
参数类型说明
tokenstring必填 JWT token 字符串
请求示例
curl "https://www.kael.ink/api/jwt/decode?token=eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.xxx"
响应
{
  "header": { "alg": "HS256" },
  "payload": { "sub": "1234567890" },
  "signature": "xxx"
}
GET /api/password 密码生成器
参数类型说明
lengthnumber可选 长度(8-128,默认 16)
uppercaseboolean可选 包含大写(默认 true)
lowercaseboolean可选 包含小写(默认 true)
numbersboolean可选 包含数字(默认 true)
symbolsboolean可选 包含特殊字符(默认 true)
countnumber可选 生成数量(1-20,默认 1)
请求示例
curl "https://www.kael.ink/api/password?length=24&count=3"
POST /api/password-strength 密码强度检测
参数类型说明
passwordstring必填 要检测的密码
请求示例
curl -X POST https://www.kael.ink/api/password-strength \
  -H "Content-Type: application/json" \
  -d '{"password": "MyP@ssw0rd!"}'
响应
{
  "score": 4,
  "strength": "very strong",
  "suggestions": [],
  "details": { "length": 11, "hasUpper": true, "hasLower": true, "hasNumber": true, "hasSymbol": true }
}

📊 数据处理

POST /api/json/validate JSON 校验
参数类型说明
jsonstring必填 JSON 字符串
请求示例
curl -X POST https://www.kael.ink/api/json/validate \
  -H "Content-Type: application/json" \
  -d '{"json": "{\"name\": \"test\", \"age\": 25}"}'
响应
{
  "valid": true,
  "type": "object",
  "keys": ["name", "age"],
  "size": 28
}
POST /api/json/format JSON 格式化
参数类型说明
jsonstring必填 JSON 字符串
indentnumber可选 缩进空格数(默认 2)
请求示例
curl -X POST https://www.kael.ink/api/json/format \
  -H "Content-Type: application/json" \
  -d '{"json": "{\"a\":1,\"b\":2}"}'
POST /api/regex 正则测试
参数类型说明
patternstring必填 正则表达式
textstring必填 测试文本
flagsstring可选 标志位(g, i, m 等)
请求示例
curl -X POST https://www.kael.ink/api/regex \
  -H "Content-Type: application/json" \
  -d '{"pattern": "\\d+", "text": "abc123def456", "flags": "g"}'
POST /api/diff 文本对比
参数类型说明
text1string必填 原始文本
text2string必填 对比文本
请求示例
curl -X POST https://www.kael.ink/api/diff \
  -H "Content-Type: application/json" \
  -d '{"text1": "hello world", "text2": "hello kael"}'
GET /api/color 颜色转换
参数类型说明
colorstring必填 颜色值(支持 hex、rgb、hsl)
请求示例
curl "https://www.kael.ink/api/color?color=%23f0b429"
响应
{
  "hex": "#f0b429",
  "rgb": "rgb(240, 180, 41)",
  "hsl": "hsl(42, 87%, 55%)"
}
GET /api/slug URL Slug 生成
参数类型说明
textstring必填 要转换的文本
请求示例
curl "https://www.kael.ink/api/slug?text=Hello%20World%20你好"

🎨 生成工具

GET /api/qr QR 码生成
参数类型说明
textstring必填 要编码的内容
sizenumber可选 尺寸(50-1000,默认 200)
formatstring可选 png(默认)或 svg
请求示例
curl "https://www.kael.ink/api/qr?text=https://www.kael.ink&size=300" -o qr.png
POST /api/md2html Markdown → HTML
参数类型说明
markdownstring必填 Markdown 文本
请求示例
curl -X POST https://www.kael.ink/api/md2html \
  -H "Content-Type: application/json" \
  -d '{"markdown": "# Hello\n\n**bold** and *italic*"}'
POST /api/md2image Markdown → 图片
参数类型说明
markdownstring必填 Markdown 文本
widthnumber可选 图片宽度(默认 800)
themestring可选 light 或 dark(默认 light)
请求示例
curl -X POST https://www.kael.ink/api/md2image \
  -H "Content-Type: application/json" \
  -d '{"markdown": "# Hello World"}' -o output.png
GET /api/lorem 假文生成(中英文)
参数类型说明
paragraphsnumber可选 段落数(默认 1)
langstring可选 en(默认)或 zh
请求示例
curl "https://www.kael.ink/api/lorem?paragraphs=2&lang=zh"
GET /api/placeholder 占位图生成
参数类型说明
wnumber可选 宽度(默认 300)
hnumber可选 高度(默认 200)
bgstring可选 背景色(默认 cccccc)
fgstring可选 文字色(默认 666666)
textstring可选 自定义文字
请求示例
<img src="https://www.kael.ink/api/placeholder?w=400&h=300&bg=f0b429&text=Kael" />
GET /api/random 随机数生成
参数类型说明
minnumber可选 最小值(默认 0)
maxnumber可选 最大值(默认 100)
countnumber可选 数量(默认 1)
请求示例
curl "https://www.kael.ink/api/random?min=1&max=100&count=5"

🌐 网络 & Web

GET /api/ip 获取客户端 IP
请求示例
curl https://www.kael.ink/api/ip
响应
{
  "ip": "1.2.3.4"
}
GET /api/ts 时间戳转换
参数类型说明
tsnumber可选 Unix 时间戳(默认当前)
formatstring可选 输出格式
请求示例
curl https://www.kael.ink/api/ts
GET /api/useragent User-Agent 解析
参数类型说明
uastring可选 UA 字符串(默认使用请求头)
请求示例
curl https://www.kael.ink/api/useragent
POST /api/shorten 短链接生成
参数类型说明
urlstring必填 原始 URL
customstring可选 自定义短码
请求示例
curl -X POST https://www.kael.ink/api/shorten \
  -H "Content-Type: application/json" \
  -d '{"url": "https://github.com/very/long/url"}'
GET /api/screenshot 网页截图 Pro

⚠️ 需要 Pro 或 Unlimited 套餐

参数类型说明
urlstring必填 要截图的网页 URL
widthnumber可选 视口宽度(默认 1280)
heightnumber可选 视口高度(默认 720)
fullPageboolean可选 全页截图
formatstring可选 png(默认)或 jpeg
请求示例
curl -H "x-api-key: kael_YOUR_PRO_KEY" \
  "https://www.kael.ink/api/screenshot?url=https://example.com" -o screenshot.png

🔑 API Key 管理

POST /api/keys/register 注册 API Key
参数类型说明
emailstring必填 邮箱地址
namestring可选 名称
请求示例
curl -X POST https://www.kael.ink/api/keys/register \
  -H "Content-Type: application/json" \
  -d '{"email": "dev@example.com", "name": "My App"}'
响应
{
  "success": true,
  "key": "kael_a1b2c3d4e5",
  "tier": "free",
  "limits": { "rpm": 30, "daily": 500 }
}
GET /api/keys/info 查看 Key 信息与用量
请求示例
curl -H "x-api-key: kael_YOUR_KEY" https://www.kael.ink/api/keys/info
响应
{
  "email": "dev@example.com",
  "tier": "free",
  "limits": { "rpm": 30, "daily": 500 },
  "usage": { "today": 42, "total": 156 },
  "created": "2026-03-02T10:00:00.000Z"
}
GET /api/tiers 查看所有套餐
请求示例
curl https://www.kael.ink/api/tiers

⚠️ 错误码

状态码含义说明
400Bad Request缺少必填参数或参数格式错误
401UnauthorizedAPI Key 无效
403ForbiddenKey 已禁用或套餐权限不足
429Too Many Requests超出速率限制(查看 X-RateLimit-* 头)
500Internal Error服务端异常
错误响应格式
{
  "error": "Missing required parameter: text"
}

⏱️ 速率限制

所有响应包含以下头信息:

Header说明
X-RateLimit-Limit每分钟请求上限
X-RateLimit-Remaining当前窗口剩余次数
X-RateLimit-Reset窗口重置时间(Unix timestamp)
X-RateLimit-Daily-Limit每日请求上限
X-RateLimit-Daily-Remaining今日剩余次数

💰 支付系统 / Payment

通过支付宝/微信支付升级 API Key 套餐。Upgrade your API key tier via Alipay/WeChat Pay.

GET /api/payment/products — 查看可购买的套餐
请求示例
curl https://www.kael.ink/api/payment/products
返回示例
{
  "products": {
    "pro_monthly": { "title": "Kael API Pro 月付", "price": "29.00 CNY", "tier": "pro", "duration_days": 30 },
    "pro_quarterly": { "title": "Kael API Pro 季付", "price": "79.00 CNY", "tier": "pro", "duration_days": 90 },
    "unlimited_monthly": { "title": "Kael API Unlimited 月付", "price": "99.00 CNY", "tier": "unlimited", "duration_days": 30 }
  },
  "payment_methods": ["Alipay (支付宝)", "WeChat Pay (微信支付)"]
}
POST /api/payment/create — 创建支付订单
参数类型必填说明
product_idstring产品ID (pro_monthly, pro_quarterly, pro_yearly, unlimited_monthly, unlimited_quarterly, unlimited_yearly)
api_keystring要升级的 API Key
请求示例
curl -X POST https://www.kael.ink/api/payment/create \
  -H "Content-Type: application/json" \
  -d '{"product_id":"pro_monthly","api_key":"kael_xxx..."}'
返回示例
{
  "success": true,
  "order_id": "KAEL_1709312400_abc12345",
  "product": "Kael API Pro 月付",
  "price": "29.00 CNY",
  "qrcode_url": "https://...",  // PC扫码支付
  "pay_url": "https://...",     // 手机端跳转
  "message": "Scan QR code or open pay_url to complete payment"
}
POST /api/payment/notify — 支付回调(系统内部使用)

由虎皮椒支付平台自动调用,支付成功后自动升级 API Key 套餐。

🪪 ID Card Validator

GET /api/idcard/validate?id={18-digit-id}

Validates Chinese 18-digit ID card numbers. Extracts birthday, gender, region code, age.

Response: { valid, regionCode, birthday, gender, age }

📱 Phone Validator

GET /api/phone/validate?number={phone}

Validates Chinese phone numbers and identifies carrier (Mobile/Unicom/Telecom/Broadnet).

Response: { valid, type, number, country, carrier }

🔐 Chmod Calculator

GET /api/chmod?mode={755|rwxr-xr-x}

Convert between numeric (755) and symbolic (rwxr-xr-x) Unix permissions.

Response: { numeric, symbolic, owner, group, other }

💾 Byte Converter

GET /api/bytes?value={number}&from={B|KB|MB|GB|TB|PB}

Convert between byte units with human-readable output.

Response: { bytes, KB, MB, GB, TB, PB, human }

📅 Date Converter

GET /api/date?value={now|timestamp|ISO}&tz={timezone}

Enhanced date converter: Unix timestamps, timezones, leap year, week/day of year.

Response: { iso, unix, utc, local, dayOfWeek, isLeapYear, ... }

🎨 CSS Minifier

POST /api/css/minify — Body: { "css": "..." }

Minify CSS by removing comments, whitespace, and unnecessary characters.

Response: { original, minified, savings, css }

📊 SQL Formatter

POST /api/sql/format — Body: { "sql": "..." }

Format SQL queries with automatic indentation and keyword alignment.

Response: { formatted }