Query: Account Information
Short description: Retrieve account details including available quota, used quota, total request count, and more.
Overview
- Method:
GET - Path:
/api/user/self - Content-Type:
application/json
Authentication
- Header:
Authorization: Bearer <token> - Header:
X-Api-User: <user_id>(optional)
Request Example
Headers
| Header | Example | Required |
|---|---|---|
| Authorization | Bearer sk-xxxx | Yes |
| X-Api-User | 0 | No |
curl Example
bash
curl -X GET "https://api.gpt.ge/api/user/self" \
-H "Authorization: Bearer sk-xxxx" \
-H "X-Api-User: 0"JavaScript (fetch) Example
javascript
fetch('https://api.gpt.ge/api/user/self', {
method: 'GET',
headers: {
'Authorization': 'Bearer sk-xxxx',
'X-Api-User': '0'
}
}).then(r => r.json()).then(console.log);Python (requests) Example
python
import requests
url = 'https://api.gpt.ge/api/user/self'
headers = {
'Authorization': 'Bearer sk-xxxx',
'X-Api-User': '0'
}
response = requests.get(url, headers=headers)
print(response.json())Response Example (200)
json
{
"data": {
"id": 123,
"username": "user@example.com",
"password": "******",
"display_name": "User Name",
"role": 1,
"status": 1,
"email": "user@example.com",
"github_id": "",
"wechat_id": "",
"oidc_id": "",
"google_id": "",
"verification_code": "",
"access_token": null,
"quota": 500000,
"used_quota": 100000,
"request_count": 42,
"group": "default",
"can_use_self_group": false,
"aff_code": "",
"inviter_id": 0,
"aff_count": 0,
"aff_quota": 0,
"aff_history_quota": 0,
"created_at": 1700000000,
"last_login_at": 1700001000,
"last_login_ip": "1.2.3.4",
"deleted_at": null,
"group_ratio": 100,
"topup_ratio": 100
},
"message": "success",
"success": true
}Note: Divide
quotaandused_quotaby 500000 to determine the actual usage values.