# Credit 計費

Blockchain Atlantis 採 **credit（點數）** 制計費。每把 API key 有自己的 credit 餘額，呼叫服務時依端點的成本權重扣點。

## 核心原則

{% hint style="success" %}
**只有成功（HTTP 2xx）的回應才扣 credit。** 任何錯誤回應（4xx／5xx）都不扣點。
{% endhint %}

* 每個端點有各自的**成本權重**（cost）。讀取類愈輕、運算類愈重。
* 管理／健康檢查類端點成本為 **0**（免費）。
* 扣點後，回應 header 與 `meta` 會即時告訴你成本與餘額。

## 如何得知本次花費

成功回應會帶上：

| 來源     | 欄位                   | 意義           |
| ------ | -------------------- | ------------ |
| Header | `X-Credit-Cost`      | 本次扣除的 credit |
| Header | `X-Credit-Remaining` | 扣除後剩餘餘額      |
| `meta` | `credit_cost`        | 同上（信封內版本）    |
| `meta` | `credit_remaining`   | 同上           |

```json
{
  "data": { "...": "..." },
  "meta": { "credit_cost": 5, "credit_remaining": 9995 }
}
```

## 餘額不足

當餘額不足以支付某次請求時，回傳 `402 insufficient_credit`：

```json
{
  "error": {
    "code": "insufficient_credit",
    "message": "insufficient credit: required 5, remaining 2"
  }
}
```

請聯絡你方管理員加值（見[管理後台](/documentation/cao-zuo-zhi-nan/admin-console.md)），加值後即可繼續呼叫。

## 對帳

每筆扣點都會寫入**帳本**（append-only），並記錄對應的 `request_id`、端點與扣點後餘額，可供事後對帳與稽核。如需用量明細，請洽你的客戶經理。

{% hint style="info" %}
**小技巧：** 在每次回應後讀取 `X-Credit-Remaining`，即可在自己的系統中即時掌握餘額，於低水位時提前告警。
{% endhint %}

## 下一步

{% content-ref url="/pages/JTozQ5Gb9ly2bavrljBP" %}
[分頁](/documentation/he-xin-gai-nian/pagination.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.blockchainsecurity.asia/documentation/he-xin-gai-nian/credit-billing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
