Skip to content

Query Personal Account Usage ​

Endpoint Path ​

http
GET /api/open/data/self

Quota Calculation ​

quota is an internal unit. Convert to CNY as follows:

Amount (¥) = quota ÷ quota_per_unit × usd_exchange_rate

Where:

  • quota: from data[].quota returned by this endpoint
  • quota_per_unit, usd_exchange_rate, quota_display_type: from Query Conversion Parameters (GET /api/open/status)

If quota_display_type = USD, omit × usd_exchange_rate.

Request Parameters ​

FieldTypeRequiredDescriptionConstraintsRemarks
start_timestampint64NoStart timestamp (seconds)Used with end_timestampExample: 1711468800
end_timestampint64NoEnd timestamp (seconds)Used with start_timestampExample: 1712073600

Time Range Rules ​

ScenarioBehavior
No time parametersDefaults to the last 7 days
Only start_timestampend_timestamp is set to the current time
Only end_timestampstart_timestamp is set to 7 days before the current time
Span exceeds 31 daysReturns error: time span cannot exceed 31 days

Request Example ​

json
GET 'https://neolink.com/backend/api/open/data/self?start_timestamp=1711468800&end_timestamp=1712073600'

Return Information ​

FieldTypeRequiredDescriptionRemarks
successboolYesWhether the request succeeded-
messagestringYesError message (empty on success)Translated per X-Accept-Language
data[]QuotaDataItemYesQuota statistics arrayAggregated by time + model; see table below

QuotaDataItem Object (data array element)

FieldTypeRequiredDescriptionRemarks
idintYesQuota data record ID-
user_idintYesUser ID-
usernamestringYesUsername-
model_namestringYesModel codeConverted model code (not raw model name)
created_atint64YesStatistics timestamp (seconds)Hour precision; Unix timestamp
token_usedintYesTokens consumed for this model in the period-
countintYesCall count for this model in the period-
quotaintYesQuota consumed for this model in the periodInternal quota units; see Quota Calculation above
token_idintYesAssociated Token ID0 = not associated (e.g. direct user account)

Response Example ​

json
Success response
{
  "success": true,
  "message": "",
  "data": [
    {
      "id": 1,
      "user_id": 100,
      "username": "john_doe",
      "model_name": "gpt-4",
      "created_at": 1711497600,
      "token_used": 12500,
      "quota": 62500,
      "count": 25,
      "token_id": 0
    },
    {
      "id": 2,
      "user_id": 100,
      "username": "john_doe",
      "model_name": "gpt-3.5-turbo",
      "created_at": 1711497600,
      "token_used": 50000,
      "quota": 25000,
      "count": 100,
      "token_id": 0
    }
  ]
}
Error response
{
  "success": false,
  "message": "Time span cannot exceed 31 days"
}