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

# 接口

# Get PAYG Balance

> [!TIP]
>
> 调用过程中遇到错误？请参阅 [API 错误码参考](https://docs.agipower.ai/zh/guide/advanced/error-codes) 获取完整的错误类型说明与排查方案。

```
GET https://api.agipower.ai/v1/management/payg/balance
```

获取当前账号的 Pay As You Go 余额信息，包括总余额及各来源的 credit 明细。

## 鉴权

### Authorization Header **必选**

```http theme={null}
Authorization: Bearer <AGIPower_MANAGEMENT_API_KEY>
```

* **参数名**：`Authorization`
* **格式**：`Bearer &lt;API_KEY&gt;`
* **说明**：Management API Key，在 [AGIPower 控制台](https://agipower.ai/platform/management) 创建

> [!WARNING]
>
> 本接口仅接受 Management API Key 鉴权，不支持普通 API Key。

## 限流

每个接口独立计数，每分钟最大请求数由平台统一配置。超出限制时返回 `422` 错误。

## 返回值

### data.currency `string`

货币单位，固定为 `"usd"`。

### data.total\_credits `number`

账号当前 PAYG 总余额（美元）。

### data.top\_up\_credits `number`

通过充值获得的余额（美元）。

### data.bonus\_credits `number`

通过奖励、赠送等方式获得的余额（美元）。

> [!NOTE]
>
> `total_credits` = `top_up_credits` + `bonus_credits`（可能因浮点精度存在极小误差）。

> [card] GET /v1/management/payg/balance
>
> ```cURL theme={null}
> curl https://api.agipower.ai/v1/management/payg/balance \
>   -H "Authorization: Bearer $AGIPower_MANAGEMENT_API_KEY"
> ```
>
> ```python theme={null}
> import requests
>
> response = requests.get(
>     "https://api.agipower.ai/v1/management/payg/balance",
>     headers={"Authorization": f"Bearer {AGIPower_MANAGEMENT_API_KEY}"}
> )
> print(response.json())
> ```
>
> ```javascript theme={null}
> const response = await fetch("https://api.agipower.ai/v1/management/payg/balance", {
>   headers: { Authorization: `Bearer ${AGIPower_MANAGEMENT_API_KEY}` },
> });
> const data = await response.json();
> ```

> [card] API Response
>
> ```json theme={null}
> {
>   "success": true,
>   "data": {
>     "currency": "usd",
>     "total_credits": 482.74,
>     "top_up_credits": 35.00,
>     "bonus_credits": 447.74
>   }
> }
> ```


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