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

# Costs

> Query compute spend, approval queue, and cost breakdown by GPU type and experiment.

# Costs API

The Costs API surfaces lab compute spend: GPU hours, LLM API calls, and storage. It also provides the live-burn view (pods currently running) and the approval queue (high-cost experiment requests awaiting Captain sign-off).

## Get Cost Summary

<ParamField query="labId" type="string" required>
  Convex ID of the lab.
</ParamField>

<CodeGroup>
  ```bash curl theme={null}
  curl "https://www.hubify.com/api/v1/costs?labId=$LAB_ID" \
    -H "Authorization: Bearer $HUBIFY_TOKEN"
  ```

  ```typescript TypeScript theme={null}
  const { summary, experiments } = await hubify.costs.get({ labId });
  ```
</CodeGroup>

<ResponseField name="summary" type="object" required>
  Aggregated cost data.

  <Expandable title="Summary fields">
    <ResponseField name="totalUsd" type="number">All-time spend in USD.</ResponseField>
    <ResponseField name="totalGpuHours" type="number">All-time GPU hours.</ResponseField>
    <ResponseField name="byGpu" type="object">Per-GPU-type breakdown: `{ "H200 SXM": { count, costUsd } }`.</ResponseField>

    <ResponseField name="liveRunning" type="object">
      Live pods currently burning compute.

      <Expandable title="Live running">
        <ResponseField name="podCount" type="number">Number of active pods.</ResponseField>
        <ResponseField name="costUsd" type="number">Accrued cost since each pod started.</ResponseField>
        <ResponseField name="hours" type="number">Total GPU hours running right now.</ResponseField>
        <ResponseField name="byGpu" type="object">Per-GPU live breakdown.</ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="experiments" type="object[]" required>
  Per-experiment cost records (most recent 200).

  <Expandable title="Cost record">
    <ResponseField name="experimentId" type="string">Linked experiment ID.</ResponseField>
    <ResponseField name="estimatedCostUsd" type="number">Estimated cost when submitted.</ResponseField>
    <ResponseField name="actualCostUsd" type="number">Final cost after completion.</ResponseField>
    <ResponseField name="gpuHours" type="number">GPU hours used.</ResponseField>
    <ResponseField name="approvalStatus" type="string">One of `pending_approval`, `approved`, `denied`, `auto_approved`.</ResponseField>
    <ResponseField name="createdAt" type="number">Unix ms.</ResponseField>
  </Expandable>
</ResponseField>

<Tip>
  The `liveRunning.costUsd` field is derived at query time from running pods' hourly rates. It shows your current exposure even before experiments complete.
</Tip>
