Skip to main content

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

调用过程中遇到错误?请参阅 API 错误码参考 获取完整的错误类型说明与排查方案。
GET https://api.agipower.ai/v1/management/payg/balance
获取当前账号的 Pay As You Go 余额信息,包括总余额及各来源的 credit 明细。

鉴权

Authorization Header 必选

Authorization: Bearer <AGIPower_MANAGEMENT_API_KEY>
  • 参数名Authorization
  • 格式Bearer &lt;API_KEY&gt;
  • 说明:Management API Key,在 AGIPower 控制台 创建
本接口仅接受 Management API Key 鉴权,不支持普通 API Key。

限流

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

返回值

data.currency string

货币单位,固定为 "usd"

data.total_credits number

账号当前 PAYG 总余额(美元)。

data.top_up_credits number

通过充值获得的余额(美元)。

data.bonus_credits number

通过奖励、赠送等方式获得的余额(美元)。
total_credits = top_up_credits + bonus_credits(可能因浮点精度存在极小误差)。

GET /v1/management/payg/balance

curl https://api.agipower.ai/v1/management/payg/balance \
  -H "Authorization: Bearer $AGIPower_MANAGEMENT_API_KEY"
import requests

response = requests.get(
    "https://api.agipower.ai/v1/management/payg/balance",
    headers={"Authorization": f"Bearer {AGIPower_MANAGEMENT_API_KEY}"}
)
print(response.json())
const response = await fetch("https://api.agipower.ai/v1/management/payg/balance", {
  headers: { Authorization: `Bearer ${AGIPower_MANAGEMENT_API_KEY}` },
});
const data = await response.json();

API Response

{
  "success": true,
  "data": {
    "currency": "usd",
    "total_credits": 482.74,
    "top_up_credits": 35.00,
    "bonus_credits": 447.74
  }
}