模型状态与价格 API
两个免鉴权的公开接口,直接返回 JSON:/api/provider/status 给出每个模型在各分组的实时可用状态,/api/provider/pricing 给出与模型广场完全一致的价格表。适合做状态面板、自动切换模型、成本估算或第三方收录。
调用地址
两个接口在控制台域名与所有 API 端点上均可访问,例如 https://cn.chatapi.app/api/provider/status 或 https://www.xycai.us/api/provider/status。不需要 Authorization 头;建议客户端按分钟级缓存,不要高频轮询。
一、模型状态 GET /api/provider/status
GEThttps://cn.chatapi.app/api/provider/status
枚举口径与价格表一致:模型 × 定价分组一条记录(同一模型在企业版、经济版各算一条)。有探针覆盖的模型按探针数据给出状态;没有探针的模型一律报告 operational 并标记 probed: false。
请求示例
curl https://cn.chatapi.app/api/provider/status
Python:
import requests
data = requests.get("https://cn.chatapi.app/api/provider/status", timeout=10).json()["data"]
print(data["summary"])
bad = [m for m in data["models"] if m["current_status"] != "operational"]
for m in bad:
print(m["group_name"], m["model_name"], m["current_status"], m.get("current_rate"))
响应结构
{
"schema_version": "1.0",
"success": true,
"message": "",
"data": {
"site_name": "XycAi",
"generated_at": "2026-10-21T23:36:47Z",
"window_hours": 24,
"summary": {
"total": 285,
"probed": 31,
"status": { "operational": 263, "degraded": 22, "outage": 0 },
"current_status": { "operational": 284, "degraded": 0, "outage": 1 }
},
"models": [
{
"model_name": "claude-opus-5-5",
"group_name": "Claude 企业版",
"status": "operational",
"current_status": "operational",
"probed": true,
"rate_24h": 100,
"current_rate": 100,
"last_check": 1792625400,
"note": "status: 24h probe success rate ... current_status: latest 30-minute probe bucket ..."
},
{
"model_name": "claude-2",
"group_name": "Claude 工作流",
"status": "operational",
"current_status": "operational",
"probed": false,
"note": "No probe coverage for this model; reported as operational."
}
]
}
}
字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
data.window_hours | int | 统计窗口,固定 24 小时 |
data.summary.total / probed | int | 记录总数 / 其中有探针覆盖的条数 |
data.summary.status / current_status | object | 两种口径下各状态的计数 |
model_name / group_name | string | 模型名(请求里的 model)与所在定价分组的显示名 |
status | enum | 24 小时口径:过去 24h 探针成功率 ≥99% → operational;≥50% → degraded;<50% → outage |
current_status | enum | 实时口径:最近一个有数据的 30 分钟探针桶,≥99% → operational;>0% → degraded;0% → outage。与模型广场的格子颜色一致 |
probed | bool | 是否有探针覆盖。false 时 status / current_status 固定为 operational,且没有 rate_* / last_check 字段 |
rate_24h / current_rate | number | 24h 成功率 / 最近桶成功率,百分数(0–100) |
last_check | int | 最近探针桶的起点时间,Unix 秒 |
怎么用这两个口径
做自动切换(故障时换模型 / 换分组)看 current_status;做稳定性评估或选型看 status 与 rate_24h。探针查询失败时接口返回 HTTP 500 且 success: false,不会假装全绿,客户端应按"未知"处理而非"全部故障"。
二、公开价格表 GET /api/provider/pricing
GEThttps://cn.chatapi.app/api/provider/pricing
返回当前对外的最终售价(已含分组折扣),单位人民币,口径与模型广场一致。枚举同样是模型 × 未隐藏分组。
curl https://cn.chatapi.app/api/provider/pricing
{
"schema_version": "1.1",
"success": true,
"data": {
"currency": "CNY",
"price_unit": "per_1m_tokens",
"updated_at": "2026-10-21T23:36:56Z",
"models": [
{
"model_name": "claude-fable-5",
"group_name": "Claude 企业版",
"input_price": 26.91,
"output_price": 134.55,
"cache_input_price": 2.691,
"cache_create_price": 26.91,
"enabled": true,
"note": "Final public price in CNY per 1M tokens, matching the model square."
},
{
"model_name": "gpt-image-2.5-flare",
"group_name": "GPT 企业版",
"price_unit": "per_call",
"unit_price": 0.1,
"enabled": true,
"note": "按张计价:1K / 2K / 4K 全档同价 ¥0.1 每张。"
}
]
}
}
| 字段 | 说明 |
|---|---|
data.currency / price_unit | 全局单位:CNY,按 token 计费模型为每 100 万 token 的价格 |
input_price / output_price | 输入 / 输出单价(¥ / 1M tokens) |
cache_input_price / cache_create_price / cache_create_price_1h | 缓存读取 / 缓存写入(5 分钟)/ 缓存写入(1 小时)单价,仅支持缓存的模型有 |
price_unit: "per_call" + unit_price | 按次计费模型(生图按张、视频按秒);note 说明单位与分档规则 |
enabled | 是否可下单 |
用户等级(T1 / T2 / V1 …)与分时折扣不体现在此表中,登录后的模型广场会显示你账户的实际价格。
三、两表联用
两个接口的 (model_name, group_name) 一一对应,可以直接拼成"价格 + 可用性"视图:
import requests
BASE = "https://cn.chatapi.app"
price = {(m["model_name"], m["group_name"]): m for m in requests.get(BASE + "/api/provider/pricing").json()["data"]["models"]}
for s in requests.get(BASE + "/api/provider/status").json()["data"]["models"]:
p = price.get((s["model_name"], s["group_name"]), {})
print(s["model_name"], s["group_name"], s["current_status"], p.get("input_price"), p.get("output_price"))
需要带 Key 查询"我的 Key 能用哪些模型",请改用 GET /v1/models(见模型列表)。
