统计接口用于查询工具的执行统计数据,包括调用次数、成功率、费用消耗等信息。支持按时间范围、工具类型等多维度查询。
✓ 免费接口:统计接口完全免费,不消耗任何次数或 Credits。
POST https://api.jisuapi.com/agent/stats
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
start_date | string | 否 | 开始日期(YYYY-MM-DD),默认今天 |
end_date | string | 否 | 结束日期(YYYY-MM-DD),默认今天 |
tool_id | string | 否 | 指定工具 ID,不传则查询所有工具 |
group_by | string | 否 | 分组维度:day/hour/tool,默认 day |
| Header | 值 | 说明 |
|---|---|---|
Authorization | Bearer {appkey} | APPKEY 认证 |
Content-Type | application/json | 请求体格式 |
{
"status": 0,
"msg": "ok",
"result": {
"summary": {
"total_calls": 1250,
"success_calls": 1198,
"failed_calls": 52,
"success_rate": 0.9584,
"total_cost": 15.80,
"period": {
"start": "2026-06-01",
"end": "2026-06-03"
}
},
"by_tool": [
{
"tool_id": "shouji_query",
"tool_name": "手机号码归属地查询",
"calls": 580,
"success": 580,
"failed": 0,
"cost": 0.0
},
{
"tool_id": "weather_forecast",
"tool_name": "天气预报",
"calls": 420,
"success": 398,
"failed": 22,
"cost": 8.40
}
],
"by_date": [
{
"date": "2026-06-01",
"calls": 410,
"success": 392,
"cost": 5.20
},
{
"date": "2026-06-02",
"calls": 438,
"success": 420,
"cost": 5.60
},
{
"date": "2026-06-03",
"calls": 402,
"success": 386,
"cost": 5.00
}
]
},
"request_id": "req_..."
} | status | msg | 说明 |
|---|---|---|
| 101 | APPKEY为空或不存在 | 未提供有效的APPKEY |
| 203 | 日期格式错误 | 日期参数格式不正确 |
| 204 | 时间范围超限 | 查询时间范围不能超过 90 天 |
curl -X POST "https://api.jisuapi.com/agent/stats" \
-H "Authorization: Bearer 你的APPKEY" \
-H "Content-Type: application/json" \
-d '{}' curl -X POST "https://api.jisuapi.com/agent/stats" \
-H "Authorization: Bearer 你的APPKEY" \
-H "Content-Type: application/json" \
-d '{
"start_date": "2026-06-01",
"end_date": "2026-06-03"
}' curl -X POST "https://api.jisuapi.com/agent/stats" \
-H "Authorization: Bearer 你的APPKEY" \
-H "Content-Type: application/json" \
-d '{
"tool_id": "shouji_query",
"start_date": "2026-06-01",
"end_date": "2026-06-03"
}' curl -X POST "https://api.jisuapi.com/agent/stats" \
-H "Authorization: Bearer 你的APPKEY" \
-H "Content-Type: application/json" \
-d '{
"start_date": "2026-06-03",
"end_date": "2026-06-03",
"group_by": "hour"
}' import requests
from datetime import datetime, timedelta
url = "https://api.jisuapi.com/agent/stats"
headers = {
"Authorization": "Bearer 你的APPKEY",
"Content-Type": "application/json"
}
# 查询最近7天统计
today = datetime.now()
week_ago = today - timedelta(days=7)
data = {
"start_date": week_ago.strftime("%Y-%m-%d"),
"end_date": today.strftime("%Y-%m-%d")
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
if result["status"] == 0:
summary = result["result"]["summary"]
print(f"总调用: {summary['total_calls']}")
print(f"成功率: {summary['success_rate']*100:.2f}%")
print(f"总费用: ¥{summary['total_cost']}")
print("\n按工具统计:")
for tool in result["result"]["by_tool"]:
print(f"- {tool['tool_name']}: {tool['calls']} 次")
else:
print(f"查询失败: {result['msg']}") | 字段 | 类型 | 说明 |
|---|---|---|
total_calls | integer | 总调用次数 |
success_calls | integer | 成功次数 |
failed_calls | integer | 失败次数 |
success_rate | float | 成功率(0-1) |
total_cost | float | 总费用(元) |
A: 实时更新,每次执行接口调用后立即计入统计。
A: 单次查询最多支持 90 天。需要更长时间的数据请分批查询。
A: 一般不会。只有成功返回数据的调用才计费。failed_calls 中的调用通常不产生费用。


© 2015-2025 杭州极速互联科技有限公司 版权所有 浙ICP备17047587号-4 浙公网安备33010502005096 增值电信业务经营许可证:浙B2-20190875