API 文档
aiping-server 对外提供的只读指标数据接口。所有端点均为 GET,无需鉴权,任何客户端可直接调用。
8 个端点
只读 · 无鉴权
CORS 全开
UTF-8 JSON
快速上手
curl 是最快的验证方式,每个端点单独使用时也都附有 curl 示例。
curl — 一行命令拿数据
最新测速排行
curl https://aiping.icu/api/bench
某供应商近 7 天测速历史(时间范围 + 限数)
curl "https://aiping.icu/api/bench/history?provider=deepseek&start_ts=$(($(date +%s) - 604800))&limit=50"
用 jq 只看前 3 个最快的模型
curl -s https://aiping.icu/api/bench | jq -r '.[] | select(.status == "ok") | "\(.name) \(.model): \(.total_ms)ms"' | head -3
JavaScript / Fetch(浏览器)
获取最新测速排行
const res = await fetch("https://aiping.icu/api/bench");
const data = await res.json(); // 按 total_ms 升序的数组
const top = data.filter(b => b.status === "ok").slice(0, 5);
console.log(top.map(b => `${b.name} ${b.model}: ${b.total_ms}ms`));
获取某模型近 7 天测速趋势
const since = Math.floor(Date.now() / 1000) - 7 * 86400;
const res = await fetch(
`https://aiping.icu/api/bench/history?provider=deepseek&start_ts=${since}&limit=50`
);
const data = await res.json();
const trend = data.series["deepseek-v4-flash"]; // [{ts, first_ms, total_ms}, ...]
Python(requests)
计算某供应商在线率
import requests
r = requests.get("https://aiping.icu/api/history").json()
deepseek = r["deepseek"]
print(f"uptime: {deepseek['uptime']}%")
print(f"samples: {len(deepseek['samples'])}")
通用约定
所有接口遵循以下统一规则。
响应格式
- 默认
Content-Type: application/json,UTF-8 编码 - 状态码:成功 200,资源缺失 404
- 错误时返回对应 JSON,结构见各端点
时间表示
- 所有
ts/updated_at均为 Unix 秒(自 1970-01-01 00:00:00 UTC) - 唯一例外:
/api/status的updated_at为可读字符串
元信息
- 多数响应顶层含
api_version与updated_at - 根级为数组/对象的接口不强行包装,保持结构简单
跨域
- CORS 全开(任意来源、任意方法、任意请求头)
- 可从浏览器、脚本、curl 任意直接调用
- 压缩:响应支持 gzip(tower-http CompressionLayer)
1. 健康检查
GET
/api/health
服务存活状态与 API 版本
用于探测服务是否存活、确认当前 API 版本。无参数。
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
| status | string | 固定为 "ok" |
| api_version | string | 当前 API 版本,如 "v1" |
| updated_at | integer | 服务器生成响应时的 Unix 时间戳 |
请求
curl https://aiping.icu/api/health
响应示例(200)
{
"status": "ok",
"api_version": "v1",
"updated_at": 1785898096
}
2. 供应商在线状态
GET
/api/status
各 AI 服务供应商实时在线状态与延迟
返回所有已配置供应商的探测结果(在线状态、平均延迟、可用模型列表)。无参数。
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
| id | string | 供应商唯一标识 |
| name | string | 供应商显示名称 |
| region | string | 地区分类:中国 / 海外 |
| category | string | 类别:模型商 / 中转站 / 云厂商 |
| api_url | string | 供应商 API 基础地址 |
| status | string | online / offline / restricted 等 |
| latency | integer | 最近探测延迟(毫秒),探测失败为 null |
| models | array | 该供应商当前可用模型列表 |
| updated_at | string | 最近探测时间(可读格式) |
| ts | integer | 最近探测时间(Unix 秒) |
| error | string | 探测失败原因,正常为 null |
请求
curl https://aiping.icu/api/status
响应示例(200,节选)
[
{
"id": "deepseek",
"name": "DeepSeek",
"region": "中国",
"category": "模型商",
"api_url": "https://api.deepseek.com",
"status": "online",
"latency": 167,
"models": ["deepseek-v4-flash", "deepseek-v4-pro"],
"updated_at": "2026-08-05 02:50:09 UTC",
"ts": 1785898209,
"error": null
},
{
"id": "aliyun",
"name": "阿里云",
"region": "中国",
"category": "云厂商",
"api_url": "https://llm-tu1omivmachygx3m.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",
"status": "online",
"latency": 429,
"models": ["glm-5.2", "deepseek-v4-flash", "qwen-flash"],
"updated_at": "2026-08-05 02:50:09 UTC",
"ts": 1785898209,
"error": null
}
]
3. 供应商在线历史
GET
/api/history
各供应商在线率与全部探测采样点
返回每个供应商的在线率(uptime)与历史探测采样点,可用于画状态折线图。无参数。根级为以供应商 id 为 key 的对象。
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
| [id].uptime | number | 在线率百分比(0–100) |
| [id].samples | array | 探测采样点数组,按时间倒序(最新在前) |
| samples[].status | string | 该采样时刻状态:online / offline |
| samples[].latency | integer | 该采样时刻延迟(毫秒) |
| samples[].ts | integer | 采样时间(Unix 秒) |
请求
curl https://aiping.icu/api/history
响应示例(200,节选)
{
"deepseek": {
"uptime": 100.0,
"samples": [
{ "status": "online", "latency": 320, "ts": 1785898209 },
{ "status": "online", "latency": 550, "ts": 1785898149 },
{ "status": "offline", "latency": 0, "ts": 1785898089 }
]
},
"volces": {
"uptime": 99.2,
"samples": [
{ "status": "online", "latency": 446, "ts": 1785898217 }
]
}
}
4. 模型最新测速
GET
/api/bench
所有模型最近一次真实测速结果(延迟排行)
返回每个模型最近一次「真实请求→完整回复」测速结果,按总耗时升序(最快在前)。无参数。
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
| provider_id | string | 供应商标识 |
| name | string | 供应商名称 |
| region | string | 地区分类 |
| model | string | 模型标识 |
| status | string | ok 测速成功 / no_key 未配置 Key / error 测速失败 |
| first_ms | integer | 首字节延迟:请求发出→收到响应头(毫秒) |
| total_ms | integer | 总耗时:请求发出→模型完整回复(毫秒) |
| prompt_tokens | integer | 输入 token 数(当前为 null) |
| completion_tokens | integer | 输出 token 数(当前为 null) |
| error | string | 失败时的友好错误文案,正常为 null |
| ts | integer | 测速完成时间(Unix 秒) |
请求
curl https://aiping.icu/api/bench
响应示例(200,节选)
[
{
"provider_id": "aliyun",
"name": "阿里云",
"region": "中国",
"model": "qwen-flash",
"status": "ok",
"first_ms": 147,
"total_ms": 523,
"prompt_tokens": null,
"completion_tokens": null,
"error": null,
"ts": 1785897426
},
{
"provider_id": "deepseek",
"name": "DeepSeek",
"region": "中国",
"model": "deepseek-v4-flash",
"status": "ok",
"first_ms": 164,
"total_ms": 1234,
"prompt_tokens": null,
"completion_tokens": null,
"error": null,
"ts": 1785898003
},
{
"provider_id": "siliconflow",
"name": "硅基流动",
"region": "中国",
"model": "zai-org/GLM-4.5-Air",
"status": "no_key",
"first_ms": null,
"total_ms": null,
"prompt_tokens": null,
"completion_tokens": null,
"error": "未配置 API Key",
"ts": 0
}
]
5. 测速历史序列
GET
/api/bench/history
模型测速历史,支持时间范围与数量控制
返回一段时间内各模型的测速历史序列,按 provider::model(或仅 model,当指定 provider)分组。支持灵活的时间范围与数据点数限制。
查询参数
| 参数 | 类型 | 说明 |
|---|---|---|
| provider 可选 | string | 按供应商 id 过滤,此时 series 的 key 为纯模型名 |
| hours 可选 | integer | 返回最近 N 小时。默认 24;0 返回全部历史。当同时给出 start_ts/end_ts 时此参数被忽略 |
| start_ts 可选 | integer | 起始时间(Unix 秒,含),例如 1700000000 |
| end_ts 可选 | integer | 结束时间(Unix 秒,含),例如 1700086400 |
| limit 可选 | integer | 每个 series 最多返回的数据点数。0 或不传表示不限制 |
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
| series | object | key 为 provider::model(指定 provider 时为 model),value 为测速点数组 |
| series[key][].ts | integer | 测速时间(Unix 秒) |
| series[key][].first_ms | integer | 首字节延迟(毫秒) |
| series[key][].total_ms | integer | 总耗时(毫秒) |
| api_version | string | API 版本 |
| updated_at | integer | 响应生成时间(Unix 秒) |
请求(全部模型 · 最近 24h)
curl "https://aiping.icu/api/bench/history"
请求(指定供应商 + 时间范围 + 限制点数)
curl "https://aiping.icu/api/bench/history?provider=deepseek&start_ts=1700000000&end_ts=1700086400&limit=5"
响应示例(200)
{
"series": {
"deepseek-v4-pro": [
{ "ts": 1700000321, "first_ms": 147, "total_ms": 2651 },
{ "ts": 1700001284, "first_ms": 138, "total_ms": 3032 },
{ "ts": 1700002461, "first_ms": 176, "total_ms": 2862 }
],
"deepseek-v4-flash": [
{ "ts": 1700000226, "first_ms": 717, "total_ms": 1650 },
{ "ts": 1700001168, "first_ms": 523, "total_ms": 1487 },
{ "ts": 1700002337, "first_ms": 146, "total_ms": 1623 }
]
},
"api_version": "v1",
"updated_at": 1700087000
}
6. 市场用量数据
GET
/api/market
OpenCode 市场用量排行、地理分布与模型 Leaderboard
聚合返回 OpenCode 市场数据:每日用量趋势、模型作者排行、地理分布(Geo Breakdown)、模型 Leaderboard(含累计榜)。无参数。
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
| days | array | 每日用量序列:{date, total, authors[]},date 形如 "AUG 2" |
| days[].authors | array | {author, share, tokens} — 作者 / 份额% / token 数(单位:百万) |
| ranking | array | 最新一天用量排行(按 tokens 降序),结构同 authors |
| geo_date | string | 地理分布快照日期 |
| geo | array | 最新地理分布:{country, continent, rank, share, tokens} |
| geo_history | array | 全部日期的地理快照:{date, geo[]} |
| leader_date | string | Leaderboard 快照日期 |
| leader | array | 最新 Leaderboard:{rank, model, tokens, delta} |
| leader_history | array | 全部日期的 Leaderboard 快照:{date, models[]} |
| leader_cum | array | 累计总榜(36 个模型),无逐日历史的模型用此补充 |
| api_version | string | API 版本 |
| updated_at | integer | 响应生成时间(Unix 秒) |
请求
curl https://aiping.icu/api/market
响应示例(200,节选)
{
"api_version": "v1",
"updated_at": 1785898222,
"days": [
{
"date": "MAY 5",
"total": 1.031191,
"authors": [
{ "author": "DeepSeek", "share": 59.6, "tokens": 0.614912 },
{ "author": "Moonshot", "share": 24.1, "tokens": 0.248618 },
{ "author": "Qwen", "share": 5.6, "tokens": 0.057744 }
]
}
],
"ranking": [
{ "author": "DeepSeek", "share": 89.2, "tokens": 4.09307 },
{ "author": "Xiaomi", "share": 3.7, "tokens": 0.170385 }
],
"geo_date": "AUG 2",
"geo": [
{ "continent": "AS", "country": "CN", "rank": 1, "share": 26.2, "tokens": 0.8972 },
{ "continent": "NA", "country": "US", "rank": 2, "share": 13.1, "tokens": 0.4481 }
],
"geo_history": [
{ "date": "MAY 5", "geo": [ { "continent": "AS", "country": "CN", "rank": 1, "share": 26.2, "tokens": 0.8972 } ] }
],
"leader_date": "AUG 2",
"leader": [
{ "rank": 1, "model": "deepseek-v4-flash", "tokens": 0.238902, "delta": "-94.6%" },
{ "rank": 2, "model": "deepseek-v4-pro", "tokens": 0.028335, "delta": "-94.5%" }
],
"leader_history": [
{ "date": "AUG 2", "models": [ { "rank": 1, "model": "deepseek-v4-flash", "tokens": 0.238902, "delta": "-94.6%" } ] }
],
"leader_cum": []
}
7. SuperCLUE 模型榜单
GET
/api/superclue
SuperCLUE 模型能力评测榜单(静态快照)
返回 SuperCLUE 多维度模型能力评测快照(由服务器本地 JSON 提供,定期更新)。无参数。
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
| models | array | 模型评测数组(结构见下) |
| note | string | 榜单说明文字 |
| source | string | 数据来源 |
| updated | string | 快照更新时间 |
models[] 各维度字段:model、org、region、open_source、usage、release、rank、reasoning、total 及 instruction、code、math、science、agent、hallucination 各维度分数。
请求
curl https://aiping.icu/api/superclue
响应示例(200,节选)
{
"updated": "2026-05-28",
"source": "SuperCLUE",
"note": "SuperCLUE 模型能力评测",
"models": [
{
"model": "Gemini-3.1-Pro-Preview(high)",
"org": "Google",
"region": "海外",
"open_source": "闭源",
"usage": "API",
"release": "2026.5.28",
"rank": "-",
"reasoning": true,
"total": 75.73,
"instruction": 56.19,
"code": 81.47,
"math": 82.46,
"science": 71.93,
"agent": 75.12,
"hallucination": 87.23
},
{
"model": "GPT-5.5(high)",
"org": "OpenAI",
"region": "海外",
"open_source": "闭源",
"usage": "API",
"release": "2026.5.28",
"rank": "-",
"reasoning": true,
"total": 74.27,
"instruction": 53.33,
"code": 72.88,
"math": 82.46,
"science": 63.16,
"agent": 86.56,
"hallucination": 87.26
}
]
}
8. 文档资源
GET
/api/docs
HTML 文档页面(当前页面)
返回本 HTML 文档页面。
GET
/api/openapi.json
OpenAPI 3.0 机器可读描述
返回 OpenAPI 3.0 规范 JSON,可用 Swagger UI、Redoc 等工具渲染成交互式文档。
请求
curl https://aiping.icu/api/openapi.json