Skip to Content

get token usage - GetUMInferTokenUsage

Overview

Get the token usage of a specific model under a specific key

Definition

Public Parameters

Parameter NameTypeDescription InformationRequired
ActionstringCorresponding API command name, the current API is GetUMInferTokenUsage.Yes
PublicKeystringThe user’s public key can be obtained from Console Yes
SignaturestringUser signature generated based on public key and API command, see Signature AlgorithmYes

Request Parameters

Parameter NameTypeDescription InformationRequired
ProjectIdstringProject ID. Leave it blank for the default project. Sub-accounts must fill in. Please refer to the GetProjectList APIYes
KeyIdstringapikey’s idYes
ModelstringModel NameYes
StartTimeintStart TimestampYes
EndTimeintEnd TimestampYes

Response Field

Field NameTypeDescription InformationRequired
RetCodeintReturn status code. If it is 0, it means successful return. If it is not 0, it means failure.Yes
ActionstringOperation command name.Yes
MessagestringReturns an error message, providing detailed description when RetCode is non-zero.No
DataTokenUsagetoken usage detailYes

Data Model

TokenUsage

Field NameTypeDescription InformationRequired
TotalintTotal Token CountNo
InTotalintOutput Total TokenNo
OutTotalintTotal Output TokensNo
ImageGenerationNuminttotal image generation numsNo
RequestTotalinttotal request countNo
Usagesarray[TokenUsageTimestamp]Token usage per timestampNo

TokenUsageTimestamp

Field NameTypeDescription InformationRequired
TypestringType, in Input out Output total TotalNo
CountintQuantityNo
TimestampintUnix timestampNo
ModelstringModel NameNo

Example

Request Example

https://api.surfercloud.com/?Action=GetUMInferTokenUsage &KeyId=MBMtLxzV &Model=RVLhTXwV &StartTime=9 &EndTime=2 &ProjectId=pPuXjEjZ &ProjectId=YyoGQFzG

Response Example

{ "Action": "GetUMInferTokenUsageResponse", "Data": {}, "RetCode": 0 }