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

# Usage

> Judge spend and run counts for a period

Net Judge spend, broken down by service type, plus saved-run counts by kind.

Refunds are already netted off: a failed run appears as a charge and a matching refund, and contributes nothing to `net_spend_usd`.

## Request

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token — **your standard 60db API key** (`sk_…`), or a user JWT. There is no separate Judge credential.
</ParamField>

### Query parameters

<ParamField query="period" type="string" default="current_month">
  `current_month`, `last_30_days` or `all_time`. An unrecognised value falls back to `current_month`.
</ParamField>

## Response

<ResponseField name="data.total" type="object">
  `net_spend_usd`, `operations` (billed calls) and `refunds`.
</ResponseField>

<ResponseField name="data.by_service" type="object">
  Keyed by `JUDGE_EVALUATE`, `JUDGE_EXTRACT` and their `_REFUND` twins. `gross_units` is input tokens.
</ResponseField>

<ResponseField name="data.by_kind" type="object">
  Saved-run counts per kind, with question totals and average lowest-confidence. A run sent with `save: false` is billed but never stored, so these can trail `by_service`.
</ResponseField>

## Example

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET https://api.60db.ai/judge/usage?period=current_month \
    -H "Authorization: Bearer your-api-key"
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.60db.ai/judge/usage?period=current_month', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer your-api-key',
    },
  });
  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.60db.ai/judge/usage?period=current_month",
      headers={
          "Authorization": "Bearer your-api-key",
      },
  )
  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true,
    "data": {
      "period": "current_month",
      "workspace_id": 47,
      "total": {
        "net_spend_usd": 0.004311,
        "operations": 50,
        "refunds": 9
      },
      "by_service": {
        "JUDGE_EVALUATE": {
          "net_spend_usd": 0.005811,
          "gross_units": 10724,
          "operation_count": 35,
          "refund_count": 0
        },
        "JUDGE_EVALUATE_REFUND": {
          "net_spend_usd": -0.002004,
          "gross_units": 0,
          "operation_count": 0,
          "refund_count": 9
        },
        "JUDGE_EXTRACT": {
          "net_spend_usd": 0.000504,
          "gross_units": 395,
          "operation_count": 15,
          "refund_count": 0
        }
      },
      "by_kind": {
        "evaluate": {
          "runs": 22,
          "questions": 51,
          "input_tokens": 1573,
          "avg_min_confidence": 0.4785
        },
        "extract": {
          "runs": 15,
          "questions": 0,
          "input_tokens": 0,
          "avg_min_confidence": 0.61
        }
      }
    }
  }
  ```
</ResponseExample>
