Enlitt

The per-call premium limit

A user-owned ceiling on what a single premium call may cost, enforced before the provider is invoked.

Every Enlitt user sets, per application, the most a single premium call is allowed to cost them — the per-call premium limit. It is set and changed only on the user's own dashboard (the application detail page, or the authorization consent screen the first time an application is authorized); no SDK call reads or writes it directly, and a business has no API to change another user's limit.

What happens at the limit

When a premium call's declared providerOptions.enlitt.charge.amount converts to more credit units than the calling user's limit for that application allows, Enlitt refuses the call with EnlittLimitExceededError (premium_per_call_limit_exceeded) — before the provider is invoked. The business is never billed for a call refused this way.

import { EnlittLimitExceededError } from "@enlitt/sdk/server";

try {
  await generateText({ model: enlitt(myModel, { session }), prompt, providerOptions: { enlitt: { charge } } });
} catch (error) {
  if (error instanceof EnlittLimitExceededError) {
    // Safe to show this user directly: send them to `error.authorizeUrl`
    // to raise their own limit. Never show them a number here — see below.
  }
}

This error carries no figures at all — not the amount that was required and not the limit itself. Both are the user's own financial position, and a business has no claim on either. The one thing it may carry is authorizeUrl, a navigation target (never a disclosure) pointing at Enlitt's own screen where the user sees the actual numbers and can raise their limit.

A limit of zero

Setting the per-call limit to zero blocks every premium call for that application outright, while leaving standard use completely unaffected — zero is not "unset" or "use the default," it is an explicit ceiling of nothing. An application that wants to offer a user standard-only access respects this rather than treating a zero limit as a bug to work around.

A call above the limit is refused, never truncated

There is no partial-charge or reduced-scope fallback: a call whose declared charge exceeds the limit is refused in full. Truncating or downgrading a request to fit under a user's ceiling would silently change what the business asked for, so it is not something Enlitt does on the business's behalf.

On this page