# Introduction

Source: https://docs.orbytelabs.com/

Credit billing for your product, from a customer's first top-up to every billable action.

Credit manages subscriptions, feature limits, and prepaid balances for your product. Define what an action costs, sell plans or credit top-ups through Stripe Connect, then check and track customer usage.

Your app decides who pays and when an action is billable. Credit keeps the balances and usage history. The dashboard shows consumption by feature and customer, so you can see where credits go.

## How it works [#how-it-works]

1. Define a credit and price your features, such as an API request, a tool call, or inference.
2. Fund a wallet using an identity from your own application, such as `customer_123`.
3. Call `check` before work to read the current charge and available balance.
4. Call `track` to record usage and deduct the charge atomically.

```ts
import { check, track } from "@orbytelabs/credit";

const identity = "customer_123";
const access = await check("api-call", identity);

if (!access.allowed) throw new Error("Insufficient credits.");

// Perform the billable work here.
await track("api-call", identity, {
  id: "request_123",
});
```

This example assumes a deployed catalog and a funded wallet. The generated `_orbyte.ts` file types the feature names without loading your config at runtime. The [quickstart](/quickstart) sets up both.

A check does not reserve credits. Concurrent usage can spend the balance before tracking, so your server must also handle a rejected `track` call. See [checking and tracking](/checking-and-tracking).

## What you can model [#what-you-can-model]

| Pricing rule       | Example                                                                         |
| ------------------ | ------------------------------------------------------------------------------- |
| Fixed price        | One credit per API request.                                                     |
| Price per quantity | Ten credits per 1,000 processed records, charged proportionally.                |
| Calculated price   | Model cost plus a percentage markup, converted to your credit.                  |
| Once per period    | Charge for an active entity once per day, week, month, or wallet billing cycle. |

Each wallet can hold separate credit balances. A feature spends one credit type; Credit never adds different credit types together.

## Where Credit fits [#where-credit-fits]

Connect your Stripe account to create subscription and paid top-up checkout links. Verified Stripe events update the customer subscription or add credits to their wallet. [Subscriptions and payments](/subscriptions) covers setup, included usage, plan changes, and cancellations.

For manual grants or a payment collected separately, call `topup` with a stable identifier after verification. That function records credit funding without collecting a payment.

For AI products, the [AI SDK integration](/integrations/ai-sdk) records measured Gateway model costs and priced tool calls from an agent running in your application. [Eve support](/integrations/eve) is coming soon.

## Start here [#start-here]

* [Concepts](/concepts) explains applications, credits, features, wallets, and usage.
* [Quickstart](/quickstart) takes you from a key to the first recorded charge.
* [Pricing](/pricing) covers fixed prices, quantities, callbacks, and USD conversion.
* [Checking and tracking](/checking-and-tracking) covers runtime usage and retries.
* [API overview](/api) introduces the HTTP API and links to every endpoint.