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

# NSR Console & Billing

> The hosted nazarae-1 decision console — onboarding, free trial, metered billing, and the decision analytics surface.

# NSR Console & Billing

The customer-facing half of **nazarae-1**: the decision console, policy tooling, demo and
benchmark suites, and the evidence base. The model itself is served by `nsr-server`.

nazarae-1 is a **decision authority, not a text generator**. Every answer is `approved`,
`denied`, or `refused` with cited rules, a replayable derivation, and a SHA-256 policy pin — or
a refusal that names the exact `missing_facts`.

## Onboarding

Onboarding is **card-optional**: a three-step wizard covering org creation, payment, and a
one-time key reveal. Signup routes through hosted WorkOS AuthKit.

<Warning>
  The API key is revealed **once**, at the end of the wizard. There is no way to retrieve it
  afterward — store it before leaving the page.
</Warning>

New orgs get an activation checklist on the dashboard, and the quickstart curl is designed to
return a **grounded approval on the first call** rather than a refusal, so the first experience
demonstrates the system working.

## Free trial

`FREE_TIER_DECISIONS` (default **100**) lets an org make N billable decisions before the
billing gate applies. The gate reads the org's cumulative billable count and allows while
`used < N`. Setting it to `0` disables the trial, requiring a card up front.

On subscribe, the usage watermark is advanced to the current total, so **trial decisions are
never metered**.

<Note>
  Non-billable decisions never advance free-tier usage. If the stats endpoint is briefly
  unavailable the trial **fails open**, so a new user isn't blocked by a transient outage — while
  a subscribed org's status check still fails closed to 503.
</Note>

## Billing

**\$0.05 USD per billable decision**, billed monthly in arrears, via Stripe Elements.

| Piece        | How it works                                                                                                         |
| ------------ | -------------------------------------------------------------------------------------------------------------------- |
| Customer     | One Stripe Customer per WorkOS org, linked by `metadata.workos_org_id`                                               |
| Subscription | Metered, on the price with lookup key `nsr-metered-decision-v1`                                                      |
| Meter        | Billing Meter events (`nsr_billable_decisions`)                                                                      |
| Gate         | The BFF gates `/nsr/*` with **402** unless the subscription is active, trialing, or past\_due — or the org is exempt |

Usage is reported by an hourly job that pulls each org's cumulative billable count from
`/v1/decisions/stats` and pushes the delta as a meter event. Checkpoints live in customer
metadata, making it crash-safe.

<Note>
  The reporter **never double-bills**. If the cumulative total ever shrinks — a stats anomaly or
  a retention trim — it reports nothing and holds the checkpoint rather than rolling it down. A
  genuine permanent shrink under-bills until the count re-crosses the held checkpoint. This is a
  deliberate tradeoff: never double-bill beats never under-bill.
</Note>

A unified billing summary shows the trial meter and subscribed plan usage in one place, with a
visible free-trial deduction.

### Environment

| Variable                  | Notes                                                                   |
| ------------------------- | ----------------------------------------------------------------------- |
| `STRIPE_SECRET_KEY`       | Unset means billing is **entirely off** — the dev and self-host default |
| `STRIPE_PUBLISHABLE_KEY`  | Required when the secret key is set                                     |
| `STRIPE_WEBHOOK_SECRET`   | Required when the secret key is set                                     |
| `STRIPE_PRICE_LOOKUP_KEY` | Optional, default `nsr-metered-decision-v1`                             |
| `BILLING_EXEMPT_ORGS`     | CSV of WorkOS org ids that bypass the gate                              |
| `FREE_TIER_DECISIONS`     | Trial allowance, default 100; `0` disables                              |

### One-time setup per Stripe mode

1. `STRIPE_SECRET_KEY=sk_… npm run billing:bootstrap` — creates the meter, product, and price.
   Idempotent.
2. In the Stripe dashboard, add a webhook for `customer.subscription.*`, `invoice.paid`, and
   `invoice.payment_failed`, and put the signing secret in `STRIPE_WEBHOOK_SECRET`.
3. Add the environment variables to the BFF deployment.

## Console

The dashboard surfaces a health-verified connection, live decision analytics, and the
verified-decision curl quickstart. The playground includes a first-run primer on **how to read
a proof**, since the output shape is unfamiliar to people arriving from chat-style LLMs.

## Running locally

```bash theme={null}
# 1. Serve the model (build release first — a debug build has debug latency)
NSR_API_KEYS="dev-secret:admin" \
NSR_NEURAL_BACKEND=mock \
NSR_RATE_LIMIT=100000 \
  ./target-local/release/nsr-server serve -p 8086

# 2. Serve the console (Node 20.19+; offline test suites need 22.6+)
npm install && npm run dev        # → http://localhost:3000
```

<Warning>
  `NSR_RATE_LIMIT` matters — the default of 100 req/min cannot absorb the review suite's burst
  traffic. The `:admin` scope enables console API-key management.
</Warning>

## For agents

A machine-readable index is served at `/llms.txt`.

## Related

* [NSR as a Model Provider](/stateset-nsr-providers) — Claude Code, Codex, OpenCode
* [Verified Decisions API](/stateset-nsr-decisions)
* [Neuro-Symbolic Architecture](/stateset-nsr)
