Files
model-eval-site/API.md
T

2.9 KiB
Raw Blame History

模型评测网站 API 文档

Base: http://<IP>:16066(端口 16066

1. 接收提交(llm-speed-tester 一键发送)

POST /api/submit

Header: Content-Type: application/jsonX-Token: meval16066

curl -X POST http://127.0.0.1:16066/api/submit \
  -H "Content-Type: application/json" \
  -H "X-Token: meval16066" \
  -d '{
    "account": "性能评测组",            # 账号,不存在自动创建
    "source_test_id": 25,             # llm-speed-tester 测试ID
    "source_site": "llm-speed-tester",
    "provider": "openai",
    "model": "nvidia/Qwen3.6-35B-A3B-NVFP4",
    "test_name": "我的测试",
    "summary": { "samples_ok":2, "samples_total":2, "avg_ttft_ms":180,
                 "avg_prefill_speed":320.5, "avg_decode_speed":88.2,
                 "avg_output_tokens":128, "avg_total_ms":2500,
                 "concurrency_levels":[1],
                 "by_length": {"2048": {"avg_ttft_ms":150,"avg_prefill_speed":350,
                                         "avg_decode_speed":92,"avg_prompt_tokens":1500,
                                         "avg_output_tokens":128,"avg_total_ms":2000}},
                 "by_concurrency": {} },
    "gen": {"context_lengths":[2048,8192], "max_tokens":128, "samples":2, "concurrency_levels":[1]},
    "runs": []
  }'

响应:

{ "ok": true, "id": 21, "account_id": 2, "account": "性能评测组",
  "model": "nvidia/Qwen3.6-35B-A3B-NVFP4",
  "url": "/model.html?provider=openai&model=nvidia/Qwen3.6-35B-A3B-NVFP4" }

2. 排行 / 统计

# 模型速度排行(按 provider+model 聚合)
GET /api/leaderboard?sort=avg_decode_speed&order=desc&limit=200
# sort 可选: avg_decode_speed / avg_prefill_speed / avg_ttft_ms / best_decode / cnt / accounts / last_tested

GET /api/stats        # 统计卡片
GET /api/health       # 健康检查 + stats

3. 模型详情

GET /api/model?provider=openai&model=nvidia/Qwen3.6-35B-A3B-NVFP4

返回:该模型全部提交(submissions,含账号)+ 按上下文长度聚合(by_length+ 折线图数据(line_csv/line_payload)。

4. 提交管理

GET    /api/submissions?page=1&page_size=20&q=关键词&account_id=2&model=xxx&provider=xxx
GET    /api/submissions/<id>              # 单条详情
DELETE /api/submissions/<id>              # 删除
GET    /api/submissions/<id>/chart        # 上下文长度→速度折线图 PNG

5. 账号管理

GET    /api/accounts
POST   /api/accounts    {"name":"xxx","remark":"yyy"}        # 新增(重名 400
PUT    /api/accounts/<id>  {"name":"xxx","remark":"yyy"}     # 改名/备注
DELETE /api/accounts/<id>                                    # 删除(连带其提交)

6. 其他

POST /api/seed-demo          # 🎲 生成演示评测数据
POST /api/chart              # 图表代理(转发 data-chart-tool 16016,返回 PNG

错误

所有接口失败返回 {"ok": false, "error": "..."} + 对应 HTTP 状态码。