mountable.io
By mountable.io · Cookbooks
  • billing
  • api
  • agents
  • cookbook

Give Every End User a Capped Workspace

mountable.io lets your backend give each end user their own filesystem with a hard monthly spend cap. That user stops at the cap, everyone else keeps working, and usage shows what is left.

You give each customer in your app an agent with its own workspace. The agent writes files for that customer.

One agent can keep writing files in a loop for hours. Your storage and download bill grows the whole time.

An account budget does not stop that in time. AWS budget data refreshes up to three times a day. A looping agent can spend for hours before the report moves.

GCP spend caps do not cover Cloud Storage.

mountable.io is a persistent filesystem for AI agents. Your backend gives each end user their own filesystem. It sets a hard monthly spend cap on that filesystem.

When that user reaches their cap, their billable work stops. Your other users keep working.

Create the workspace at signup

Create the filesystem once, when the user signs up. Store the filesystem id on your own user record.

Your backend looks that id up from the signed-in user on every call. Model output never picks the filesystem.

user_fs = client.create_filesystem(
    f"user-{user.id}",
    spending_cap_cents=500,
    mutations_per_minute=120,
    byte_quota=5 * 1024**3,
    entry_quota=50_000,
)

This user can spend at most $5.00 (or €5.00) a month. They can make 120 changes a minute and store 5 GiB in 50,000 entries.

Set the limits in the create call. Then there is never a moment without them.

At the cap, only that user stops

When the user reaches their cap, the Files API returns 402 filesystem_spending_cap_reached. Your backend stops that user's billable work.

Stored files stay in place. Work past the limit is refused.

Your organisation has its own monthly cap on top. Whichever cap is reached first stops the work.

Show the user what is left

Read the filesystem's limits and this month's usage. Subtract what the filesystem already reserved from its cap.

limits = client.get_filesystem(user_fs.id)
usage = client.filesystem_usage(user_fs.id)
left_cents = limits.spending_cap_cents - usage.reserved_cents

Show that number next to the user's workspace. The user sees what they have left this month. You see the same number before you raise a cap.

The rate limit is separate

A rate limit returns 429 rate_limited. Wait the given seconds, then retry.

That is a pause, not a stop. The spend cap is the stop.

Try it