Memene API

开发文档
开发者控制台
API v1获取 API Key 使用统计
API v1

获取 API Key 使用统计需要认证免费

GET/v1/users/apikey/usage

接口说明

验证 API Key 的有效性并返回其调用量统计数据。

主要用途:

  • 验证 API Key 是否有效
  • 查看 API Key 的调用统计信息
  • 监控 API 使用情况

返回值:

  • keyId:API Key 的唯一标识符
  • usage:使用统计
    • totalCalls:过去 30 天的总调用次数
    • todayCalls:今天的调用次数
    • successCount:过去 30 天的成功调用次数
    • failCount:过去 30 天的失败调用次数

统计周期说明:

  • totalCallssuccessCountfailCount 统计过去 30 天的数据
  • todayCalls 仅统计当天(UTC 00:00 起)的数据
  • 成功率计算:successCount / totalCalls

错误说明:

HTTP 状态码含义
401API Key 无效或已过期

授权说明:

  • 需要提供有效的 API Key(Bearer Token)
  • 此接口不收费
请求头
参数类型必填说明
Authorizationstring

从 Memene API 开放平台获取的 API Key。是 Bearer Token 格式,例如:Bearer sk_memene_xxx_yyy。可以 点击此处 获取 API KEY

响应结构
200

Default Response

application/json
字段类型说明
keyIdstring
usageobject
totalCallsnumber
todayCallsnumber
successCountnumber
failCountnumber
示例
json
{
  "keyId": "key_abc123",
  "usage": {
    "totalCalls": 1024,
    "todayCalls": 42,
    "successCount": 1000,
    "failCount": 24
  }
}
401

Default Response

application/json
字段类型说明
errorstring
messagestring
示例
json
{
  "error": "Unauthorized",
  "message": "无效的 API Key"
}