A plan is a stored object that compiles to a route on every run. It sets the price, the allowance, what happens past it, which compute it may use, and what a user earns for connecting their own.
Pricing and routing are the same decision, so they are the same object. A plan says
what a user pays and what their runs are allowed to run on, and it compiles to a
route on every request.
The shape#
Build plans in the dashboard's plan builder, which previews the pricing card as your
users will see it, or through the API. Either way these are the fields:
| Field |
What it sets |
priceModel |
free, flat, per_message, per_token, prepaid |
priceMicros |
The price, in integer micros |
interval |
month or year |
unit |
Limit by: what both allowances are counted in — run, token or cost (message and seat predate the form) |
includedUnits |
Paid runs: what the price covers on compute you pay for (open-weights, frontier). Null means unlimited |
overage |
stop or meter, past includedUnits |
overageMicrosPerUnit |
The price past includedUnits, when metering: per run, per 1M tokens, or per $1 of usage |
ownIncludedUnits |
Runs on the user's own AI: their machine, Claude or ChatGPT subscription, or API key. Null means unlimited |
byoOverage |
When ownIncludedUnits runs out: stop, or meter to continue on compute you pay for |
trialDays |
|
routePrefer / routeAllow |
The compute dimension: which cost classes a run on this plan may use |
maxCostMicros |
The ceiling on one run, not on a month |
connectedReward |
What the user gets for bringing their own compute |
features |
What your app enforces: projects, export, integrations. See Plan features |
maxCostMicros is per run
Only the metered classes can spend it, so it means nothing on a plan that allows none
of them. Null is no ceiling, which is the honest default: a zero would read as "spend
nothing" and stop every metered run.
Limit by#
A plan picks one unit, and both of its allowances below are counted in it:
unit |
One run counts |
Allowance typed as |
Price past it |
run |
1 |
runs |
per run |
token |
every token the model reads and writes: input, output and cache |
tokens |
per 1M tokens |
cost |
what the run cost you; on their own AI, its list price |
dollars |
per $1 of usage |
cost is stored in hundredths of a cent (10,000 to the dollar), so a cost plan's
includedUnits of 100000 is $10 of usage.
Two allowances#
A plan counts two kinds of run separately, and neither spends the other:
- Paid runs (
includedUnits) are runs on compute you pay for. Past the
allowance, overage decides: stop, or bill each run at your rate.
- Runs on their own AI (
ownIncludedUnits) are runs their machine,
subscription or key serves. They cost you nothing, so the default is unlimited;
set a number to bound them anyway. Past it, byoOverage decides: stop refuses
the run until next month, meter sends it to compute you pay for, where it
counts as a paid run.
So somebody on a plan of 200 paid runs who does 500 runs on their own laptop still
has all 200 when the laptop sleeps.
meter only uses classes the plan's route already allows. On a plan that allows
nothing you pay for, there is nothing to continue on, and the dashboard refuses the
setting.
Plan features#
A plan is rarely only AI runs. Pro might also mean five projects, PDF export and
team sharing. Add those to the plan as features, so they live in one place
with the price and the limits instead of in a second copy in your code.
Runs are stopped at their limit by Soba on its own, because every run goes
through it. A feature is used inside your app, where Soba can't see it, so your
app asks first and Soba answers: from the plan they're on, their rewards, and
how many they've used.
Each feature has:
| Field |
|
id |
What your code reads: lowercase, snake_case, unique in the plan. Changing it breaks the code that reads it |
name |
What the pricing card says |
type |
boolean, number or text |
value |
true/false, a whole number, null for unlimited, or the text |
unit |
Optional, for a number: "projects", "team members" |
Check, then do it#
Ask from your server, just before the action. With use, a yes also counts it,
in the same step, so two requests racing for the last project can't both get it:
TypeScript
const { allowed, reason } = await soba.users.check(userId, "projects", { use: 1 })
if (!allowed) return upgrade(reason) // "limit_reached", "not_included", "plan_ended"…
await createProject()
When your app has already decided, record it with track, and pass a negative
amount when one is given back (a project deleted):
TypeScript
await soba.users.track(userId, "projects", -1)
A number that resets monthly starts over each billing period; any other count is
a running total. Yes-or-no features need no use.
In React, useFeature answers the same question in the browser, so a button can
be disabled with its reason before anyone presses it. It decides what to show,
not what happens: keep the server check.
TypeScript
const projects = useFeature("projects")
<button disabled={!projects.allowed}>New project</button>
useCurrentPlan().features and the current.features of GET /v1/plans?user=…
still hand you the raw values, for anything that isn't a yes-or-no question.
A person keeps the features they bought. Removing export from Pro, or cutting it
to three projects, reaches people who join or change plan after the edit, not
the ones already on it.
On the pricing card, features are listed under the limits. A yes-or-no feature
set to no is shown crossed out (✕ Export to PDF), so a cheaper plan says what
it leaves out.
Per-seat pricing#
One number feature on a paid plan can carry a price per unit: seats, usually.
Set the price and how many are included; Stripe charges each one past that on
the customer's next invoice, with no mid-month charge.
Soba doesn't count seats. Your app reports the total in use whenever it
changes:
TypeScript
await soba.users.setQuantity(teamId, "seats", members.length)
or, without the SDK:
http
POST https://soba.so/v1/end_users/{user}/features/seats/quantity
Authorization: Bearer sk_soba_…
Content-Type: application/json
{ "quantity": 12 }
It sets the total, never adds. A missed or doubled call is corrected by the
next one, and a count that already matches writes nothing to Stripe, so calling
it daily with the true count is a free resync. Negative numbers are refused.
The count you last reported comes back in plan status as
quantities: { "seats": 12 }, beside features, where seats is the plan's
cap rather than the count.
Per-seat pricing has the code for every place your count changes.
Priced at your rate, not at cost#
Metering is cost accounting: what a run actually consumed, in micros, stamped with
its cost class. Billing is a different number, and it is yours.
Every user carries a ledger priced at your rate. A per_message plan at your price
bills the same whether the run cost you nothing or your app served it, because what
the run cost to serve is your margin, not your customer's concern.
The connected reward#
The one lever that moves the rate the whole product rests on: what a user gets for
connecting their own compute.
connectedReward |
|
none |
Nothing beyond the own-AI allowance |
included |
A larger paid allowance, set by connectedIncludedUnits |
credit |
Money back per interval, set by connectedCreditMicros, issued as a credit on the user's Stripe balance |
Three rules are built into the model rather than left to the customer:
One reward, not a set. A plan picks one, so there is one promise on the pricing
card rather than two.
Earned, not switched on. Pairing a machine that never wakes earns nothing.
included holds while a machine is connected, because a larger allowance is a promise
about the month rather than about one run. credit is assessed at renewal, against
how much of the period's work their own compute served.
There used to be an unlimited reward, which took the runs their own AI served out
of the count. Every plan does that now, through ownIncludedUnits, so it is gone:
plans that had it carry none and an unlimited own-AI allowance, which is the same
plan.
A credit, never a surcharge. Given as money back rather than taken away, so a user
who disconnects stops earning instead of watching their price go up.
Note that included spends your cost saving as allowance, which
costs you nothing when the runs are free to serve. credit spends it as money,
which is easier to advertise and dearer to give.
Where the user meets it
Both allowances and included are enforced at dispatch, so a plan really does
refuse a run past its allowance and really does let a machine-served run through
when only the paid allowance is spent. That is what <SobaPlans /> advertises on the pricing
card and what <RunLimit /> offers at the moment a run is
refused. credit is stored and shown, and is not charged yet: it needs the payments
rail below.
Import#
New plan → Import a plan starts a plan from what you already have. Pick one of the
plans it finds and the new-plan steps open filled in; nothing is saved until you
finish them.
- Pricing page. Give its address. The cards are read from the page's HTML, so
a page drawn in the browser, or prices behind a monthly/annual switch, may need
fixing in the steps.
- JSON or CSV. Paste it or choose a file. Each plan needs a name; a monthly
price and features are optional.
JSON
{ "plans": [
{ "name": "Pro", "price": 19, "description": "For teams",
"features": ["Export to PDF", { "name": "Projects", "value": 10 }, { "name": "Support", "value": "Priority" }] }
] }
csv
name,price,features
Starter,0,"3 projects; Export to PDF"
Pro,19,"Unlimited projects; Support: Priority"
Features are lines in your own words, read the way the editor reads them: a
number in front is a limit, "Name: value" is text, anything else is yes or no.
In a CSV, split them with ; or |, or give one row per feature with a
feature column and the same name on each.
Rewards#
A reward is something you give your users on top of their plan. You set them up under
Plans → Rewards. There are three kinds:
| Kind |
What your user gets |
| Discount |
A percentage or a fixed amount off a paid plan, for a number of months or for as long as they pay. It's a coupon in your own Stripe |
| Access |
Features on top of their plan, each with an optional expiry: a yes/no feature switched on, a number added to a feature's limit, or extra AI runs, tokens or credits |
Your user can get a reward in three ways:
- A code. A reward can have one code, with an optional limit on how many times it's
used. If a code leaks, it stops at the number you chose. Your user types it into
<RedeemCode /> from @soba-so/react, or a field of your own using useRedeemCode().
You can also call POST /v1/rewards/redeem with their session. A discount's code also
works in the promo code field at Stripe checkout. To keep codes in your own app
instead, give the reward from your server when one is redeemed (below).
- From you. Give a reward to one user from their page under Users, from the Manage API
(
POST /v1/manage/rewards/give with reward and user), or through the MCP tool
soba_give_reward. reward is the reward's API ID, shown with a copy button when
you open it on the Rewards tab. It's made from the name when the reward is first
saved and never changes, so renaming the reward doesn't break your code.
- Automatically. A reward can be given when a user first signs up, or when they first
connect their own AI.
Each user gets a reward once, however they come to it.
Access applies wherever features are read: soba.users.check, useFeature()
and <SobaGate /> all see a granted feature as on, and a granted number as part of the
limit. AI usage from a grant is spent only after the plan's own allowance runs out, and the grant that
expires soonest is spent first. While a grant lasts, the run counts against the grant
instead of the plan, so it is not overage and the plan does not count as used up.
A discount your user redeems is applied at their next checkout. If they already pay
for a plan when you give it, it goes on their subscription straight away.
Payments#
Payments run in your own Stripe account, not Soba's. Soba connects to it as a Stripe
App, compiles each plan into the products and prices it needs there, runs checkout and
reports usage. Payouts, tax, refunds and disputes stay with you.
There is no application fee on the charge, so what your user pays arrives in your
account in full and Soba never holds or moves your money. Soba takes no share of what
you sell. Selling a paid plan needs your Stripe connected. See
Stripe and Pricing.
Render the whole thing with <SobaPlans /> and <SobaCheckout />,
or drive it yourself through the API.
The number to watch#
Your dashboard leads with inference you didn't pay for this month, auditable
against your own provider bill. It is the figure a plan exists to move, and no gateway
can compute it.