Skip to main content

Overview

Tesslate Studio uses a 4-tier subscription model with a multi-source credit system for AI usage billing. All payments are processed through Stripe with webhook-based fulfillment and idempotent processing to prevent duplicate charges.

4 Subscription Tiers

Free, Basic, Pro, and Ultra with increasing limits and features

Multi-Source Credits

Four credit pools (daily, bundled, signup bonus, purchased) consumed in priority order

Per-Token Pricing

Dynamic model pricing calculated in real time from provider rates

Stripe Powered

Secure checkout, webhook fulfillment, and customer portal via Stripe

Subscription Tiers

FeatureFreeBasic ($20/mo)Pro ($49/mo)Ultra ($149/mo)
Monthly Bundled Credits05002,0008,000
Daily Credits5/day000
Max Projects371540
Max Deployments13520
BYOK (Bring Your Own Key)NoNoYesYes
SupportCommunityEmailPriorityPriority
Annual BillingN/AAvailableAvailableAvailable
All paid tiers support annual billing at a discount. BYOK allows you to use your own AI provider API keys, bypassing platform credit costs entirely.

Signup Bonus

New users receive 15,000 bonus credits that expire after 60 days. These are tracked separately and consumed after daily and bundled credits but before purchased credits.

Credit System

Credits are the unified currency for AI usage in Tesslate Studio. 1 credit = $0.01 USD.

Credit Sources

Credits come from four sources, each with different characteristics:
Credit TypeSourceExpirationPriority
DailyFree-tier allowance (5/day)Resets at UTC midnight1st (consumed first)
BundledSubscription monthly allowanceResets on billing date (every 30 days)2nd
Signup BonusRegistration gift (15,000 credits)Expires after 60 days3rd
PurchasedCredit packages bought separatelyNever expires4th (consumed last)

Credit Deduction Flow

When you use an AI model, credits are deducted in this exact order to maximize the value of your purchased credits:
1

Pre-Request Check

The check_credits(user, model_name) function verifies you have sufficient credits (or a BYOK key) before the AI request proceeds. BYOK models always pass this check.
2

AI Request Executes

The request is processed through the LiteLLM gateway, and the model generates a response.
3

Cost Calculation

calculate_cost_cents(model, tokens_in, tokens_out) computes the cost using dynamic pricing data. The formula uses Decimal arithmetic for financial precision:
cost = ceil(tokens_in/1M * input_price * 100) + ceil(tokens_out/1M * output_price * 100)
4

Credit Deduction

Credits are deducted in priority order: daily, then bundled, then signup bonus, then purchased. The deduction uses SELECT FOR UPDATE to lock the user row and prevent race conditions from concurrent requests.
5

Usage Logging

A UsageLog entry is created with model, tokens, cost, agent ID, and project ID. BYOK requests log with is_byok=True and billed_status="exempt".

Credit Packages

Purchase additional credits that never expire:
PackageCreditsPrice
Small500$5
Medium2,500$25
Large10,000$100
Team50,000$500
The credit-to-cents ratio is 1:1. Purchasing 500 credits for 5givesyou5 gives you 5 worth of AI usage.

Managing Your Subscription

Viewing Current Plan

1

Open Billing Settings

Click your profile icon, then Settings > Billing
2

View Plan Details

Your billing page shows:
  • Current tier and price
  • Bundled credits remaining vs. monthly allowance
  • Purchased credits balance
  • Total credits available
  • Credits reset date
  • Active subscription status

Upgrading Your Plan

1

Open Billing Settings

Navigate to Settings > Billing
2

Select a Plan

Click Upgrade on the desired tier (Basic, Pro, or Ultra)
3

Choose Billing Interval

Select monthly or annual billing
4

Complete Stripe Checkout

You are redirected to Stripe’s secure checkout page to enter payment details. Card information never touches Tesslate’s servers.
5

Automatic Activation

After payment, your tier upgrades immediately:
  • Subscription tier updates in your account
  • Bundled credits are granted for the new tier
  • Credits reset date is set to 30 days from now
  • BYOK access activates (Pro and Ultra)
  • Project and deployment limits increase

Canceling Your Subscription

1

Open Billing Settings

Navigate to Settings > Billing
2

Click Cancel

Click Cancel Subscription. By default, cancellation takes effect at the end of the current billing period.
3

Retain Access

You keep all tier benefits until the period ends. Your bundled credits remain available until they reset.
4

Downgrade

At the end of the period, your account downgrades to the Free tier:
  • Bundled credits reset to 0
  • Daily credits activate (5/day)
  • Purchased credits are NOT affected (they never expire)
  • Project and deployment limits reduce to Free tier levels

Renewing a Canceled Subscription

If you cancel but change your mind before the period ends, click Renew Subscription to remove the cancellation. Your subscription continues as normal.

Customer Portal

Click Manage Payment to access the Stripe Customer Portal where you can:
  • Update payment methods
  • View and download invoices
  • Manage billing details

Usage Tracking

Viewing Usage

The billing dashboard provides detailed AI usage analytics:
Overview for the current billing period:
  • Total cost in cents and USD
  • Total input and output tokens
  • Total request count
  • Breakdown by model
  • Breakdown by agent

Low Balance Warnings

The credit status API monitors your balance and provides warnings:
ConditionTriggered When
is_lowTotal credits fall to 20% or less of your monthly allowance
is_emptyTotal credits reach 0
The frontend displays a warning indicator when your balance is low, prompting you to purchase additional credits or upgrade your tier.

Stripe Integration Details

Dual-Path Fulfillment

Tesslate uses a dual-path idempotent fulfillment pattern for maximum reliability:
  1. Stripe Webhook: When Stripe sends a checkout.session.completed event, the backend fulfills the order
  2. Verify Checkout: When the frontend redirects back from Stripe, it calls POST /api/billing/verify-checkout as a fallback
Whichever path fires first completes the fulfillment. The second path is a safe no-op, thanks to idempotency checks using the stripe_payment_intent as a unique key.

Webhook Events Handled

EventAction
checkout.session.completedRoutes to subscription, credit, agent purchase, or deploy purchase handler
customer.subscription.createdLogged for audit
customer.subscription.updatedLogged for audit
customer.subscription.deletedDowngrades user to Free tier or deactivates agent subscription
invoice.payment_succeededMarks usage logs as paid
invoice.payment_failedLogged for follow-up

Security Measures

MeasureDescription
Webhook Signature VerificationAll Stripe webhooks verified using STRIPE_WEBHOOK_SECRET
Idempotent Fulfillmentstripe_payment_intent checked to prevent duplicate processing
Amount Cross-ValidationCredit purchases verify session.amount_total matches metadata.amount_cents
Session OwnershipVerify-checkout confirms metadata.user_id matches the authenticated user
PCI ComplianceCard details never touch the server; Stripe Checkout handles all payment input
Race Condition SafetyIntegrityError catch on commit handles webhook and verify-checkout races

Marketplace Purchases

Buying Agents

Purchase premium AI agents from the Marketplace:
  1. Browse the Marketplace and find an agent
  2. Click Purchase (one-time or monthly subscription)
  3. Complete Stripe checkout
  4. The agent is added to your Library immediately

Creator Payouts

If you sell agents on the Marketplace:
SplitRecipient
90%Creator (via Stripe Connect)
10%Platform fee
Creators receive payouts through Stripe Connect Express accounts. Revenue split is configurable via creator_revenue_share and platform_revenue_share in the platform config.

Billing API Reference

Subscription Endpoints

EndpointMethodDescription
/api/billing/subscriptionGETGet current subscription status and limits
/api/billing/subscribePOSTCreate Stripe checkout for tier upgrade
/api/billing/cancelPOSTCancel subscription at period end
/api/billing/renewPOSTReactivate a canceled subscription
/api/billing/portalGETGet Stripe Customer Portal URL

Credit Endpoints

EndpointMethodDescription
/api/billing/creditsGETGet detailed credit balance
/api/billing/credits/statusGETGet low balance warning status
/api/billing/credits/purchasePOSTCreate Stripe checkout for credit package
/api/billing/credits/historyGETGet credit purchase history

Usage Endpoints

EndpointMethodDescription
/api/billing/usageGETUsage summary for a date range
/api/billing/usage/logsGETDetailed per-request usage logs
/api/billing/usage/syncPOSTManually sync usage from LiteLLM

Other Endpoints

EndpointMethodDescription
/api/billing/transactionsGETCombined transaction history
/api/billing/earningsGETCreator earnings (for marketplace sellers)
/api/billing/connectPOSTCreate Stripe Connect onboarding link
/api/billing/configGETPublic billing configuration (no auth required)

Testing (Development)

Test Cards

Card NumberResult
4242 4242 4242 4242Payment succeeds
4000 0000 0000 0002Card declined
4000 0025 0000 3155Requires authentication (3D Secure)
4000 0000 0000 9995Insufficient funds

Local Webhook Testing

# Install Stripe CLI
brew install stripe/stripe-cli/stripe

# Login to Stripe
stripe login

# Forward webhooks to your local server
stripe listen --forward-to localhost:8000/api/billing/webhooks/stripe

# Copy the webhook signing secret to your .env
STRIPE_WEBHOOK_SECRET=whsec_...

Troubleshooting

Common causes:
  • Insufficient funds
  • Card expired
  • Bank declined the transaction
Solution: Update your payment method in Settings > Billing or through the Stripe Customer Portal.
Credits should be added immediately after payment. If not:
  1. Refresh the page (the verify-checkout fallback may need to trigger)
  2. Check Settings > Billing > Transaction History for the purchase status
  3. Wait up to 30 seconds for the Stripe webhook to process
  4. Contact support if the transaction shows as completed but credits are missing
Possible causes:
  • Webhook endpoint is not accessible
  • Webhook secret mismatch
  • Database error during fulfillment
Solutions:
  1. The frontend’s verify-checkout should handle this automatically on redirect
  2. Check that STRIPE_WEBHOOK_SECRET matches the value in your Stripe dashboard
  3. Contact support with your Stripe session ID for manual resolution
Solutions:
  • Check your usage breakdown by model in Settings > Billing > Usage
  • Switch to less expensive models for simple tasks (GPT-3.5, Claude Haiku)
  • Add your own API keys (BYOK) on Pro or Ultra tiers to bypass credit costs
  • Set per-run cost limits on your agents to prevent runaway usage
  • Purchase a larger credit package for better value
Check:
  • The threshold is set to 20% of your monthly allowance
  • Verify the GET /api/billing/credits/status endpoint returns is_low: true
  • Refresh the page to re-fetch credit status

Next Steps

Model Management

Understand AI model pricing and choose cost-effective models

API Keys

Set up BYOK to use your own AI provider keys

Marketplace

Browse and purchase premium agents

External Deployments

Deploy projects and manage deployment slots