UnieAI Studio

Billing, Wallets, and Metering

Understand personal and organization wallets, Stripe top-ups, model pricing, reservation settlement, and administrator credit operations.

UnieAI Studio uses USD wallets and fine-grained usage metering. A billable request reserves an estimated amount, settles against actual usage, and records data in the wallet ledger and request logs.

Personal and organization wallets

  • A personal workspace uses the current user's personal wallet.
  • An organization workspace can use its organization wallet; the billing target follows the request's workspace and authorization context.
  • Organization creators and co-editors can perform permitted wallet operations. A regular organization user cannot top up the organization wallet or redeem a gift code into it.
  • A pending user cannot use some reward or payment flows.

Internally, balances use micro-USD, where 1,000,000 micro-USD = USD 1, avoiding floating-point loss on small token charges.

BalanceMeaning
AvailableFunds available for new requests
ReservedFunds temporarily held for in-flight requests
TotalAvailable plus Reserved

Stripe top-ups

Studio displays Top up only when the server has STRIPE_SECRET_KEY. Stripe credentials are deployment environment variables, not fields in an Admin Panel Payment Settings page.

STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...

Configure and validate STRIPE_WEBHOOK_SECRET in production. Never expose the Stripe secret key through a public environment variable, a real value in documentation, or version control.

User top-up flow

Select Top up from the sidebar wallet.
Choose USD 10, 25, 50, or 100, or enter a custom amount of at least USD 10.
Confirm whether the target is the personal wallet or current organization wallet.
Complete payment in Stripe Checkout.
After the Stripe return and webhook confirmation, the order succeeds and the ledger is credited.

The dialog shows an existing pending Stripe order. If payment completed but Studio has not refreshed, use the order synchronization path rather than creating duplicate payments to fix a display delay.

Model pricing

Administrators set public input and output prices per base model under Admin Panel → Models, expressed per million tokens. A typical text-model calculation is:

Cost = (input tokens × input price + output tokens × output price) ÷ 1,000,000

Final settlement also depends on the selected model, upstream connection, endpoint, and available usage data. Embedding, VLM, speech, parsing, and internal tool tasks can use their own metering dimensions and should not be estimated solely with chat output tokens.

Reservation and settlement

  1. Reserve estimates input and maximum output cost. Insufficient funds can return 402 Payment Required.
  2. Capture charges measurable actual usage and returns unused reserved funds to Available.
  3. Release returns an outstanding reservation when the provider or runtime fails before settlement.
  4. Ledger records top-ups, usage, gifts, referrals, and administrator adjustments.

Billing response headers

A response with completed billing can include:

HeaderMeaning
x-unieai-billing-amount-centsCharge in cents
x-unieai-billing-amount-micro-usdCharge in micro-USD
x-unieai-billing-currencyBilling currency, currently USD
x-unieai-balance-after-centsAvailable balance after settlement, in cents
x-unieai-balance-after-micro-usdAvailable balance after settlement, in micro-USD

Failed, unbilled, or specific internal flows may omit some headers. Reconcile against the wallet ledger and platform records rather than treating client-captured headers as the accounting source of truth.

Review usage and request cost

  • The sidebar wallet shows the current workspace's available balance.
  • Usage provides usage and wallet-related records.
  • A custom model's Operate → Request logs shows Request ID, tokens, status, latency, and available cost fields.
  • Administrators use Admin Panel → Insights for platform rollups and request logs.

Live request logs, usage rollups, wallet capture, and Stripe webhooks can complete at different times. Short-lived differences do not necessarily indicate a duplicate charge.

Administrator credit and rewards

User wallets

Admin Panel → Users → Wallets shows free credit, card top-ups, current balance, and credit history. Setting a target balance records the difference as an administrator adjustment and does not create a Stripe order.

Rewards and gift codes

Admin Panel → Rewards configures signup, inviter and invitee rewards, invite-code limits, advanced referral conditions, and gift codes. A user redeems a code under Plan → Gift, crediting the selected wallet when they have permission to operate it.

Reconciliation guidance

  1. Correlate request logs and usage ledger entries by Request ID.
  2. Separate free credit, card top-ups, rewards, usage, and administrator adjustments.
  3. For Stripe discrepancies, inspect Checkout Session, webhook delivery, and the Studio order state.
  4. Wait for rollup refresh before comparing Insights totals with per-entry ledgers.
  5. Do not replace administrator wallet adjustments or formal refunds with direct database balance edits.