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

# Billing

> Credits, subscription plans, allowances, and Stripe payments.

# Billing

Faces uses a credit-based billing system. Choices, chat, decisions and compiles are billed against your plan's allowance, then your credit balance, in real time. Each plan's allowances are shared across all your faces.

***

## Check your balance

```bash theme={null}
curl https://api.faces.sh/v1/billing/balance \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```json theme={null}
{
  "iam_id": "b2b97838-...",
  "balance_usd": 12.45,
  "frozen": false,
  "has_payment_method": true,
  "is_active": true
}
```

***

## Subscription plans

| Plan | Price | Compile allowance | Choices and steering allowance | ChatGPT link |
| - | - | - | - | - |
| Free | \$0 | none: pay as you go | none: pay as you go | |
| Connect | \$17/mo | 500k source tokens/month | 25M tokens/month | interviews, style builds, Codex-eligible chat models |
| Pro | \$49/mo | 1.5M source tokens/month | 75M tokens/month | interviews, style builds, Codex-eligible chat models |

A subscription is an **allowance**, not a fee per request: compiling, [choices](https://docs.headwaters.ai/guides/choices.md)
and the **steering** of [chat](https://docs.headwaters.ai/guides/chat.md) and [decisions](https://docs.headwaters.ai/guides/decisions.md) (the upstream
model, `@alice:maestro-1`) are covered up to the plan's limits (see [Allowances](#allowances)).
The **downstream model** (the chat or decision model after the `/`) is paid as it goes on every
plan, at the model's listed price plus 5%. See [Naming a model](https://docs.headwaters.ai/guides/models.md).

On the **Free** plan everything is paid as it goes, from your credit balance, at the
[pay-as-you-go rates](#pay-as-you-go-rates).

On **Connect** and **Pro**, you can link your ChatGPT account via OAuth (device-code flow), and
[interviews](https://docs.headwaters.ai/guides/compile.md#interview-threads) and [style builds](https://docs.headwaters.ai/guides/style.md) run on your
ChatGPT plan instead of credits, and so does a Codex-eligible downstream model on chat at
`/v1/responses`. See [Connect ChatGPT](https://docs.headwaters.ai/guides/oauth.md).

### Get current subscription

```bash theme={null}
curl https://api.faces.sh/v1/billing/subscription \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```json theme={null}
{
  "plan": "pro",
  "status": "active",
  "face_count": 4,
  "face_limit": null,
  "current_period_end": "2026-06-05T13:13:23",
  "is_active": true,
  "cancel_at_period_end": false,
  "allowances": {
    "upstream_5h":    {"limit": 4800000,  "used": 64227,   "remaining": 4735773,  "resets_at": null},
    "upstream_week":  {"limit": 18750000, "used": 940551,  "remaining": 17809449, "resets_at": "2026-11-21T10:53:13"},
    "upstream_month": {"limit": 75000000, "used": 7191060, "remaining": 67808940, "resets_at": "2026-11-23T10:53:13"},
    "compile_month": {"limit": 1500000,  "used": 771403,  "remaining": 728597,   "resets_at": "2026-11-23T10:53:13"}
  },
  "rates": {
    "steering_usd_per_million_input_tokens": 0.42,
    "steering_usd_per_call": 0.00042,
    "choices_usd_per_million_input_tokens": 0.42,
    "choices_usd_per_million_output_tokens": 1.0,
    "compaction_usd_per_million_tokens": 0.75,
    "compile_usd_per_million_source_tokens": 16.0,
    "compile_rush_usd_per_million_source_tokens": 21.0,
    "model_markup": 0.05
  }
}
```

`cancel_at_period_end` is `true` once the user has called the cancel endpoint and is still inside the paid period; use it to render "Connect ends on `current_period_end`" UI. The plan stays `"connect"` and `status` stays `"active"` until period end; only `cancel_at_period_end` flips.

`allowances` is `null` on the Free plan. `rates` are the [pay-as-you-go rates](#pay-as-you-go-rates): `maestro-1`'s for steering and choices, compacting, and compiling. To read them without a key, use [`GET /v1/rates`](#current-rates) rather than hard-coding them.

### Allowances

| | Connect | Pro |
| - | - | - |
| Compile, per month | 500k source tokens | 1.5M source tokens |
| Choices and steering, per month | 25M tokens | 75M tokens |
| Choices and steering, per week | 6.25M | 18.75M |
| Choices and steering, per 5 hours (rolling) | 1.6M | 4.8M |

The choices and steering allowance is `upstream_5h`, `upstream_week` and `upstream_month` in
[`GET /v1/billing/subscription`](#get-current-subscription).

**What counts:**

* **Compile:** the source's tokens, **each time** it is compiled. A recompile, or a
  decompile followed by a compile, counts again.
* **Choices:** the call's `usage.input_tokens`, the input tokens it processed. On
  `maestro-1-flash` with a question, they count 10 times. See [Choices](https://docs.headwaters.ai/guides/choices.md#cost).
* **Steering** on [chat](https://docs.headwaters.ai/guides/chat.md) and [decisions](https://docs.headwaters.ai/guides/decisions.md): the input tokens
  it processed, **plus 1,000** per call (the fixed fee, counted as the tokens it buys). On
  `maestro-1-flash`, they count 10 times.
* **Compacting** a [state](https://docs.headwaters.ai/guides/states.md#compact): the tokens it read and wrote.
* **The downstream model** is not part of the allowance: it is paid at the model's listed
  price plus 5%.

**Resets:** the month is your subscription's 30-day window; weeks are 7-day blocks of it;
the 5-hour window rolls.

**When a limit is reached,** your `api_fallback` preference decides:

* **on:** the work carries on and is paid from your credits at the pay-as-you-go rates.
  With no credit it is a `402`.
* **off:** it is refused with `429`, and nothing is charged. The message names the limit
  and when it resets. A compile is refused before it starts.

### Current rates

Every rate, plan price, allowance, input limit and rate limit on this page, as the API bills and enforces
them, is at one public endpoint. No API key is needed. Read them from there rather
than hard-coding them:

```bash theme={null}
curl https://api.faces.sh/v1/rates
```

```json theme={null}
{
  "object": "rates",
  "currency": "usd",
  "compaction": {
    "usd_per_million_tokens": 0.75
  },
  "compile": {
    "usd_per_million_source_tokens": 16.0,
    "rush_usd_per_million_source_tokens": 21.0
  },
  "upstream": {
    "maestro-1": {
      "choices": {
        "usd_per_million_input_tokens": 0.42,
        "usd_per_million_output_tokens": 1.0,
        "token_basis": "processed",
        "endpoints": [
          "/v1/choices"
        ]
      },
      "steering": {
        "usd_per_million_input_tokens": 0.42,
        "usd_per_call": 0.00042,
        "usd_per_million_output_tokens": 0.0,
        "token_basis": "processed",
        "endpoints": [
          "/v1/decisions",
          "/v1/systemone",
          "/v1/chat/completions",
          "/v1/responses",
          "/v1/messages"
        ]
      }
    },
    "maestro-1-flash": {
      "choices": {
        "usd_per_million_input_tokens": 4.2,
        "usd_per_million_output_tokens": 10.0,
        "token_basis": "processed",
        "endpoints": [
          "/v1/choices"
        ]
      },
      "steering": {
        "usd_per_million_input_tokens": 4.2,
        "usd_per_call": 0.0042,
        "usd_per_million_output_tokens": 0.0,
        "token_basis": "processed",
        "endpoints": [
          "/v1/decisions",
          "/v1/systemone",
          "/v1/chat/completions",
          "/v1/responses",
          "/v1/messages"
        ]
      }
    }
  },
  "downstream": {
    "markup": 0.05,
    "prices": "/v1/models?kind=chat,decision"
  },
  "models": {
    "markup": 0.05,
    "prices": "/v1/models"
  },
  "plans": {
    "free": {
      "usd_per_month": 0,
      "allowances": null
    },
    "connect": {
      "usd_per_month": 17,
      "allowances": {
        "upstream_tokens_per_5_hours": 1600000,
        "upstream_tokens_per_week": 6250000,
        "upstream_tokens_per_month": 25000000,
        "compile_source_tokens_per_month": 500000
      }
    },
    "pro": {
      "usd_per_month": 49,
      "allowances": {
        "upstream_tokens_per_5_hours": 4800000,
        "upstream_tokens_per_week": 18750000,
        "upstream_tokens_per_month": 75000000,
        "compile_source_tokens_per_month": 1500000
      }
    }
  },
  "limits": {
    "chat": {
      "max_message_tokens": 30000,
      "max_request_tokens": 62000,
      "face_block_tokens": 5000,
      "steering_reads_at_most_tokens": 30000,
      "subscription_steering_reads_at_most_tokens": 10000
    },
    "decisions": {
      "jev-latest": {
        "max_state_plus_longest_question_tokens": 24600,
        "max_request_tokens": 50200
      },
      "clef": {
        "max_state_plus_longest_question_tokens": 14000,
        "max_request_tokens": 14000
      },
      "clef-flash": {
        "max_state_plus_longest_question_tokens": 14000,
        "max_request_tokens": 14000
      },
      "face": {
        "max_state_plus_longest_question_tokens": 30000,
        "max_request_tokens": 62000
      }
    },
    "requests_per_minute": {
      "free": 30,
      "connect": 60,
      "pro": 120
    }
  }
}
```

* `upstream` holds each maestro's prices: `choices`, on [`/v1/choices`](https://docs.headwaters.ai/guides/choices), per
  million input and output tokens processed; and `steering`, on [chat](https://docs.headwaters.ai/guides/chat.md) and
  [decisions](https://docs.headwaters.ai/guides/decisions.md), per million input tokens processed plus `usd_per_call`, with
  no output charge.
* `downstream.markup` is what is added to a downstream model's own price; per-model prices are
  in [`GET /v1/models`](https://docs.headwaters.ai/guides/models#listing-the-models). `models` is the same, under its
  earlier name.
* `compaction` is the rate a [compaction](https://docs.headwaters.ai/guides/states.md#compact) is billed at.
* `compile` is the compile rate, and `plans` each plan's price and allowances
  (`upstream_tokens_*` is the choices and steering allowance).
* `limits.chat` is the size limit on [chat](https://docs.headwaters.ai/guides/chat.md#limits-on-a-face) with a face, and
  `limits.decisions` on [decisions](https://docs.headwaters.ai/guides/decisions.md#limits). `limits.requests_per_minute` is the
  per-account [rate limit](https://docs.headwaters.ai/errors.md#rate-limits) by plan. Your own usage against the allowances is in `GET /v1/billing/subscription`.

### Pay-as-you-go rates

On the Free plan, and past a subscription's limits with `api_fallback` on:

| | rate |
| - | - |
| [Choices](https://docs.headwaters.ai/guides/choices.md), `maestro-1` | **$0.42 per million input tokens** and **$1.00 per million output tokens**, as `usage` reports them |
| [Choices](https://docs.headwaters.ai/guides/choices.md), `maestro-1-flash` with a question | **$4.20 per million input tokens** and **$10.00 per million output tokens**; without a question, as `maestro-1` |
| Steering [chat](https://docs.headwaters.ai/guides/chat.md) and [decisions](https://docs.headwaters.ai/guides/decisions.md), `maestro-1` | **$0.42 per million input tokens** plus **$0.00042 per call**; no output charge |
| Steering, `maestro-1-flash` | **$4.20 per million input tokens** plus **$0.0042 per call** |
| Compacting a [state](https://docs.headwaters.ai/guides/states.md#compact) | **\$0.75 per million tokens** read and written |
| Compile | **\$16 per million source tokens** |
| A [rush](https://docs.headwaters.ai/guides/compile.md#when-a-compile-starts) compile | **\$21 per million source tokens** |
| A downstream model (chat or decision) | the model's listed price **+ 5%** |

### Subscribe

```bash theme={null}
curl -X POST "https://api.faces.sh/v1/billing/checkout?plan=pro" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

`plan` is `connect` or `pro`. Returns a `checkout_url` to redirect the user to Stripe.
After payment, the subscription is activated automatically. **Promotion codes** can be
entered on the Stripe checkout page; a code can make a plan free for a while and can add
credits to your balance once the subscription starts.

Checkout is for a **first** subscription. If you already subscribe it answers `409`;
switch plans instead.

> [!NOTE]
>
> **Changing a plan, a card or your balance takes a signed-in session.** Switching,
> cancelling and reactivating a plan, adding, changing and removing a card, and topping up
> answer `403` to an API key. Send a [JWT](https://docs.headwaters.ai/authentication.md#jwt-tokens).

### Switch between Connect and Pro

```bash theme={null}
curl -X POST "https://api.faces.sh/v1/billing/subscription/plan?plan=pro" \
  -H "Authorization: Bearer YOUR_JWT"
```

Changes your existing subscription in place, prorated, and the new plan's allowances apply
at once. Returns `{"plan", "previous_plan", "status"}`. Without a subscription it is a
`409`: use checkout.

### Cancel subscription

```bash theme={null}
curl -X POST https://api.faces.sh/v1/billing/subscription/cancel \
  -H "Authorization: Bearer YOUR_JWT"
```

```json theme={null}
{ "canceled_at_period_end": true, "current_period_end": "2026-06-05T13:13:23" }
```

Cancels at the end of the current billing period. The user keeps Connect access until `current_period_end`; at that moment the account reverts to Free automatically. Subsequent `GET /v1/billing/subscription` calls return `cancel_at_period_end: true` until the period ends.

### Reactivate subscription

If the user changes their mind before the period ends, undo the cancellation. Same subscription, same period end, **no new charge**: auto-renewal simply resumes.

```bash theme={null}
curl -X POST https://api.faces.sh/v1/billing/subscription/reactivate \
  -H "Authorization: Bearer YOUR_JWT"
```

```json theme={null}
{ "cancel_at_period_end": false, "current_period_end": "2026-06-05T13:13:23" }
```

Returns **`400`** if the user has no Stripe subscription, or if the subscription is not currently pending cancel.

***

## Payment methods

An account can save several cards. One of them is the **default**: your subscription renews on it, and a top-up charges it unless you name another card. The card you subscribe with becomes the default.

### Add a card

```bash theme={null}
curl -X POST https://api.faces.sh/v1/billing/card-setup \
  -H "Authorization: Bearer YOUR_JWT" \
  -H "Content-Type: application/json" \
  -d '{"make_default": false}'
```

Returns a `checkout_url`: send the user there to enter the card. Nothing is charged. The body is optional:

* `make_default` defaults to `true`, so the new card becomes the default unless you send `false`.
* An account's first card is always the default.

The card shows up a few seconds after the user finishes.

### List cards

```bash theme={null}
curl https://api.faces.sh/v1/billing/payment-methods \
  -H "Authorization: Bearer YOUR_API_KEY"
```

```json theme={null}
{"default_payment_method": "pm_1Q...",
 "payment_methods": [
   {"id": "pm_1Q...", "brand": "visa", "last4": "4242", "exp_month": 12, "exp_year": 2030, "is_default": true},
   {"id": "pm_1R...", "brand": "mastercard", "last4": "4444", "exp_month": 3, "exp_year": 2029, "is_default": false}]}
```

The newest card comes first. `GET /v1/billing/balance` still returns `has_payment_method`, which says whether there is a default card.

### Change the default

```bash theme={null}
curl -X POST https://api.faces.sh/v1/billing/payment-methods/pm_1R.../default \
  -H "Authorization: Bearer YOUR_JWT"
```

The next renewal, and every top-up that names no card, charges this card. Returns the same shape as the list.

### Remove a card

```bash theme={null}
curl -X DELETE https://api.faces.sh/v1/billing/payment-methods/pm_1R... \
  -H "Authorization: Bearer YOUR_JWT"
```

* **Removing the default** makes the newest remaining card the default.
* **The last card can't be removed** while a paid subscription renews on it. That returns **`409`**: add another card first, or cancel the subscription.
* **A card that isn't yours** returns **`404`**, for both changing the default and removing.

Returns the same shape as the list.

***

## Top up credits

```bash theme={null}
curl -X POST https://api.faces.sh/v1/billing/topup \
  -H "Authorization: Bearer YOUR_JWT" \
  -H "Content-Type: application/json" \
  -d '{"amount_usd": 20.00, "payment_method_id": "pm_1R..."}'
```

This charges the default card, or the saved card in `payment_method_id` if you send one. The minimum is \$1.00, in whole cents.

* **No card saved:** **`402`**, `No payment method on file. Add a card first.`
* **`payment_method_id` isn't one of the account's cards:** **`404`**.
* **Same amount again within two minutes:** **`409`**. Send `"allow_duplicate": true` to buy it again on purpose:

  ```json theme={null}
  {"detail": {"error_code": "duplicate_topup", "message": "...", "repeat_with": {"allow_duplicate": true}}}
  ```

***

## LLM pricing

```bash theme={null}
curl https://api.faces.sh/v1/billing/llm-costs \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Returns the current pricing table for all supported models, including per-million-token rates for standard models and per-hour rates for time-based services (e.g. audio transcription).

| Field | Meaning |
| - | - |
| `lab` | Who made the model. |
| `input_cost_per_million`, `output_cost_per_million` | The model's listed price, **before** the markup. |
| `markup_rate` | What a request is charged on top of those prices: `0.05` is 5%. |
| `prices_include_markup` | `false`: the listed prices do not include `markup_rate`. |

***

## Usage history

```bash theme={null}
curl https://api.faces.sh/v1/billing/usage \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Returns a breakdown of token usage and costs. Supports query parameters:

* `from_date` / `to_date`: filter by date range (ISO dates, inclusive)
* `group_by`: group results by `model_iam_id` (the default), `llm_model`, `api_key_id`, `model_username` (face alias) or `date`
* `api_key_id`, `model_username`, `model_iam_id`: filter to one value
* `llm_model`: filter to one model id, as `group_by=llm_model` reports it

Grouped by `llm_model`, each model appears once, under the id [`GET /v1/models`](https://docs.headwaters.ai/guides/models#listing-the-models) lists. Our own models' work (steering, choices and compacting) appears as `upstream`, and compiling as `faces-compile-latest`, a rush's extra charge included. Any id from the grouped response filters to that id's usage.

Each row, and `totals`, adds up: `provider_cost_usd + markup_usd = total_cost_usd`, the
amount deducted.
Faces' own charges (choices, steering, compacting, compiling) carry no markup: on their rows
`provider_cost_usd` and `markup_usd` are `0`, and the whole charge is in `total_cost_usd`.

## Invoices

```bash theme={null}
curl https://api.faces.sh/v1/billing/invoices \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Returns a list of top-up transactions with amounts and Stripe receipt URLs.

## How a choices call is billed

A [choices](https://docs.headwaters.ai/guides/choices.md) call is billed on its `usage`: on Connect and Pro, its input
tokens count against the allowance; on Free, or past the allowance with `api_fallback` on, it
is paid from credits:

```
cost = (input_tokens / 1,000,000) × input_price
     + (output_tokens / 1,000,000) × output_price
```

The prices are the model's in [`GET /v1/models?kind=choices`](https://docs.headwaters.ai/guides/choices#models), with no
markup.

***

## Credit account states

| State | Effect |
| - | - |
| `balance > 0` | Normal operation |
| `balance = 0` | Requests that must be paid from credits return `402 Payment Required` |
| `frozen = true` | All requests return `402` regardless of balance |

***

## Compile thread billing errors

When starting or continuing an interview thread, a `402` is returned if no payment source is available. The response body includes structured fields:

```json theme={null}
{
  "detail": {
    "message": "Connect your OpenAI account, or add credits to start an interview.",
    "error_code": "compile_payment_required",
    "needs_oauth": true,
    "needs_credits": true,
    "plan": "connect"
  }
}
```

| Field | Meaning |
| - | - |
| `needs_oauth` | User should link their OpenAI account (Connect plan only) |
| `needs_credits` | User should top up their credit balance |
| `plan` | The user's current plan |

A `503` is returned if the interviewer fails; the message carries a reference. Retry.


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