how it works

usage in, revenue out

01

meter every call

usage is metered in credits at 100 credits per $1, so every model call maps to a clear, per-user cost you can bill against.

02

set spend caps

apply per-user and per-app spending limits so a runaway prompt or a single customer can never blow past the budget you set.

03

auto top-up + modals

metered auto top-up keeps balances funded, while prebuilt billing modals handle add-funds and low-balance moments inside your app.

hosted flows

mount the modals once

drop <HyperyModals /> at the root and the hosted add-funds and auto-billing flows open themselves — a 402 opens the funds modal, right where the request ran out.

  • metered auto top-up and prepaid, on the same credits
  • per-user and per-app spending limits
  • the funds modal opens on a 402, no wiring required
import { HyperyProvider, HyperyModals } from "@hyperyai/sdk"
 
export default function RootLayout({ children }) {
return (
<HyperyProvider config={config}>
{/* add-funds + auto-billing modals, rendered for you */}
<HyperyModals />
{children}
</HyperyProvider>
)
}

the wallet hook

render balances with useWallet

reach for useWallet when you want to show a balance or trigger a top-up from your own ui, all on team-pooled credits.

  • useWallet returns the balance and an addFunds trigger
  • team-pooled credits at 100 credits per $1
  • top up from your own components, no redirect
import { useWallet } from "@hyperyai/sdk"
 
export function Billing() {
const { wallet, addFunds } = useWallet()
 
return (
<div>
<p>balance: {wallet.credits} credits</p>
<button onClick={() => addFunds()}>add funds</button>
</div>
)
}

faq

questions

how does metered billing work?

usage is tracked in credits at 100 credits per $1. metered mode auto-tops-up a customer’s balance from a card, so usage keeps flowing without manual refills; prepaid mode is also available.

can i cap what a single user or app spends?

yes. set per-user and per-app spending limits so a customer or an embedded app can’t exceed the budget you assign, with team-level pooled credits on top.

do i have to build a billing ui?

no. drop <HyperyModals /> under the provider and the add-funds and auto-billing flows render for you. useWallet gives you the balance and an addFunds action for custom surfaces.

metered or prepaid — which should i pick?

metered auto top-up is the default and works like a usual pay-as-you-go card. prepaid lets customers load credits up front. both share the same credits, caps, and analytics.

monetize with usage-based billing

charge for what customers actually use

meter usage, set caps, and let auto top-up do the collecting — start turning your ai app’s usage into recurring revenue.

$npm install @hyperyai/sdk