Get Total Credit Consumption
Last updated:

Get Total Credit Consumption

Retrieve the total credits consumed by the Bot within a specified time range.

Note: Data can be queried for a maximum range of 365 days.

Request Method

GET

Request URL

https://api.gptbots.ai/v1/account/bill/total

Request Authentication

See Overview for authentication details.

Request

Request Example

curl --location 'https://api.gptbots.ai/v1/account/bill/total?start_time=1732982400000&end_time=1735660799999' \ --header 'Authorization: Bearer YOUR_API_KEY' \ --header 'Content-Type: application/json'
          curl --location 'https://api.gptbots.ai/v1/account/bill/total?start_time=1732982400000&end_time=1735660799999' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json'

        
This code block in the floating window

Request Header

Field Type Description
Authorization Bearer ${token} Use Authorization: Bearer ${token} for authentication. Get the key from the API Keys page as token.
Content-Type application/json Data type, set to application/json.

Request Body

Field Type Required Description
start_time String Yes Start time.
end_time String Yes End time.

Response

Response Example

{ "start_date": "2022-02-02", "end_date": "2022-02-03", "total": 100.0000, "chat": 10.0000, "knowledge_doc_indexing": 10.0000, "knowledge_doc_storage": 10.0000, "rerank": 10.0000, "database_processing": 10.0000, "tool_call": 10.0000, "asr": 10.0000, "tts": 10.0000 }
          {
    "start_date": "2022-02-02",
    "end_date": "2022-02-03",
    "total": 100.0000,
    "chat": 10.0000,
    "knowledge_doc_indexing": 10.0000,
    "knowledge_doc_storage": 10.0000,
    "rerank": 10.0000,
    "database_processing": 10.0000,
    "tool_call": 10.0000,
    "asr": 10.0000,
    "tts": 10.0000
}

        
This code block in the floating window

Success Response

Field Type Description
start_date String Start date.
end_date String End date.
total Number Total credits.
chat Number Credits consumed in text conversations.
knowledge_doc_indexing Number Credits consumed for knowledge document indexing.
knowledge_doc_storage Number Credits consumed for knowledge document storage.
rerank Number Credits consumed for reranking.
database_processing Number Credits consumed for database processing.
tool_call Number Credits consumed for tool calls.
asr Number Credits consumed for speech-to-text.
tts Number Credits consumed for text-to-speech.

Failure Response

Field Type Description
code Int Error code.
message String Error details.