Uso de créditos
O que foi cobrado da sua conta em um intervalo de datas UTC, dividido por dia, mecanismo e chave de API.
GET
/
v1
/
usage
Get usage
curl --request GET \
--url https://api.querying.ai/v1/usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.querying.ai/v1/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.querying.ai/v1/usage', 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.querying.ai/v1/usage",
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.querying.ai/v1/usage"
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.querying.ai/v1/usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.querying.ai/v1/usage")
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{
"success": true,
"data": {
"from": "2026-10-01",
"to": "2026-10-20",
"groupBy": [
"day",
"engine"
],
"credits": 66.25,
"tasks": 65,
"rows": [
{
"date": "2026-10-17",
"taskType": "CHATGPT",
"credits": 42,
"tasks": 42
},
{
"date": "2026-10-17",
"taskType": "PERPLEXITY",
"credits": 9,
"tasks": 9
},
{
"date": "2026-10-20",
"taskType": "CHATGPT",
"credits": 7,
"tasks": 7
},
{
"date": "2026-10-20",
"taskType": "GEMINI",
"credits": 6.25,
"tasks": 5
},
{
"date": "2026-10-20",
"taskType": "PERPLEXITY",
"credits": 2,
"tasks": 2
}
]
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "groupBy must name some of day, engine, key, separated by commas",
"timestamp": "2026-10-20T00:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "MISSING_API_KEY",
"message": "Missing or invalid API key",
"timestamp": "2026-07-09T04:12:00.000Z"
}
}{
"success": false,
"error": {
"code": "SUB_ACCOUNT_FORBIDDEN",
"message": "A sub-account spends its parent account's credits. The parent account reads its usage at /v1/sub-accounts/{id}/usage",
"timestamp": "2026-10-20T00:00:00.000Z"
}
}A consulta não custa nada. Sem parâmetros, ela devolve o mês UTC atual até hoje, dividido por dia e mecanismo. Adicione
groupBy=key para ver qual chave de API gastou os créditos. O significado de cada campo está em Créditos e limites.Autorizações
Your API key, sent as Authorization: Bearer <key>.
Parâmetros de consulta
First UTC date, inclusive. Default: the first day of the current UTC month.
Last UTC date, inclusive. Default: today (UTC). The range spans at most 366 days, from and to included.
How to split the rows: a comma-separated choice of day, engine and key. Default: day,engine.
Exemplos:
"engine"
"day,key"
⌘I
Get usage
curl --request GET \
--url https://api.querying.ai/v1/usage \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.querying.ai/v1/usage"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.querying.ai/v1/usage', 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.querying.ai/v1/usage",
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.querying.ai/v1/usage"
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.querying.ai/v1/usage")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.querying.ai/v1/usage")
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{
"success": true,
"data": {
"from": "2026-10-01",
"to": "2026-10-20",
"groupBy": [
"day",
"engine"
],
"credits": 66.25,
"tasks": 65,
"rows": [
{
"date": "2026-10-17",
"taskType": "CHATGPT",
"credits": 42,
"tasks": 42
},
{
"date": "2026-10-17",
"taskType": "PERPLEXITY",
"credits": 9,
"tasks": 9
},
{
"date": "2026-10-20",
"taskType": "CHATGPT",
"credits": 7,
"tasks": 7
},
{
"date": "2026-10-20",
"taskType": "GEMINI",
"credits": 6.25,
"tasks": 5
},
{
"date": "2026-10-20",
"taskType": "PERPLEXITY",
"credits": 2,
"tasks": 2
}
]
}
}{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "groupBy must name some of day, engine, key, separated by commas",
"timestamp": "2026-10-20T00:00:00.000Z"
}
}{
"success": false,
"error": {
"code": "MISSING_API_KEY",
"message": "Missing or invalid API key",
"timestamp": "2026-07-09T04:12:00.000Z"
}
}{
"success": false,
"error": {
"code": "SUB_ACCOUNT_FORBIDDEN",
"message": "A sub-account spends its parent account's credits. The parent account reads its usage at /v1/sub-accounts/{id}/usage",
"timestamp": "2026-10-20T00:00:00.000Z"
}
}