# 청구

## 학점제도

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 형식의 생성 시간 |
