Engineering note

A free tier that can't spend your AI budget

CloakMotion turns a prompt into a finished short video, and every video costs real money in API calls: a script from GPT, a voiceover, AI-generated images. That makes a free tier dangerous. If free users can render, the bill grows with every sign-up, whether anyone ever pays.

So I made the free plan unable to render at all. It's a deliberate product decision, and it keeps free users cost-free to host.

Who is allowed to spend money

The rule lives on the server, in one place. A user counts as subscribed only if they hold an active subscription of one of the three paid types:

public function isSubscribed(): bool
{
    return $this->subscribed('starter') ||
        $this->subscribed('daily') ||
        $this->subscribed('hardcore');
}

The paid actions check it. Re-rendering a video, editing images and the AI tools such as the prompt writer all start with the same guard, which returns a 403 with "An active subscription is required". The ElevenLabs voices are gated by the same rule:

if (! $request->user()->isSubscribed()) {
    return response()->json([
        'message' => 'An active subscription is required to re-render a video.',
    ], 403);
}

The number of series a user can run comes from the quantity on their subscription, and an unsubscribed user gets zero:

public function maxSeries(): int
{
    return (int) ($this->activeSubscription()?->quantity ?? 0);
}

The scheduler checks it too. When the scheduled job picks up a video, it only dispatches the YouTube and TikTok uploads if the user is still subscribed, so a cancelled account stops publishing at the next run without anyone touching it.

The frontend decides nothing

The Next.js app shows plans and buttons, but it never grants access. The audit I ran on the payment code confirmed this: the server decides who gets paid access, the frontend can't grant it, and no secrets sit in frontend code. A user who edits the page in their browser still hits the same 403.

The paid side

Billing is Stripe Billing through Laravel Cashier, with three paid tiers: Starter at $19 a month, Daily at $39 and Hardcore at $69, with annual prices seeded as well. The tiers differ in how often videos post: three times a week, once a day, or twice a day. Stripe webhooks are signature-verified, and I wrote up the two payment bugs I found in the audit in a separate post.

What this doesn't cover

What I'd tell a client

If your product spends money per use, decide who may trigger that spend before you build the feature, and enforce it on the server where the cost happens. A hidden button is not a lock. I'd also put a check on the background jobs, because that's where a cancelled account quietly keeps working.

The code from this post is public: https://github.com/hassan91199/cloakmotion-highlights/tree/main/gating.

If you're adding paid plans to an AI product and want the cost side designed in from the start, book a call with me on Upwork.

All posts