API keys
Get current API key
Use CometAPI GET /api/usage/token to retrieve quota, usage, expiration, and model-limit details for the bearer API key.
GET
/
api
/
usage
/
token
cURL
curl https://api.cometapi.com/api/usage/token \
-H "Authorization: Bearer $COMETAPI_KEY"import requests
url = "https://api.cometapi.com/api/usage/token"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.cometapi.com/api/usage/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/api/usage/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cometapi.com/api/usage/token"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.cometapi.com/api/usage/token")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/api/usage/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"code": true,
"message": "ok",
"data": {
"object": "token_usage",
"name": "production",
"total_granted": 150000,
"total_used": 50000,
"total_available": 100000,
"unlimited_quota": false,
"model_limits": {
"gpt-4.1": true
},
"model_limits_enabled": true,
"expires_at": 0
}
}Use this endpoint to inspect the CometAPI API key used by the request. It returns usage and quota fields for the bearer key, not an account-level list of all keys.
This endpoint uses a CometAPI API key:
Authorization: Bearer $COMETAPI_KEY. API key management endpoints use a separate personal access token.Returned fields
| Field | Type | Description |
|---|---|---|
name | string | Display name of the API key. |
total_granted | integer | Total quota assigned to this key in CometAPI internal quota units. |
total_used | integer | Quota consumed by this key in CometAPI internal quota units. |
total_available | integer | Remaining quota available to this key in CometAPI internal quota units. |
unlimited_quota | boolean | Whether the key bypasses remaining-quota checks. |
model_limits | object | Model restrictions for this key, keyed by model ID. Empty when no model limits are configured. |
model_limits_enabled | boolean | Whether model restrictions are active for this key. |
expires_at | integer | Unix timestamp in seconds when the key expires. 0 means no expiration in this usage response. |
Authorizations
CometAPI API key used for model requests. Send it as Authorization: Bearer $COMETAPI_KEY.
Last modified on June 23, 2026
⌘I
cURL
curl https://api.cometapi.com/api/usage/token \
-H "Authorization: Bearer $COMETAPI_KEY"import requests
url = "https://api.cometapi.com/api/usage/token"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.cometapi.com/api/usage/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.cometapi.com/api/usage/token",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.cometapi.com/api/usage/token"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.cometapi.com/api/usage/token")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.cometapi.com/api/usage/token")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"code": true,
"message": "ok",
"data": {
"object": "token_usage",
"name": "production",
"total_granted": 150000,
"total_used": 50000,
"total_available": 100000,
"unlimited_quota": false,
"model_limits": {
"gpt-4.1": true
},
"model_limits_enabled": true,
"expires_at": 0
}
}