88API88API
使用指南AI 应用API 文档帮助支持
接口模块使用指南

日志模块

功能说明

接口前缀统一为 https://88api.ai

调用日志查询接口,可查看当前账户的调用日志,提供实时统计(RPM/TPM)和多维度过滤等功能。支持 CORS 的 Token 查询接口便于第三方集成。

🔐 无需鉴权

根据 Token 查询日志

  • 接口名称:根据 Token 查询日志
  • HTTP 方法:GET
  • 路径:/api/log/token
  • 鉴权要求:公开
  • 功能简介:通过 Token 密钥查询相关日志记录,支持跨域访问

💡 请求示例:

const response = await fetch('/api/log/token?key=`<TOKEN_PLACEHOLDER>`', {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json'
  }
});
const data = await response.json();

✅ 成功响应示例:

{
  "success": true,
  "message": "",
  "data": [
    {
      "id": 1,
      "type": 2,
      "content": "API调用成功",
      "model_name": "gpt-5.5",
      "quota": 1000,
      "created_at": 1640995000
    }
  ]
}

❗ 失败响应示例:

{
  "success": false,
  "message": "Token不存在或无权限"
}

🧾 字段说明:

key (字符串): Token 密钥,必填

🔐 用户鉴权

我的日志统计

  • 接口名称:我的日志统计
  • HTTP 方法:GET
  • 路径:/api/log/self/stat
  • 鉴权要求:用户
  • 功能简介:获取当前用户的日志统计信息,包括配额消耗、请求频率和 Token 使用量

💡 请求示例:

const response = await fetch('/api/log/self/stat?type=2&start_timestamp=1640908800&end_timestamp=1640995200&token_name=api_token&model_name=gpt-5.5&group=default', {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer your_user_token',
    'New-Api-User': 'your_user_id'
  }
});
const data = await response.json();

✅ 成功响应示例:

{
  "success": true,
  "message": "",
  "data": {
    "quota": 50000,
    "rpm": 10,
    "tpm": 1500
  }
}

❗ 失败响应示例:

{
  "success": false,
  "message": "获取统计信息失败"
}

🧾 字段说明:

  • type (数字): 日志类型,可选值:1=充值,2=消费,3=管理,4=错误,5=系统
  • start_timestamp (数字): 开始时间戳
  • end_timestamp (数字): 结束时间戳
  • token_name (字符串): Token 名称过滤
  • model_name (字符串): 模型名称过滤
  • group (字符串): 分组过滤
  • quota (数字): 指定时间范围内的总配额消耗
  • rpm (数字): 每分钟请求数(最近 60 秒)
  • tpm (数字): 每分钟 Token 数(最近 60 秒)

获取我的日志

  • 接口名称:获取我的日志
  • HTTP 方法:GET
  • 路径:/api/log/self
  • 鉴权要求:用户
  • 功能简介:分页获取当前用户的日志记录,支持多种过滤条件

💡 请求示例:

const response = await fetch('/api/log/self?p=1&page_size=20&type=2&start_timestamp=1640908800&end_timestamp=1640995200&token_name=api_token&model_name=gpt-5.5&group=default', {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer your_user_token',
    'New-Api-User': 'your_user_id'
  }
});
const data = await response.json();

✅ 成功响应示例:

{
  "success": true,
  "message": "",
  "data": {
    "items": [
      {
        "id": 1,
        "user_id": 1,
        "created_at": 1640995000,
        "type": 2,
        "content": "API调用成功",
        "token_name": "api_token",
        "model_name": "gpt-5.5",
        "quota": 1000,
        "prompt_tokens": 50,
        "completion_tokens": 100
      }
    ],
    "total": 25,
    "page": 1,
    "page_size": 20
  }
}

❗ 失败响应示例:

{
  "success": false,
  "message": "获取日志失败"
}

🧾 字段说明:

  • p (数字): 页码,默认为 1
  • page_size (数字): 每页数量,默认为 20
  • type (数字): 日志类型,可选值:1=充值,2=消费,3=管理,4=错误,5=系统
  • start_timestamp (数字): 开始时间戳
  • end_timestamp (数字): 结束时间戳
  • token_name (字符串): Token 名称过滤
  • model_name (字符串): 模型名称过滤
  • group (字符串): 分组过滤

只返回当前用户的日志记录。

搜索我的日志

  • 接口名称:搜索我的日志
  • HTTP 方法:GET
  • 路径:/api/log/self/search
  • 鉴权要求:用户
  • 功能简介:根据关键词搜索当前用户的日志记录

💡 请求示例:

const response = await fetch('/api/log/self/search?keyword=gpt-5.5', {
  method: 'GET',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer your_user_token',
    'New-Api-User': 'your_user_id'
  }
});
const data = await response.json();

✅ 成功响应示例:

{
  "success": true,
  "message": "",
  "data": [
    {
      "id": 1,
      "type": 2,
      "content": "API调用成功",
      "model_name": "gpt-5.5",
      "created_at": 1640995000
    }
  ]
}

❗ 失败响应示例:

{
  "success": false,
  "message": "搜索日志失败"
}

🧾 字段说明:

keyword (字符串): 搜索关键词,匹配当前用户的日志类型