docs
// Platform

Billing & Subscriptions

Two billing modes: pay-as-you-go credits for shared inference, monthly subscription for committed hardware. Stripe processes payments and surfaces invoices; rotation, prorations, and refunds all happen here.

Stripe processes every payment. Project-level billing is managed at /billing: subscription state, credit purchases, invoice history, and the Stripe customer portal.

Billing is tied to your project, not your individual user account. Project owners manage billing settings and subscriptions on behalf of their team.

For detailed usage tracking, per-request analytics, and uptime billing data, see Usage Tracking & Billing.

Owner Required: Only project owners can access billing settings. If you need to manage billing, ask a project owner to grant you the owner role. See Teams & User Management for details on roles.

Dashboard Surface, Not API: All /billing/* routes are served by the dashboard and accept the browser session cookie or a dashboard-issued JWT. Project API keys of the form ere_<project>_<...> are accepted only by the inference router (/v1/*) and will return 401 against billing endpoints. Two-factor authentication is also required: any owner without 2FA enrolled is rejected. See Authentication & CSRF below.

Redirect Responses: Every POST /billing/* handler returns a 302 redirect (typically to /billing or to a Stripe-hosted URL), not a JSON body. Programmatic clients must disable automatic redirect-following and read the Location header. There is no JSON read endpoint for billing state today; GET /billing renders the dashboard HTML page.

Subscription Plans

A plan grants credits every cycle, and the larger plans also discount the per-token rate. The grant, not the price, is what you spend. The active plans:

Subscription plans
Plan
Free (free)
Starter (starter)
Hot-shot (hot_shot)
Extra (extra)
Double Extra Deluxe (double_extra_deluxe)

A plan's per-token rate scales every metered request: tokens, images and audio. Hourly EIM time and storage are not discounted. Visit /billing/plans to subscribe.

Each plan exposes two independent fields on the project record. Do not conflate them:

  • Subscription tier (subscription_tier): The billing plan slug (for example free, starter, hot_shot). It sets the per-cycle credit grant and the per-token discount. A live paid subscription also lifts the service tier's endpoint and uploaded-model caps, as unspent purchased credit and comped (special) status do; free and referral credit does not. Private Erebine Inference Microservices (EIMs) need a positive available credit balance (creditsBalance + bonusBalance) or comped status. Selected via Stripe checkout.
  • Service tier (tierId): The routing slug consumed by the inference router (for example plus, self_hosted). It sets the per-token rate before any plan discount, the tier's limits, and its scheduling priority; it does not pick hardware. It is independent of the subscription tier and is managed separately.
  • Credit balance (creditsBalance + bonusBalance): Two dollar-denominated buckets surfaced as credits. creditsBalance rolls over (paid face + purchases); bonusBalance (subscription bonus + free grant) expires at cycle end and is spent first.

See Service Tiers for a comparison of tierId values and what each controls at the routing layer.

Billing mode: Every project carries a BillingMode of paid or special. paid projects are metered and gated on the credit balance - token requests halt at zero. special is an admin-set comp mode that meters prospective spend but never halts. There is no longer a free billing mode; all projects are gated on credits.

Checkout Flow

To subscribe or upgrade your plan:

  1. Navigate to /billing/plans and select your desired plan
  2. Click the subscribe button to initiate a Stripe checkout session
  3. Complete payment in the Stripe-hosted checkout page
  4. You are redirected to the success page upon completion

Post-checkout, the actual order of operations is:

  1. Stripe redirects the browser back to /billing on the frontend; the success page is informational and grants nothing.
  2. Stripe asynchronously delivers the invoice.paid event to POST /webhooks/stripe. Only when this webhook is processed are the cycle credits granted (face -> rolling bucket, bonus -> non-rolling) and the billing cycle anchored. checkout.session.completed stamps the subscription tier but does not grant, to avoid a double grant.
  3. The Stripe customer ID is persisted on the project record at checkout-creation time (before redirecting to Stripe), not at completion.

The service tier is selected separately: Subscribing grants credits and a discount; it does not change tierId (your service tier). The service tier is selected per endpoint at creation. The subscription axis and the service-tier axis are independent.

Checkout Cancellation: If you cancel the Stripe checkout before completing payment, no changes are made to your subscription. You can restart the checkout process at any time.

Managing Your Subscription

The billing overview page at /billing shows your current plan, credit balance, and billing status.

Stripe Customer Portal

For detailed billing management, access the Stripe customer portal via /billing/portal. The portal allows you to:

  • Update payment methods (credit card, bank account)
  • Change billing information (name, address, tax ID)
  • View and download past invoices
  • Cancel, upgrade, downgrade, or pause your subscription directly

Checking Your Subscription

The canonical surface is the rendered dashboard page at /billing, which displays the current plan, credit balance, and subscription status. There is no JSON read endpoint; GET /billing returns the HTML dashboard. To inspect state programmatically from the dashboard origin, read it from the rendered template variables or wait for a JSON read endpoint to be added.

Cancelling Your Subscription

Cancellation is performed from the dashboard "Manage subscription" UI, which submits a CSRF-protected form to POST /billing/cancel with the active session cookie. The endpoint responds with 302 Found and Location: /billing; there is no JSON body.

If you must invoke the endpoint from a script that already holds a dashboard session cookie and CSRF token, model the request the same way the form does and follow the redirect:

curl
# Requires an active dashboard session cookie and the matching X-CSRF-Token # rendered into the dashboard template. Returns 302 to /billing. curl -i -X POST https://erebine.ai/billing/cancel \ -b "erebine_session=<your-session-cookie>" \ -H "X-CSRF-Token: <csrf-token-from-dashboard-template>"

Billing Routes

Endpoint Method Description
/billing GET Billing overview page
/billing/plans GET Plan selection and comparison
/billing/invoices GET Invoice history
/billing/checkout POST Create a Stripe checkout session for a plan
/billing/checkout/success GET Stripe redirects here after successful checkout
/billing/checkout/cancel GET Stripe redirects here when checkout is cancelled
/billing/credits POST Initiate a Stripe checkout session to purchase additional credits
/billing/cancel POST Cancel subscription (takes effect at end of billing period)
/billing/reactivate POST Reactivate a cancelled subscription before the period ends
/billing/portal POST Create and redirect to the Stripe customer portal session

Credits

Credits are the currency used for per-token inference billing on shared EIMs. Your project's credit balance is shown on the billing overview page and the usage dashboard.

Dollar figures are behind sign-in. The USD bounds on a credit purchase, and the per-token rates credits are spent against, are shown to signed-in accounts. How credits work -- the two buckets, the spend order, the priority multiplier -- is on this page either way. For a quote without an account, mail contact@erebine.ai.

How Credits Work

  • Each inference request on a hosted tier or on Self-Hosted deducts from your credit balance based on token count and the model's per-token price.
  • Credits are tracked at the project level as creditsBalance (USD-denominated Double).
  • Self-hosted tier (tierId = self_hosted) projects pay an hourly rate per connected EIM plus the Self-Hosted per-token rate, both from credits. One EIM drives one accelerator or many, and several EIMs can share a machine, so you decide how your accelerators are split.
  • The request's service_tier lane scales the token cost against creditsBalance: priority is billed above the token rate, flex below it, and default (including auto and scale) at the token rate; see Service Tiers for the multiplier table.

Subscription Statuses

A subscription can be in one of the following states:

Status Description
active Subscription is current and payment is up to date.
trialing Subscription is in a trial period. Full access is granted.
past_due Payment failed but Stripe is retrying. Access may be restricted.
canceled Subscription has been cancelled and the billing period has ended.
unpaid All payment retries have been exhausted. Service is suspended.
incomplete Initial payment requires further action (e.g., 3D Secure).
incomplete_expired Initial payment was not completed in time. Subscription did not activate.

Purchasing Credits

Purchase additional credits via POST /billing/credits. The endpoint creates a Stripe Checkout session and returns 302 Found with Location pointing at the Stripe-hosted payment URL. Credits are added to the project balance after Stripe delivers checkout.session.completed to the webhook handler. The amount is USD and is bounded at both ends; a value outside the accepted range is rejected before checkout opens. Sign in for the two bounds.

The handler accepts both application/json and application/x-www-form-urlencoded bodies; in practice the form is submitted by the dashboard UI with the session cookie and CSRF token.

curl (JSON body)
# Returns 302 to a Stripe-hosted checkout URL. # Requires an active dashboard session cookie and matching CSRF token. curl -i -X POST https://erebine.ai/billing/credits \ -b "erebine_session=<your-session-cookie>" \ -H "Content-Type: application/json" \ -H "X-CSRF-Token: <csrf-token-from-dashboard-template>" \ -d '{"amount": 50}'
curl (form-encoded body)
curl -i -X POST https://erebine.ai/billing/credits \ -b "erebine_session=<your-session-cookie>" \ -H "Content-Type: application/x-www-form-urlencoded" \ -H "X-CSRF-Token: <csrf-token-from-dashboard-template>" \ --data-urlencode "amount=50"

Delinquent Projects

If a Stripe invoice fails to pay, the invoice.payment_failed webhook stamps the project with isDelinquent = true and delinquentAt = <timestamp>. Delinquent projects:

  • Carry the isDelinquent and delinquentAt fields on the project record.
  • May have routing decisions or credit-gated endpoints refuse requests, returning the quota_exceeded error family (see Error Codes for the exact response shape).
  • Are cleared automatically when the next invoice.paid event is delivered, or manually by resolving the payment failure in the Stripe customer portal.

Referrals

Every account carries a referral code. It is shown on your dashboard together with the number of accounts that have signed up through it, and it does not expire.

How Referrals Work

  • Copy the referral link from your dashboard and share it. The link opens the sign-up page with your code already applied.
  • Invite someone in the dashboard account menu, the desktop app and the mobile app emails your referral link, or copies and shares it. See Inviting Someone to the Platform.
  • When someone creates a new account through your link and signs in for the first time, both accounts receive a credit bonus.
  • Each side's bonus lands on that account's default project. The credits roll over and do not expire.
  • The bonus is paid once per referred account. Referring yourself does not qualify.
  • A project invitation that results in a brand-new account counts as a referral for whoever sent the invitation. See Teams & User Management.

Operator Controlled: Referrals are switched on and off by the platform operator. When the program is off, no referral card appears on the dashboard and no bonus is paid.

Invoices

View your invoice history at /billing/invoices. Invoices are generated by Stripe and include:

  • Subscription charges
  • Credit purchases
  • Payment status and date

For detailed invoice management (downloading PDFs, updating billing details), use the Stripe customer portal.

Cancellation & Reactivation

Cancelling Your Subscription

Cancel your subscription via POST /billing/cancel (from the dashboard "Manage subscription" UI). The handler sets cancelAtPeriodEnd = true on the Stripe subscription. When you cancel:

  • Your subscription remains active until the end of the current billing period.
  • Existing credits are preserved; rolling credits never expire, bonus credits expire at the next cycle boundary as usual.
  • After the period ends, the customer.subscription.deleted webhook moves the project to the free subscription tier. The tierId service tier is not changed by cancellation.

Reactivating Your Subscription

If you cancelled but the billing period has not yet ended, you can reactivate via POST /billing/reactivate.

Known issue: POST /billing/reactivate does not yet withdraw the cancellation Stripe has scheduled, so the subscription still ends at the period end. To reactivate reliably today, open the Stripe customer portal (POST /billing/portal) and reactivate from there.

After Period Ends: If the billing period has already ended after cancellation, you must start a new subscription through the checkout flow.

Authentication & CSRF

All /billing/* routes are served by the dashboard and protected by three checks, in order:

  1. Session: Accepts a dashboard session cookie or a dashboard-issued JWT in Authorization: Bearer <jwt>. Project API keys (ere_<project>_<...>) are not accepted here; those are scoped to the inference router at /v1/*.
  2. Two-factor: Returns 401 unless the authenticated user has 2FA enrolled and the current session is 2FA-verified.
  3. Owner check: Only an owner of the active project passes. Non-owners receive 403.

State-changing requests additionally require an X-CSRF-Token header (or hidden form field) matching the token rendered into the dashboard page. There is no public CSRF-token issuance endpoint; the token is bound to the active dashboard session and surfaced through the rendered HTML.

Note that handlers return 302 redirects to /billing* after most state changes, not JSON. A browser follows the redirect back to the billing page.

Frequently Asked Questions

Who can manage billing?

Only project owners can access billing pages and make changes. Team members with the "member" role do not have access to billing settings. See Teams & User Management for details.

What payment methods are accepted?

Erebine uses Stripe for payments. Stripe supports credit cards, debit cards, and other payment methods depending on your region. Add, remove, or default-select payment methods through the Stripe customer portal.

Do credits expire?

It depends on the bucket. creditsBalance (paid face plus purchased credits) rolls over and does not expire; it persists across subscription state changes, including cancellation. bonusBalance (subscription bonus plus the free grant) expires at the next cycle boundary and is spent first. See Subscription Plans for both buckets.

What happens when my credits run out?

Inference requests on hosted tiers and on the Self-Hosted tier (tierId = self_hosted) start returning the quota_exceeded error family once creditsBalance is depleted, because Self-Hosted bills per token as well as per EIM-hour. Purchase additional credits or move workloads to a different tier to restore service.

Can I get a refund?

Refunds are handled through Stripe. Open the Stripe customer portal via POST /billing/portal from your dashboard, then file the refund request from the relevant invoice. No refund endpoint is exposed by the router itself.