用量与积分简介
欢迎使用用量与积分服务文档!
本服务提供开放 API,用于查询您账户的积分余额、API 使用日志和积分变动历史。您可以通过编程方式监控消耗量,并将账单数据集成到您自己的系统中。
认证方式
所有端点都需要通过 API Key 进行认证。您可以通过以下两种方式传递:
| 方式 | 示例 |
|---|
| 请求头 | X-API-Key: your-api-key |
| 查询参数 | ?key=your-api-key |
请妥善保管您的 API Key。不要在客户端代码或公开仓库中暴露它。
功能特性
- 积分余额 — 实时查询您当前的积分余额。
- 服务列表 — 获取所有可用服务及其 ID,用于筛选。
- API 使用日志 — 搜索详细的 API 调用记录,包括状态码、消耗积分、追踪 ID 和元数据。
- 积分变动历史 — 查看积分扣减详情,包含扣减前后余额和扣减金额。
可用端点
| 端点 | 方法 | 描述 |
|---|
/api-user/credits | GET | 查询当前积分余额 |
/api-user/services | GET | 列出可用服务 |
/api-user/usage/search | POST | 搜索 API 使用日志 |
/api-user/points/search | POST | 搜索积分变动历史 |
快速开始
查询积分余额
curl https://dk.mountsea.ai/api-user/credits \
-H "X-API-Key: your-api-key"
响应:import requests
headers = {"X-API-Key": "your-api-key"}
resp = requests.get("https://dk.mountsea.ai/api-user/credits", headers=headers)
print(resp.json())
# {"credits": 10000}
const resp = await fetch("https://dk.mountsea.ai/api-user/credits", {
headers: { "X-API-Key": "your-api-key" }
});
const data = await resp.json();
console.log(data);
// { credits: 10000 }
搜索积分变动历史
curl -X POST https://dk.mountsea.ai/api-user/points/search \
-H "X-API-Key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"dateRange": {
"start": 1767801600000,
"end": 1773071999999
},
"page": 1,
"limit": 10
}'
import requests
headers = {
"X-API-Key": "your-api-key",
"Content-Type": "application/json"
}
body = {
"dateRange": {
"start": 1767801600000,
"end": 1773071999999
},
"page": 1,
"limit": 10
}
resp = requests.post(
"https://dk.mountsea.ai/api-user/points/search",
headers=headers,
json=body
)
print(resp.json())
const resp = await fetch("https://dk.mountsea.ai/api-user/points/search", {
method: "POST",
headers: {
"X-API-Key": "your-api-key",
"Content-Type": "application/json"
},
body: JSON.stringify({
dateRange: { start: 1767801600000, end: 1773071999999 },
page: 1,
limit: 10
})
});
const data = await resp.json();
console.log(data);
浏览 API 文档