Zorveus LogoZorveusDOCS
Business

Configure product-user allowances

View Markdown

Choose model access, caps, enforcement, and overrun settings with practical examples.

Use this guide when your product pays for customers' AI usage. Configure the API key's connection in the dashboard. Your backend selects the key for the customer's plan and sends the customer's external user ID on every request.

Start with this configuration

For a product with finite customer allowances:

SettingStarting choiceWhy
Allowed modelsThe models your product usesAvoid unintended model access.
Cap amount and periodYour plan's AI allowance, such as $10 monthlyEstablish a finite base allowance.
credit_modeenforceEnforce configured allowance even when attribution is missing.
overrun_policylimit_outputReduce the output limit to the affordable amount.
External user IDYour stable customer ID on every requestAttribute usage and apply product-user credits.
Allowance anchorSubscription start time, or no anchor for UTC calendar periodsAlign resets with your billing cycle.

Which settings belong where?

  1. Your backend selects a planChoose the API key for Free or Pro. Do not let the customer choose the key.
  2. The connection supplies rulesAllowed models, cap amount and period, credit mode, and overrun policy.
  3. The user ID supplies attributionZorveus applies the customer's usage, credits, and allowance anchor.
The key selects a connection. The external user ID identifies the customer. A plan name in metadata does not select a key.
Connection settings, configured in the dashboardProduct-user settings
Allowed models, cap amount and period, credit_mode, overrun_policyExternal user ID, profile metadata, allowance anchor, and credit grants

An active direct product-user cap can override the connection cap used to resolve that user's allowance. Manage caps in the dashboard. Set profile details and the anchor through supported product-user operations or inference metadata. Grant credits through the service-key API.

Choose the credit mode

These behaviors assume a configured cap. This table describes allowance enforcement, not every possible request rejection.

credit_modeWith external user IDWithout external user IDChoose it when
enforce_if_present, defaultEnforces base allowance plus eligible creditsBypasses virtual allowance checksUnattributed internal work intentionally shares a key with customer traffic.
enforceEnforces base allowance plus eligible creditsEnforces key-level allowanceMissing attribution must not bypass allowance enforcement.
track_onlyTracks base allowance, credit use, and uncovered spend without blocking for allowanceTracks usage without blocking for allowanceYou want to observe spend before enforcing limits.
disabledSkips allowance checks and credit consumptionSkips allowance checksYou want usage reporting without virtual quotas.

enforce does not require a user ID. Your backend must require the ID if every request must be attributed. OAuth user connections always use enforce.

Request arrives
  ├─ No cap → unlimited virtual allowance; no credits consumed
  └─ Cap configured
       ├─ disabled → skip allowance checks and credits
       ├─ track_only → account for allowance; do not block for it
       ├─ enforce_if_present + no user ID → bypass virtual allowance checks
       └─ enforced request → check applicable base allowance + eligible credits

Model access and funding checks still apply on every path.

Choose the overrun policy

The credit mode controls allowance enforcement. The overrun policy controls how a request handles output that could exceed the remaining allowance.

overrun_policyWhat happensChoose it when
limit_output, defaultLowers the provider output limit to the affordable amount. Unexpected variance can still be recorded as uncovered spend.Limiting spend matters more than a longer answer.
allow_overrunAllows output up to the declared or safe limit. Records excess as uncovered spend, without carrying debt into future allowance.Finishing an admitted response matters more than staying within its remaining allowance.
carry_overrun_forwardAllows output up to the declared or safe limit. Records excess as debt repaid from later credits or base allowance resets.A longer answer is allowed, but future allowance must cover the excess.

Overrun policies do not supply wallet funds or guarantee admission when allowance is already exhausted. They do not override model access or funding checks.

Scenarios

Free and Pro customers use different keys

Configure two connections in the dashboard:

PlanMonthly base allowanceModelsCredit modeOverrun policy
Free$2Your selected lower-cost modelsenforcelimit_output
Pro$20Your selected Pro modelsenforcelimit_output

The amounts are examples, not Zorveus subscription prices. Your backend looks up the customer's plan, selects its key, and sends the same external user ID. Keep both keys on your server.

If a customer upgrades, select the Pro key. Do not assume a new key resets their usage. The product-user allowance window can include usage across connections. A profile lookup can still reflect the previous connection, so do not reject a Pro request using a stale Free allowance.

A request accidentally omits the user ID

With enforce_if_present, missing attribution bypasses virtual allowance enforcement. With enforce, the request still faces key-level allowance, but it is not attributed to your customer and cannot use that customer's credits.

Validate the external user ID in your backend before sending customer requests. Neither mode repairs missing attribution.

A customer buys extra credits

The customer has a $10 monthly base allowance, has used $8, and holds a $5 credit grant. Assume no active reservations or carried debt:

Base allowance remaining: $10 - $8 = $2
Eligible credits:                     $5
Total available allowance:           $7

A request reserves $3:
  $2 from base allowance → $1 from credits

Base allowance is consumed first, then eligible credits by earliest expiry. Credits do not pay the provider. Your wallet or BYOK account must still fund the request. See Credit grants and Billing integration.

A longer answer costs more than the remaining allowance

Suppose an admitted request has $1 of allowance left but its completed response costs $1.50:

  • limit_output attempts to keep output within the affordable amount. Unexpected variance is still possible.
  • allow_overrun records the extra $0.50 as uncovered spend without future debt.
  • carry_overrun_forward records $0.50 of debt. Later credits or the next base reset repay that debt before restoring spendable allowance.

A subscription renews on the 17th

Use a monthly cap and a stored allowance anchor of July 17. On September 30, the active window is September 17 to October 17:

Jul 17          Aug 17          Sep 17       Sep 30          Oct 17
  |---------------|---------------|-----------●---------------|
                                  current allowance window

Do not send the current time as a new anchor on every request. The anchor belongs to the product user within the app, not separately to each plan key. Without an anchor, monthly periods follow UTC calendar months. See Allowance periods and anchors.

Check your setup before launch

  1. Make an attributed request and confirm the customer appears in usage.
  2. Test a disallowed model and confirm rejection.
  3. Test exhausted allowance with your chosen credit mode.
  4. Add credits and confirm that eligible credits restore allowance.
  5. Omit the user ID and verify the behavior you intended.
  6. Test a plan change without assuming usage resets.
  7. Test allowance exhaustion separately from insufficient wallet funding.

Use Check available allowance for admission checks. The reported amount is a snapshot, not a reservation or a guarantee that the next request fits.

Was this page helpful?
Edit this page on GitHub

On this page