> ## Documentation Index
> Fetch the complete documentation index at: https://apixo.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 系統 API：查詢帳戶、餘額和服務狀態

> 透過帳戶與系統 API 查詢餘額、檢視用量，並在程式中監控 APIXO 的服務狀態。

帳戶管理和系統資訊的端點。

## 當前餘額

查詢當前 API 金鑰對應帳戶的餘額。

### 端點

```
GET https://api.apixo.ai/api/v1/apikeys/current-balance
```

### 標頭

**Authorization** `string` *required*

用於 API 身分驗證的 Bearer 令牌。格式為 `Bearer YOUR_API_KEY`。

### 回覆

```json theme={null}
{
  "code": 200,
  "message": "success",
  "data": 74.8700
}
```

**code** `integer`

HTTP 狀態碼。

**message** `string`

狀態說明。

**data** `number`

當前 API 金鑰對應帳戶的剩餘餘額，單位為美元。

> [!TIP]
>
> 提交大批次任務前，先透過程式查詢餘額，以免任務執行到一半因餘額不足而失敗。

### 範例

> [tab] cURL
>
> ```bash theme={null}
> curl -X GET https://api.apixo.ai/api/v1/apikeys/current-balance \
>   -H "Authorization: Bearer YOUR_API_KEY"
> ```

> [tab] JavaScript
>
> ```javascript theme={null}
> const response = await fetch('https://api.apixo.ai/api/v1/apikeys/current-balance', {
>   method: 'GET',
>   headers: {
>     'Authorization': 'Bearer YOUR_API_KEY',
>   },
> });
>
> const data = await response.json();
> console.log('Balance:', data.data);
> ```

> [tab] Python
>
> ```python theme={null}
> import requests
>
> response = requests.get(
>     'https://api.apixo.ai/api/v1/apikeys/current-balance',
>     headers={'Authorization': 'Bearer YOUR_API_KEY'},
> )
>
> data = response.json()
> print(f"Balance: {data['data']}")
> ```

## 錯誤回應

請參閱 [錯誤](https://apixo.ai/docs/zh-hant/api-reference/errors.md) 以了解可能的 `401`、`403` 或 `429` 回應。

## 整合最佳實踐

* **提交前查詢餘額**：在系統初始化時或分發大批次生成任務前呼叫 `/apikeys/current-balance`，避免任務因餘額不足中途失敗。
* **餘額預警**：在後端服務中定期檢查餘額。餘額低於設定閾值時，傳送內部告警或觸發自動充值。
* **餘額快取**：查詢結果反映帳戶的實時餘額。多個生成任務程序之間應避免共用快取的餘額。

## 相關連結

* [API參考概述](https://apixo.ai/docs/zh-hant/api-reference.md)
* [批次任務生成](https://apixo.ai/docs/zh-hant/api-reference/batch-generate.md)
* [錯誤代碼與故障排除](https://apixo.ai/docs/zh-hant/api-reference/errors.md)
* [計費 Dashboard](https://apixo.ai/dashboard/billing)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.