CometAPI 提供兩種方式來檢查帳戶餘額與用量:CometAPI CLI 以及位於Documentation Index
Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
Use this file to discover all available pages before exploring further.
query.cometapi.com 的 查詢服務 API。
CometAPI CLI
從終端機檢查餘額的最快方式。安裝方式請參閱 CometAPI CLI 概覽。--source token 可查看各個金鑰的詳細資訊:
查詢服務 API
GET https://query.cometapi.com/user/quota
回傳帳戶層級的餘額、累計用量、總請求次數,以及各個金鑰的配額詳細資訊。此端點使用位於 query.cometapi.com 的獨立查詢服務,並透過 key 查詢參數進行驗證,而不是使用 Bearer Token。
請求參數
| Parameter | Type | Required | Description |
|---|---|---|---|
key | string | Yes | 您的 CometAPI API key |
start_date | string | No | 每日明細的開始日期(YYYY-MM-DD 格式) |
end_date | string | No | 每日明細的結束日期(YYYY-MM-DD 格式) |
start_date 和 end_date 時,回應會包含 daily_quota 欄位,提供按天拆分的各金鑰用量資訊。
回應欄位
| Field | Type | Description |
|---|---|---|
username | string | 使用者名稱 |
total_quota | number | 目前帳戶餘額(USD) |
total_used_quota | number | 累計用量(USD) |
request_count | integer | 總請求次數 |
keys | array | 各個金鑰的配額詳細資訊 |
keys[].name | string | API key 名稱 |
keys[].remain_quota | number | 金鑰剩餘配額;-1 表示無限制 |
keys[].used_quota | number | 金鑰已用配額;-1 表示無限制 |
daily_quota | object | 每日用量明細(僅在設定 start_date 與 end_date 時提供) |
daily_quota[date] | array | 該日期各個金鑰的用量項目 |
daily_quota[date][].token_name | string | API key 名稱 |
daily_quota[date][].quota_used | number | 該日期該金鑰的用量(USD) |
daily_quota[date][].request_count | integer | 該日期該金鑰的請求次數 |
程式碼範例
查詢帳戶餘額:回應範例
每日明細範例
查詢某個日期範圍的每日用量:daily_quota: