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

# Usage

> Track compute consumption and understand billing units.

Hexel bills for active compute. Understanding your usage helps you optimize cost and catch unexpected spend early — for example, spotting a runaway sandbox that's been executing in a loop.

Hexel Studio bills based on the compute your workloads consume. Usage is recorded per environment and available through the API, the CLI, and the Console.

## Billing units

| Unit                 | Measures                  | Definition                                                                                                                                                                    |
| -------------------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `compute_cpu_second` | Sandbox execution time.   | **1 unit = 1 second of 1 CPU worth of sandbox execution time.** Measured as wall-clock seconds the sandbox is active, normalized to CPU allocation.                           |
| `agent_compute_unit` | Agent instance workloads. | **1 unit = 1 second of active compute consumed by an agent instance**, normalized to its tier. Idle instances consume near-zero units (capacity is throttled, not torn down). |

### Reading a usage record

If your usage summary shows:

```json theme={"dark"}
{
  "unit": "compute_cpu_second",
  "quantity": 3600,
  "tier": "standard",
  "environment_id": "env_abc123"
}
```

This means: one `standard` sandbox ran for **1 hour** (3600 compute\_cpu\_second). The default sandbox TTL is 3600 seconds — an unreleased sandbox bills for its full TTL even if idle.

Idle agents cost very little (capacity is throttled rather than torn down), so you primarily pay for active processing.

## Check your usage

<Tabs>
  <Tab title="curl">
    ```bash theme={"dark"}
    # Detailed usage records
    curl https://api.hexelstudio.com/compute/v1/usage \
      -H "Authorization: Bearer $TOKEN"

    # Summary for the current period
    curl https://api.hexelstudio.com/compute/v1/usage/summary \
      -H "Authorization: Bearer $TOKEN"
    ```
  </Tab>
</Tabs>

<Note>
  For current pricing, see the [Console](https://console.hexelstudio.com) billing section and the pricing page. Rates are not duplicated here so the docs stay accurate over time.
</Note>

## Cost optimization

Billing follows active compute, so the levers are the work you run and the capacity you hold:

* **Release sandboxes promptly.** A sandbox bills until it's released or its TTL expires; don't hold idle sandboxes.
* **Right-size tiers.** Run on the smallest tier ([metrics](/docs/observability/metrics) confirm headroom) rather than over-provisioning.
* **Prefer `serverless`/`fluid` fleets for spiky traffic.** Reserve `always_on` capacity only for latency-critical workloads.
* **Attribute by environment.** Separate environments make it clear which workloads drive spend.

## Common mistakes

* **Leaving sandboxes allocated.** Release sandboxes when done; renewing keeps them billable.
* **Not attributing usage per environment.** Use separate environments to see where cost comes from.

## Best practices

* Review usage regularly in the Console or with the [usage API](/docs/billing/usage#check-your-usage).
* Release sandboxes promptly and right-size instance tiers.
* Separate environments to attribute and forecast cost.

## Related pages

<CardGroup cols={2}>
  <Card title="Tiers & Limits" icon="layer-group" href="/docs/billing/tiers-and-limits">
    Tier capacities and account limits.
  </Card>

  <Card title="Scaling" icon="up-right-and-down-left-from-center" href="/docs/compute/scaling">
    How capacity affects cost.
  </Card>

  <Card title="Metrics" icon="chart-line" href="/docs/observability/metrics">
    Relate performance to usage.
  </Card>

  <Card title="Sandboxes" icon="terminal" href="/docs/compute/sandboxes">
    Release to stop billing.
  </Card>
</CardGroup>
