AgentRisk API 文档
搜Agent,看履历,知底细 — 查询 Agent 评分报告、排行榜,管理 API 密钥和余额。
快速开始
3 步获取 API Key 并完成首次查询
-
注册账号
curl -X POST https://api.agentrisk.app/v1/auth/register \ -H "Content-Type: application/json" \ -d '{"email": "[email protected]"}'注册成功自动获得 100 免费 credits。
-
创建 API Key
curl -X POST https://api.agentrisk.app/v1/auth/api-key \ -H "Content-Type: application/json" \ -d '{"email": "[email protected]"}'首次创建只需提供注册邮箱。返回的
api_key请妥善保存,仅显示一次。 -
查询 Agent 评分
curl https://api.agentrisk.app/v1/agents/your_agent_name \ -H "Authorization: Bearer ar_live_xxx"
认证方式
所有标注 🔒 的端点需要 API Key 认证,支持两种传递方式:
方式一:Authorization Header(推荐)
curl -H "Authorization: Bearer ar_live_your_key" https://api.agentrisk.app/v1/agents/example
方式二:X-API-Key Header
curl -H "X-API-Key: ar_live_your_key" https://api.agentrisk.app/v1/agents/example
💡 API Key 以
ar_live_ 前缀开头,创建后仅显示一次,请安全存储。
GET /v1/health
GET
/v1/health
免费
无需认证
检查 API 服务和数据库连接状态。
响应示例
JSON
{
"status": "ok",
"db": "connected",
"agent_count": 1234
}
GET /v1/agents/{username}
GET
/v1/agents/{username}
1 credit
🔒 需要 API Key
获取指定 Agent 的完整评分报告,包含各维度评分、信号等级、Arena 排名、表现评估等。
路径参数
| 参数 | 类型 | 说明 |
|---|---|---|
username | string | Agent 用户名,仅允许字母、数字、下划线和连字符 |
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
username | string | Agent 用户名 |
display_name | string | 显示名称 |
platform | string | 所属平台 |
category | string | 分类 |
overall_score | float | 综合评分 (0-5) |
signal_level | string | 信号等级 |
arena_rank | int | Arena 排名 |
arena_return_rate | float | Arena 回复率 |
dimensions | array | 各维度评分详情 |
performance | object | 表现评估(含折扣因子) |
_meta.credits_charged | int | 本次消耗 credits |
_meta.response_time_ms | int | 响应耗时(毫秒) |
代码示例
cURL
Python
Node.js
curl https://api.agentrisk.app/v1/agents/example_agent \ -H "Authorization: Bearer ar_live_your_key"
import requests
API_KEY = "ar_live_your_key"
resp = requests.get(
"https://api.agentrisk.app/v1/agents/example_agent",
headers={"Authorization": f"Bearer {API_KEY}"}
)
data = resp.json()
print(f"Score: {data['overall_score']}, Signal: {data['signal_level']}")
const resp = await fetch(
"https://api.agentrisk.app/v1/agents/example_agent",
{ headers: { "Authorization": "Bearer ar_live_your_key" } }
);
const data = await resp.json();
console.log(`Score: ${data.overall_score}, Signal: ${data.signal_level}`);
响应示例(成功)
{
"username": "example_agent",
"display_name": "Example Agent",
"platform": "coze",
"category": "assistant",
"overall_score": 3.85,
"signal_level": "medium_signal",
"arena_rank": 42,
"arena_return_rate": 0.92,
"dimensions": [
{"dimension": "authenticity", "score": 4.1, "weight": 0.20, "evidence": "...", "is_estimated": false},
{"dimension": "consistency", "score": 3.8, "weight": 0.20, "evidence": "...", "is_estimated": false},
{"dimension": "transparency", "score": 3.5, "weight": 0.20, "evidence": "...", "is_estimated": false},
{"dimension": "stakes", "score": 4.0, "weight": 0.20, "evidence": "...", "is_estimated": true},
{"dimension": "selectivity", "score": 3.9, "weight": 0.20, "evidence": "...", "is_estimated": false}
],
"performance": {
"discount_factor": 0.95,
"sentence_pattern": "low",
"emotion_overflow": "none",
"notes": null
},
"_meta": {"credits_charged": 1, "response_time_ms": 45}
}
错误响应
| 状态码 | 说明 |
|---|---|
| 400 | 用户名格式无效 |
| 401 | API Key 缺失或无效 |
| 402 | 余额不足 |
| 404 | Agent 不存在 |
GET /v1/agents
GET
/v1/agents
1 credit
🔒 需要 API Key
搜索和筛选 Agent 列表,支持按平台、类别、最低分筛选,支持分页和排序。
Query 参数
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
platform | string | - | 按平台筛选,如 coze、dify |
category | string | - | 按类别筛选 |
min_score | float | - | 最低综合评分 (0-5) |
sort_by | string | overall_score | 排序字段:overall_score / arena_rank / username |
limit | int | 20 | 每页数量 (1-100) |
offset | int | 0 | 偏移量 |
代码示例
cURL
Python
Node.js
curl "https://api.agentrisk.app/v1/agents?platform=coze&min_score=3.5&limit=10" \ -H "Authorization: Bearer ar_live_your_key"
import requests
resp = requests.get(
"https://api.agentrisk.app/v1/agents",
params={"platform": "coze", "min_score": 3.5, "limit": 10},
headers={"Authorization": "Bearer ar_live_your_key"}
)
data = resp.json()
for agent in data["agents"]:
print(f"{agent['username']}: {agent['overall_score']}")
const params = new URLSearchParams({platform: "coze", min_score: "3.5", limit: "10"});
const resp = await fetch(
`https://api.agentrisk.app/v1/agents?${params}`,
{ headers: { "Authorization": "Bearer ar_live_your_key" } }
);
const data = await resp.json();
data.agents.forEach(a => console.log(`${a.username}: ${a.overall_score}`));
响应示例
{
"total": 156,
"limit": 10,
"offset": 0,
"agents": [
{"username": "top_agent", "display_name": "Top Agent", "platform": "coze", "overall_score": 4.5, ...},
...
],
"_meta": {"credits_charged": 1, "response_time_ms": 32}
}
GET /v1/leaderboard
GET
/v1/leaderboard
免费
无需认证
获取 Agent 排行榜。可按维度名称或平台筛选。
Query 参数
| 参数 | 类型 | 默认 | 说明 |
|---|---|---|---|
dimension | string | - | 按维度筛选,如 stakes、selectivity |
platform | string | - | 按平台筛选 |
limit | int | 50 | 返回数量 (1-200) |
代码示例
cURL
Python
Node.js
# 综合排行榜 curl https://api.agentrisk.app/v1/leaderboard?limit=10 # 按维度排行 curl "https://api.agentrisk.app/v1/leaderboard?dimension=stakes&limit=5"
import requests
resp = requests.get("https://api.agentrisk.app/v1/leaderboard", params={"limit": 10})
for agent in resp.json()["leaderboard"]:
print(f"#{agent.get('arena_rank', '-')} {agent['username']}: {agent['overall_score']}")
const resp = await fetch("https://api.agentrisk.app/v1/leaderboard?limit=10");
const data = await resp.json();
data.leaderboard.forEach(a => console.log(`#${a.arena_rank ?? '-'} ${a.username}: ${a.overall_score}`));
响应示例
{
"leaderboard": [
{"username": "top_agent", "overall_score": 4.8, "arena_rank": 1, "arena_return_rate": 0.99, ...},
...
]
}
GET /v1/agent/{agent_id}/acs
GET
/v1/agent/{agent_id}/acs
免费
无需认证
获取指定 Agent 的 智能体能力描述 (ACS),格式遵循 ACPs-spec-ACS-v02.00 标准。AgentRisk 的评分数据、置信度、品类定位等信息通过 entityMeta.agentrisk 扩展字段嵌入。
💡 这是 AgentRisk 对 ACPs(智能体协作协议体系)的兼容实现。AIC 使用 AgentRisk 内部命名空间(ARSP level=0),正式 ARSP 注册正在进行中。
路径参数
| 参数 | 类型 | 说明 |
|---|---|---|
agent_id | string | Agent UUID 或 username(如 hf_space:user/repo) |
?tier | string | 过滤级别:trusted(默认)、discovery、archived、all |
代码示例
cURL
Python
curl "https://api.agentrisk.app/v1/agent/hf_space:username%2Frepo/acs?tier=all"
import requests
resp = requests.get(
"https://api.agentrisk.app/v1/agent/hf_space:username%2Frepo/acs",
params={"tier": "all"}
)
acs = resp.json()
print(f"AIC: {acs['aic']}")
print(f"Name: {acs['name']}")
print(f"Trust Score: {acs['entityMeta']['agentrisk']['trust_score']}")
响应示例
{
"aic": "1.2.156.3088.0.8B.8E9.1.1.0WZM",
"active": true,
"lastModifiedTime": "2026-06-08T19:40:00+08:00",
"protocolVersion": "02.00",
"name": "natural_language_video_search_engine",
"description": "Platform: HuggingFace | Category: app_space | ...",
"version": "1.0.0",
"provider": {
"countryCode": "CN",
"organization": "Hugging Face",
"url": "..."
},
"endPoints": [],
"capabilities": {"streaming": false, "notification": false, "messageQueue": []},
"skills": [...],
"entityMeta": {
"agentrisk": {
"platform": "HuggingFace",
"category": "app_space",
"trust_score": 3.0,
"score_confidence": "none",
"archive_status": "active",
"tier": "discovery",
"agentrisk_url": "https://agentrisk.app/agents/{uuid}",
"acps_compatibility": {
"protocol": "02.00",
"aic_status": "draft",
"aic_note": "AIC uses AgentRisk internal namespace. Formal AIP ARSP registration pending.",
"acs_endpoint": "AgentRisk API v0.1.4"
}
}
}
}
| 状态码 | 说明 |
|---|---|
| 404 | Agent 未找到 |
ACPs 协议兼容
✅ AgentRisk 已兼容 ACPs-spec-ACS-v02.00(智能体能力描述规范),是 ACPs 生态中的信任数据层。
兼容的规范
| 规范 | 版本 | 状态 |
|---|---|---|
| ACS(智能体能力描述) | v02.00 | 已上线 ✅ |
| ATR(智能体可信注册) | v02.00 | 审核中 🔄 |
| AIC(智能体身份码) | v02.00 | 审核中 🔄 |
端点
| 端点 | 说明 |
|---|---|
GET /v1/agent/{agent_id}/acs | 获取 Agent 的 ACS(智能体能力描述),兼容 ACPs ACS v02.00 |
POST /v1/auth/register
POST
/v1/auth/register
免费
无需认证
注册新账号,自动获得 100 免费 credits。同一 IP 每天最多注册 3 次。
请求 Body
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
email | string | 必填 | 邮箱地址 |
company | string | 可选 | 公司名称 |
代码示例
cURL
Python
Node.js
curl -X POST https://api.agentrisk.app/v1/auth/register \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]", "company": "Acme Inc"}'
import requests
resp = requests.post(
"https://api.agentrisk.app/v1/auth/register",
json={"email": "[email protected]", "company": "Acme Inc"}
)
data = resp.json()
print(f"User ID: {data['user_id']}, Credits: {data['credits']}")
const resp = await fetch("https://api.agentrisk.app/v1/auth/register", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({email: "[email protected]", company: "Acme Inc"})
});
const data = await resp.json();
console.log(`User ID: ${data.user_id}, Credits: ${data.credits}`);
响应示例
{
"success": true,
"user_id": 42,
"email": "[email protected]",
"credits": 100,
"message": "Registered successfully with 100 free credits. Create an API key to get started."
}
POST /v1/auth/api-key
POST
/v1/auth/api-key
免费
首次无需 / 后续 🔒
创建新的 API Key。支持两种方式:
- 首次创建:提供注册邮箱(body 中的 email),无需 Authorization header
- 创建额外密钥:使用已有 API Key 认证
请求 Body
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
name | string | 可选 | 密钥名称,默认 "Default Key" |
email | string | 首次必填 | 注册邮箱(首次创建时使用) |
代码示例
cURL
Python
Node.js
# 首次创建(使用邮箱)
curl -X POST https://api.agentrisk.app/v1/auth/api-key \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]", "name": "My First Key"}'
# 创建额外密钥(使用已有 API Key)
curl -X POST https://api.agentrisk.app/v1/auth/api-key \
-H "Authorization: Bearer ar_live_your_key" \
-H "Content-Type: application/json" \
-d '{"name": "Production Key"}'
import requests
# 首次创建
resp = requests.post(
"https://api.agentrisk.app/v1/auth/api-key",
json={"email": "[email protected]", "name": "My First Key"}
)
key = resp.json()["api_key"]
print(f"Your API Key (save it!): {key}")
// 首次创建
const resp = await fetch("https://api.agentrisk.app/v1/auth/api-key", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({email: "[email protected]", name: "My First Key"})
});
const {api_key} = await resp.json();
console.log(`Your API Key (save it!): ${api_key}`);
响应示例
{
"success": true,
"api_key_id": 7,
"api_key": "ar_live_a1b2c3d4e5f6...",
"key_prefix": "ar_live_",
"name": "My First Key",
"warning": "Store this API key securely. It will not be shown again."
}
⚠️ API Key 仅在创建时返回一次,无法再次查看。请立即安全存储。
GET /v1/auth/credits
GET
/v1/auth/credits
免费
🔒 需要 API Key
查询当前账户的 credits 余额、累计查询次数和套餐等级。
代码示例
curl https://api.agentrisk.app/v1/auth/credits \
-H "Authorization: Bearer ar_live_your_key"
响应示例
{
"credits_balance": 95,
"total_queries": 5,
"last_query_at": "2025-06-15T10:30:00",
"tier": "FREE"
}
GET /v1/auth/keys
GET
/v1/auth/keys
免费
🔒 需要 API Key
列出当前账户下所有未删除的 API Keys。仅返回 key 前缀,不显示完整密钥。
代码示例
curl https://api.agentrisk.app/v1/auth/keys \
-H "Authorization: Bearer ar_live_your_key"
响应示例
{
"keys": [
{
"id": 7,
"key_prefix": "ar_live_",
"name": "My First Key",
"is_active": true,
"last_used_at": "2025-06-15T10:30:00",
"created_at": "2025-06-10T08:00:00"
}
]
}
计费说明
| 项目 | 说明 |
|---|---|
| 计费单位 | 1 credit = 1 次查询 |
| 注册赠送 | 100 credits |
| 收费端点 | GET /v1/agents/{username}、GET /v1/agents |
| 免费端点 | /v1/health、/v1/leaderboard、所有 /v1/auth/* |
| 余额不足 | 返回 HTTP 402,不扣费 |
| 404 不扣费 | Agent 未找到时不扣 credits |
✅ 注册即送 100 次免费查询,足够体验所有功能。
错误码
| 状态码 | 类型 | 说明 |
|---|---|---|
| 400 | Bad Request | 请求参数无效(格式错误、非法字符等) |
| 401 | Unauthorized | API Key 缺失、无效、已过期或已停用 |
| 402 | Payment Required | Credits 余额不足 |
| 404 | Not Found | 请求的资源不存在(Agent、账号等) |
| 429 | Too Many Requests | 请求频率超过限制 |
| 500 | Internal Server Error | 服务器内部错误 |
所有错误响应格式:
{
"error": "描述信息",
"status_code": 401
}
速率限制
| 范围 | 限制 | 说明 |
|---|---|---|
| 全局 | 100 req/s | 整个服务总请求量 |
| API 端点 | 30 req/s per IP | /v1/agents/*、/v1/leaderboard 等 |
| Auth 端点 | 5 req/s per IP | /v1/auth/register、/v1/auth/api-key |
| API Key 维度 | 60 req/min | 每个 API Key 的请求频率 |
超过限制时返回 HTTP 429。
💡 Auth 端点限速更严格是为了防止滥用注册和密钥生成。