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

# CostGraph

> See your boxd spend in CostGraph, next to your cloud, Kubernetes and AI costs. CostGraph reads your boxd organization's usage once a day.

![The CostGraph mark and wordmark inside the boxd card.](https://mintcdn.com/azin/GaTnPsMKk-E3NfH9/images/boxd-x-costgraph.png?fit=max\&auto=format\&n=GaTnPsMKk-E3NfH9\&q=85\&s=14eb54ccba8ebbdd9be99f8d4a431081)

[CostGraph](https://costgraph.ai) brings cloud, Kubernetes, SaaS and AI costs into one view, so you can see what each team, workload or customer costs. Connect boxd, and your boxd spend shows up there next to everything else you pay for.

CostGraph reads your organization's boxd usage once a day, with a boxd API key. Nothing runs on your machines.

## Connect boxd

**1. Create a key for CostGraph**

On your computer, as an owner or admin of the organization:

```bash theme={"theme":"github-dark"}
boxd auth keys create costgraph --org <your-org>
```

The key (`bxd_…`) is printed once. Only owners and admins can see usage, so one of them has to create the key.

**2. Connect it in CostGraph**

In CostGraph, open [Integrations](https://app.costgraph.ai/integrations) and pick **boxd**. Name the connection, pick the tenant the cost belongs to, paste the key into `BOXD_API_KEY` and select **Connect**.

You can leave `BOXD_ORG` empty. A boxd key works in one organization only, so the key already says which one.

CostGraph checks the key with a short call before it saves the connection, so a wrong key fails on the form.

## What CostGraph reads

* **Your organization's usage.** What each machine cost: the same usage that `boxd manage usage` shows owners and admins ([usage and billing](https://docs.boxd.sh/cli/commands.md#usage-and-billing)).
* **Once a day.** CostGraph calls boxd on your behalf every day.
* **Next to your other providers.** Your boxd spend appears in CostGraph's cost overview and anomaly alerts, with every other provider you connected.

## The key

* **A boxd key is not read-only.** It acts as the person who created it, in one organization. CostGraph says it stores keys encrypted and uses them only to read billing data.
* **Give CostGraph its own key.** Then you can revoke it on its own, at any time, with `boxd auth keys remove costgraph`. The connection stops, and nothing else changes.
* **Keep the key yourself.** CostGraph also takes cost data that you push to it, so the key never leaves your infrastructure. See [Push FOCUS data](https://docs.costgraph.ai/costgraph/integrations/focus-push) in CostGraph's docs.

## Limits

* **Recent costs can still change.** boxd meters usage with a delay of up to 25 minutes, and a cost marked `(estimated)` can still grow.
* **Owners and admins only.** A key created by a member of the organization can't read its usage.

## Bring the cost down

When CostGraph shows a boxd cost you don't want:

* **Idle machines.** Turn on [auto-suspend and auto-hibernate](https://docs.boxd.sh/guides/suspend-resume.md). A machine with no traffic then stops using CPU and memory until a request wakes it.
* **Forgotten machines.** Give a machine a [delete timer](https://docs.boxd.sh/guides/delete-after.md) when you create it.
* **Machines that are too big.** Pick a smaller [machine size](https://docs.boxd.sh/guides/resources.md#machine-sizes).

## Read more

* [Integrations](https://docs.costgraph.ai/costgraph/integrations/overview) in CostGraph's docs
* [API keys](https://docs.boxd.sh/cli/authentication.md#api-keys): create, list and revoke boxd keys
* [Usage and billing](https://docs.boxd.sh/cli/commands.md#usage-and-billing): the same numbers in the boxd CLI


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.