# 請求

## クレジット制度

Tripo API は、請求にクレジットを使用します。タスクの種類が異なれば、消費するクレジット数も異なります。

## クレジット凍結/Deductionモデル

| ステージ | 説明 |
| :-: | :-: |
| タスクの作成 | 利用可能な残高から必要なクレジットを凍結します |
| タスクは成功しました | 凍結されたクレジットは消費されたクレジットとなり、正式に差し引かれます |
| タスクが失敗する | 凍結されたクレジットは利用可能な残高に戻されます |
| タスクがキャンセルされました | 凍結されたクレジットは利用可能な残高に戻されます |

失敗したタスクやキャンセルされたタスクには料金はかかりません。

## クエリバランス

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

### 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 response = await fetch("https://openapi.tripo3d.ai/v3/account/balance", {
  headers: {
    "Authorization": "Bearer {api_key}"
  }
});

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

### 応答例

```json
{
  "code": 0,
  "data": {
    "balance": 10000,
    "frozen": 200
  }
}
```

| フィールド | 種類 | 説明 |
| :-: | :-: | :-: |
| balance | 整数 | 利用可能なクレジット残高 |
| frozen | 整数 | 進行中のタスクに対して事前に承認された凍結されたクレジット |

## 使用状況の表示

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

### 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 response = await fetch("https://openapi.tripo3d.ai/v3/account/usage", {
  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,
      "created_at": "2026-01-01T00:00:00Z"
    }
  ]
}
```

| フィールド | 種類 | 説明 |
| :-: | :-: | :-: |
| task_id | 文字列 | 一意のタスク識別子 |
| type | 文字列 | タスクの種類 |
| credits_consumed | 整数 | 消費されたクレジット |
| created_at | 文字列 | 作成時間 (ISO 8601 形式) |
