# API Hạn mức & Thông tin Token

Use your **API Call Token (`sk-xxx`)** to query the current token's real-time quota, period consumption, call count usage, and access policy configuration.

> [!IMPORTANT]
> - **Base URL**: `https://ai.artsmcp.com`
> - **Auth Header**: `Authorization: Bearer sk-your_api_token` (also supports `x-api-key`, `x-goog-api-key`)
> - **Limit Convention**: `-1` means unlimited for quota and call count limits; `0` means unlimited for `rps_limit` / `rpm_limit`

---

### 1. Get Current Token Quota & Configuration

Retrieve the current `sk-xxx` token's basic info, rate/whitelist policy, total quota, daily/weekly/monthly period quotas, and call count usage.

* **Path**: `GET /v1/balance`
* **Query Parameters**: None
* **Example (Curl)**:

```bash
curl -s "https://ai.artsmcp.com/v1/balance" \
  -H "Authorization: Bearer sk-your_api_token"
```

* **Response Example**:

```json
{
  "success": true,
  "kid": "086421",
  "name": "prod-sub-key",
  "token_key": "sk-aB12cD34****xY89zW",
  "is_active": 1,
  "high_availability": 1,
  "rps_limit": 10,
  "rpm_limit": 300,
  "allowed_models": ["gpt-4o", "claude-sonnet-4-20250514"],
  "allowed_ips": "203.0.113.10,10.0.0.0/8",
  "quota_limit": 1000.0,
  "remain_balance": 985.42,
  "used_balance": 14.58,
  "unlimited_quota": false,
  "daily_quota_limit": 100.0,
  "daily_used_balance": 4.2,
  "daily_remain_balance": 95.8,
  "unlimited_daily_quota": false,
  "weekly_quota_limit": -1.0,
  "weekly_used_balance": 14.58,
  "weekly_remain_balance": -1.0,
  "unlimited_weekly_quota": true,
  "monthly_quota_limit": -1.0,
  "monthly_used_balance": 14.58,
  "monthly_remain_balance": -1.0,
  "unlimited_monthly_quota": true,
  "usage_limit": 5000,
  "usage_used": 120,
  "remain_count": 4880,
  "unlimited_count": false,
  "expires_at": "2026-12-31 23:59:59 (UTC+8)",
  "last_used_at": "2026-11-29 21:30:00 (UTC+8)",
  "created_at": "2026-11-01 10:00:00 (UTC+8)"
}
```

* **Response Fields**:

| Field | Type | Description |
| :--- | :--- | :--- |
| `success` | `boolean` | Whether the request succeeded (`true` on success) |
| `kid` | `string` | Unique token identifier (e.g., `086421`) |
| `name` | `string` | Token name |
| `token_key` | `string` | Masked token key (e.g., `sk-aB12cD34****xY89zW`) |
| `is_active` | `integer` | Token status (`1` active, `0` disabled, `2` disabled with account, `3` auto-disabled after inactivity) |
| `high_availability` | `integer` | High-availability toggle (`1` enabled, `0` disabled) |
| `rps_limit` | `integer` | Requests-per-second limit (`0` means unlimited) |
| `rpm_limit` | `integer` | Requests-per-minute limit (`0` means unlimited) |
| `allowed_models` | `string[]` | Allowed model ID whitelist (`[]` means unlimited) |
| `allowed_ips` | `string` | Allowed source IP / CIDR whitelist (comma-separated; empty string means unlimited) |
| `quota_limit` | `number` | Total quota limit (`-1` means unlimited) |
| `remain_balance` | `number` | Remaining total quota (`-1` when unlimited) |
| `used_balance` | `number` | Cumulative total quota used |
| `unlimited_quota` | `boolean` | Whether total quota is unlimited |
| `daily_quota_limit` | `number` | Daily quota limit (`-1` means unlimited) |
| `daily_used_balance` | `number` | Quota used in the current calendar day |
| `daily_remain_balance` | `number` | Remaining quota for the current day (`-1` when unlimited) |
| `unlimited_daily_quota` | `boolean` | Whether daily quota is unlimited |
| `weekly_quota_limit` | `number` | Weekly quota limit (`-1` means unlimited) |
| `weekly_used_balance` | `number` | Quota used in the current calendar week |
| `weekly_remain_balance` | `number` | Remaining quota for the current week (`-1` when unlimited) |
| `unlimited_weekly_quota` | `boolean` | Whether weekly quota is unlimited |
| `monthly_quota_limit` | `number` | Monthly quota limit (`-1` means unlimited) |
| `monthly_used_balance` | `number` | Quota used in the current calendar month |
| `monthly_remain_balance` | `number` | Remaining quota for the current month (`-1` when unlimited) |
| `unlimited_monthly_quota` | `boolean` | Whether monthly quota is unlimited |
| `usage_limit` | `integer` | Total call count limit (`-1` means unlimited) |
| `usage_used` | `integer` | Cumulative calls used |
| `remain_count` | `integer` | Remaining calls available (`-1` when unlimited) |
| `unlimited_count` | `boolean` | Whether call count is unlimited |
| `expires_at` | `string \| null` | Expiration timestamp in site operating timezone (`null` if never expires) |
| `last_used_at` | `string \| null` | Last used timestamp (`null` if never used) |
| `created_at` | `string` | Token creation timestamp in site operating timezone |
