API 参考
通过 REST API 获取评测数据、提交中转站、查询排名。所有接口返回 JSON,Base URL 为 https://你的域名/proxybench/api
GET /rankings.php
获取中转站评测排名列表,支持分页与筛选。
| Query 参数 | |
limit | 返回条数,默认 20,最大 100 |
offset | 偏移量,默认 0 |
status | 按状态筛选:active / evaluating / pending |
# 获取前 20 名活跃中转站
curl "https://你的域名/proxybench/api/rankings.php?limit=20&status=active"
# 响应示例
{
"data": [{
"id": 1,
"rank": 1,
"name": "ProxyHub",
"base_url": "https://api.proxyhub.io/v1",
"overall_score": 91.2,
"grade": "A",
"latency_ms": 187,
"uptime_pct": 99.8,
"models": ["openai","anthropic","google"]
}],
"total": 186,
"limit": 20,
"offset": 0
}
GET /proxies.php?id={id}
获取指定中转站的完整评测详情与最新评测数据。
curl "https://你的域名/proxybench/api/proxies.php?id=1"
POST /proxies.php
通过 API 提交新的中转站评测申请。需要 API Key 认证。
| Body 参数 | 必填 / 类型 |
name | 必填 · string · 中转站名称 |
base_url | 必填 · string · HTTPS API 地址 |
description | 可选 · string · 简介 |
models | 必填 · string[] · 模型列表 |
pricing_model | 可选 · string · official/custom/free |
region | 可选 · string · 服务器区域 |
curl -X POST "https://你的域名/proxybench/api/proxies.php" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "MyProxy",
"base_url": "https://api.example.com/v1",
"description": "高性能中转服务",
"models": ["openai", "anthropic", "deepseek"],
"pricing_model": "official",
"region": "sg"
}'
认证方式
需要修改/提交数据的接口需通过 API Key 认证。API Key 在用户控制台中生成(功能规划中)。
# 通过 Authorization Header 传递
Authorization: Bearer pb_sk-xxxxxxxxxxxxxxxxxxxxxxxx
# 当前阶段:API 提交接口已实现基础鉴权框架
# 可通过 session 登录后的网页表单提交,无需 API Key
错误响应
| 400 | 请求参数有误 |
| 401 | 未认证或 API Key 无效 |
| 404 | 中转站不存在 |
| 429 | 请求频率超限 |