Skip to content
Diese Seite ist noch nicht in Ihrer Sprache verfügbar und wird deshalb auf Englisch angezeigt.

Query User Balance

Query overall remaining and used credits of user account

Gesamte Dokumentation
GET/v1/user/balance
  • Get user-level balance information
  • CORS support for cross-origin requests
  • Real-time balance monitoring

Get the remaining and used balance of the current user account. This endpoint returns user-level balance information, independent of specific tokens, for viewing the overall account balance.

Anfragebeispiele

curl --request GET \
  --url 'https://api.apisea.ai/v1/user/balance' \
  --header 'Authorization: Bearer <token>'

Authorization

Authorizationstringrequired

All API endpoints require Bearer Token authentication

Get your API Key:

Visit the API Key Management Page to get your API Key

Add it to the request header:

text
Authorization: Bearer YOUR_API_KEY

Endpoints

text
GET /v1/user/balance
GET /user/balance

Both endpoints have the same functionality, you can use either one.

Response

successboolean

Whether the request was successful

messagestring

Error message (only returned on failure)

remain_balancefloat

User remaining balance (returned on success).

remain_creditsinteger

User remaining credits (returned on success).

used_balancefloat

User used balance (returned on success)

used_creditsfloat

User used credits (returned on success)

Token Balance vs User Balance

ComparisonToken Balance (/v1/balance)User Balance (/v1/user/balance)
ScopeSingle tokenEntire user account
Data SourceToken's RemainQuota and UsedQuotaUser's quota and used_quota
Use CaseMonitor single API Key usageView overall account balance
Limited ByToken-level quota limitsUser-level quota limits

Use Cases

  • View overall user account balance
  • Set up recharge reminders and balance alerts
  • Display account balance in user dashboard

Note

Balance Unit Information

The unit of the balance value depends on system configuration:

  • USD - US Dollars
  • CNY - Chinese Yuan
  • Tokens - Token count

Common Errors

Error MessageCauseSolution
No Authorization headerAuthorization header not providedAdd Authorization: Bearer sk-xxxxx header
Failed to get user quotaUser doesn't existCheck if the user associated with the token exists
Failed to get used quotaDatabase query errorContact admin to check system status

Warning

Security Note

Your API Key is like a password. Keep it secure and don't share it with others. Always use HTTPS in production.

Antworten

{
  "success": true,
  "remain_balance": 100.0,
  "remain_credits": 1000,
  "used_balance": 25.5,
  "used_credits": 255
}

Einen Fehler in dieser Dokumentation gefunden? Schreiben Sie an support@apisea.ai.