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

# 余额查询

> 查询账户余额信息

# 余额查询

查询当前账户的余额信息，包括可用余额、冻结余额等详细信息。

## 请求参数

无需请求参数。

## 响应参数

<ResponseField name="code" type="integer">
  响应码
</ResponseField>

<ResponseField name="msg" type="string">
  响应信息
</ResponseField>

<ResponseField name="data" type="object">
  余额数据

  <Expandable title="data">
    <ResponseField name="balance" type="number">
      充值余额
    </ResponseField>

    <ResponseField name="card_balance" type="number">
      算力卡余额
    </ResponseField>
  </Expandable>
</ResponseField>

## 代码示例

<CodeGroup>
  ```python Python theme={null}
  import requests

  url = "https://www.chenyu.cn/api/open/v2/balance/info"
  headers = {
      "Authorization": "Bearer your_api_key"
  }

  response = requests.get(url, headers=headers)
  result = response.json()

  if result['code'] == 0:
      balance_info = result['data']
      print(f"充值余额: {balance_info['balance']}")
      print(f"算力卡余额: {balance_info['card_balance']}")
  else:
      print(f"查询失败: {result['msg']}")
  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios');

  const url = 'https://www.chenyu.cn/api/open/v2/balance/info';
  const headers = {
      'Authorization': 'Bearer your_api_key'
  };

  axios.get(url, { headers })
      .then(response => {
          const result = response.data;
          
          if (result.code === 0) {
              const balanceInfo = result.data;
              console.log(`充值余额: ${balanceInfo.balance}`);
              console.log(`算力卡余额: ${balanceInfo.card_balance}`);
          } else {
              console.log(`查询失败: ${result.msg}`);
          }
      })
      .catch(error => {
          console.error('Error:', error.response.data);
      });
  ```

  ```curl cURL theme={null}
  curl -X GET "https://www.chenyu.cn/api/open/v2/balance/info" \
    -H "Authorization: Bearer your_api_key"
  ```
</CodeGroup>

## 响应示例

<CodeGroup>
  ```json 成功响应 theme={null}
  {
    "code": 0,
    "msg": "查询成功",
    "data": {
      "balance": 1250.50,
      "card_balance": 500.00
    }
  }
  ```

  ```json 失败响应 theme={null}
  {
    "code": -1,
    "msg": "查询失败"
  }
  ```
</CodeGroup>
