Skip to content

8. Logs (Log) ​

8.1 List All Logs ​

Endpoint: GET /api/log/

Auth: Admin

Query parameters:

ParameterTypeDescription
pintPage number, default 0
typeintLog type: 0=all, 1=topup, 2=consume, 3=admin, 4=system
start_timestampint64Start timestamp
end_timestampint64End timestamp
model_namestringFilter by model name
usernamestringFilter by username
token_namestringFilter by token name
channelintFilter by channel ID
groupstringFilter by group

Response fields:

FieldTypeDescription
idintLog ID
user_idintUser ID
created_atint64Created at
typeintLog type
contentstringLog content
usernamestringUsername
token_namestringToken name
model_namestringModel name
quotaintQuota consumed
prompt_tokensintInput tokens
completion_tokensintOutput tokens
cached_tokensintCached tokens
channel_idintChannel ID
request_idstringRequest ID
elapsed_timeint64Elapsed time (ms)
is_streamboolWhether the response is streaming
billing_sourceintBilling source: 0=normal, 1=subscription
plan_idintPlan ID
session_keystringSession key

8.2 Get Self Logs ​

Endpoint: GET /api/log/self

Auth: User

8.3 Search Logs ​

Endpoint: GET /api/log/search

Auth: Admin

Endpoint: GET /api/log/self/search

Auth: User

Query parameters:

ParameterTypeDescription
keywordstringSearch keyword
typeintLog type (optional)

8.4 Log Statistics ​

Endpoint: GET /api/log/stat

Auth: Admin

Endpoint: GET /api/log/self/stat

Auth: User

8.5 Delete Historical Logs ​

Endpoint: DELETE /api/log/

Auth: Admin

Query parameters:

ParameterTypeDescription
target_timestampint64Delete logs older than this timestamp

Response:

json
{
  "success": true,
  "message": "",
  "data": 100
}

data is the number of deleted log rows.