账号与密钥/API Key
API Key 用量
接口说明:使用 X-Api-Key 查询当前凭证对应 API Key 的分组调用次数。不传 period 时返回当前 UTC 自然月;传入 YYYY-MM 时查询指定历史月份,每次仅查询一个月份。
返回的是配额调用用量,不是成功发布数、AI Token 或积分消耗明细。没有历史记录的月份,各分组 used 返回 0。只能查询当前 API Key,不支持通过参数查询其他 Key。
GET
/
api
/
api-key
/
current
/
usage
API Key 用量
curl --request GET \
--url https://aitoearn.cn/api/api-key/current/usage \
--header 'X-Api-Key: <api-key>'import requests
url = "https://aitoearn.cn/api/api-key/current/usage"
headers = {"X-Api-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Api-Key': '<api-key>'}};
fetch('https://aitoearn.cn/api/api-key/current/usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://aitoearn.cn/api/api-key/current/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Api-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"code": 0,
"message": "请求成功",
"data": {
"period": "2026-09",
"apiKeyId": "key-id-1",
"userId": "user-id-1",
"groups": [
{
"groupId": "publish-api",
"name": "发布 API",
"used": 17
}
]
},
"requestId": "request-id-1"
}
授权
需要从 AiToEarn 获取 API Key。点击前往「API Key 获取教程」。
响应
200 - application/json
请求已被服务处理。业务是否成功以响应体 code === 0 为准。
⌘I
API Key 用量
curl --request GET \
--url https://aitoearn.cn/api/api-key/current/usage \
--header 'X-Api-Key: <api-key>'import requests
url = "https://aitoearn.cn/api/api-key/current/usage"
headers = {"X-Api-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Api-Key': '<api-key>'}};
fetch('https://aitoearn.cn/api/api-key/current/usage', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://aitoearn.cn/api/api-key/current/usage"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Api-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"code": 0,
"message": "请求成功",
"data": {
"period": "2026-09",
"apiKeyId": "key-id-1",
"userId": "user-id-1",
"groups": [
{
"groupId": "publish-api",
"name": "发布 API",
"used": 17
}
]
},
"requestId": "request-id-1"
}

