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

# ClickHouse Billing Setup

> Connect ClickHouse Cloud billing data to Costory to analyze compute, storage, and data transfer costs.

<Tabs>
  <Tab title="Terraform">
    Not supported.
  </Tab>

  <Tab title="Manual setup">
    Open Costory and go to **Billing > Import new billing datasource > ClickHouse**. The stepper guides you through each field.

    1. Generate a **ClickHouse Cloud API Key** and Secret with billing/organization read access.
    2. Provide your **Organization ID**, **API Key**, and **API Secret** in the Costory stepper.

    On first sync, Costory backfills historical usage and service data.
  </Tab>
</Tabs>

**What Costory includes**

Costory ingests your daily usage metrics and translates them directly into standardized FinOps dimensions.

* **Compute & Storage costs:** Direct visibility into `computeCHC`, `storageCHC`, and `backupCHC` charges.
* **Data Transfer metrics:** Breakdown of networking costs including `dataTransferCHC`, `publicDataTransferCHC`, and `interRegion` tier transfers.
* **Service & Resource context:** Breakdowns by `dataWarehouseId`, `serviceId`, environment `state`, and `provider`.
* **Custom Tags:** Any service tags applied in ClickHouse are automatically ingested as Costory labels (prefixed with `clickhouse_`).

**What Costory does not include**

* **ClickHouse Open Source / Self-managed:** Only ClickHouse Cloud is supported.
* **Taxes and support fees:** Non-usage invoice items are not currently mapped from the usage metrics API.

**How to analyze ClickHouse costs**

* **Per-Service or per-Cluster spend:** Group by **Resource name** (Service display name) or **Resource ID** (`entityId`).
* **Spend by Metric:** Group by **SKU** to compare `compute`, `storage`, and `dataTransfer` costs.
* **By Environment:** Group by the `service_state` label or any custom `clickhouse_*` labels you have defined in your infrastructure.

<Note>
  ClickHouse metrics are recorded in ClickHouse Credits (`CHC`) and converted to standard currency representation. Costory normalizes these values so they can be seamlessly blended with your AWS, GCP, and Azure spend.
</Note>
