# アカウント管理

## クエリバランス

> **GET** `/v3/account/balance`

現在のアカウントのクレジット残高を照会します。

### リクエストパラメータ

#### リクエストヘッダー

| パラメータ | 種類 | 必須 | デフォルト | 説明 |
| :-: | :-: | :-: | :-: | :-: |
| Authorization | 文字列 | はい | — | `Bearer {api_key}` |

#### リクエスト例

##### curl

```bash
curl -X GET https://openapi.tripo3d.ai/v3/account/balance \
  -H "Authorization: Bearer {api_key}"
```

##### Python

```python
import requests

url = "https://openapi.tripo3d.ai/v3/account/balance"
headers = {
    "Authorization": "Bearer {api_key}"
}

response = requests.get(url, headers=headers)
print(response.json())
```

##### JavaScript

```javascript
const url = "https://openapi.tripo3d.ai/v3/account/balance";

const response = await fetch(url, {
  headers: {
    "Authorization": "Bearer {api_key}"
  }
});

const data = await response.json();
console.log(data);
```

### 応答

#### 成功した応答

```json
{
  "code": 0,
  "data": {
    "balance": 10000.00,
    "frozen": 200.00
  }
}
```

#### 応答フィールド

| パラメータ | 種類 | 説明 |
| :-: | :-: | :-: |
| code | 整数 | ステータスコード。 `0` は成功を示します |
| data.balance | number | 利用可能なクレジット残高 |
| data.frozen | number | 進行中のタスク用に予約された凍結されたクレジット |

---

## 使用状況の詳細をクエリする

> **GET** `/v3/account/usage`

アカウントのクレジット使用量の詳細を照会します。

### リクエストパラメータ

#### リクエストヘッダー

| パラメータ | 種類 | 必須 | デフォルト | 説明 |
| :-: | :-: | :-: | :-: | :-: |
| Authorization | 文字列 | はい | — | `Bearer {api_key}` |

#### リクエスト例

##### curl

```bash
curl -X GET https://openapi.tripo3d.ai/v3/account/usage \
  -H "Authorization: Bearer {api_key}"
```

##### Python

```python
import requests

url = "https://openapi.tripo3d.ai/v3/account/usage"
headers = {
    "Authorization": "Bearer {api_key}"
}

response = requests.get(url, headers=headers)
print(response.json())
```

##### JavaScript

```javascript
const url = "https://openapi.tripo3d.ai/v3/account/usage";

const response = await fetch(url, {
  headers: {
    "Authorization": "Bearer {api_key}"
  }
});

const data = await response.json();
console.log(data);
```

### 応答

#### 成功した応答

```json
{
  "code": 0,
  "data": [
    {
      "task_id": "task_abc123",
      "type": "text_to_model",
      "credits_consumed": 100.00,
      "created_at": "2025-01-01T00:00:00Z"
    }
  ]
}
```

#### 応答フィールド

| パラメータ | 種類 | 説明 |
| :-: | :-: | :-: |
| code | 整数 | ステータスコード。 `0` は成功を示します |
| data | 配列 | 利用明細一覧 |
| データ[].task_id | 文字列 | 一意のタスク識別子 |
| データ[].type | 文字列 | タスクの種類 |
| データ[].credits_consumed | number | 消費されたクレジット |
| データ[].created_at | 文字列 | 作成時刻 (ISO 8601) |
