The Majestix AI Inference Hub uses a credits-based billing system powered by Stripe. 1 credit equals $0.001 USD. All model usage is billed identically regardless of client (web, VSCode, CLI).
Plan
Monthly Price
Credits Included
Notes
No payment method required
Stripe subscription (best value)
Additional credits can be purchased as one-time top-ups at any time.
Returns the authenticated user's current plan, credit balances, and usage breakdown. Responses are cached for 60 seconds.
Requires one of:
X-Api-Key header with a valid API key
Authorization and X-Firebase-AppCheck headers for browser-based auth
This endpoint takes no parameters.
Request Example
Response Fields
Current subscription plan: free, guru, or pro.
Total monthly credits included in the plan.
monthly_credits_remaining
Remaining monthly credits for the current billing cycle.
Credits from one-time top-up purchases (do not expire monthly).
ISO 8601 start of the current billing cycle.
ISO 8601 end of the current billing cycle.
Total credits consumed this billing cycle (monthly + top-up).
Total API requests this billing cycle.
Per-model usage with model, credits_used, and requests.
Error Responses
Missing or invalid authentication
POST /billing/checkout
Creates a Stripe Checkout session for subscribing to a plan.
Requires Firebase Auth (Authorization + X-Firebase-AppCheck headers).
Parameter
Type
Required
Description
The plan to subscribe to: guru or pro.
Request Example
Redirect the user to checkout_url to complete payment. Stripe Checkout supports credit/debit cards, Google Pay, Apple Pay, and Link.
Error Responses
Missing or invalid Firebase authentication
User already has an active subscription
POST /billing/topup
Creates a Stripe Checkout session for a one-time credit purchase. Top-up credits do not expire at the end of the billing cycle.
Requires Firebase Auth (Authorization + X-Firebase-AppCheck headers).
Parameter
Type
Required
Description
Top-up tier: small, medium, or large.
Request Example
Error Responses
Invalid top-up tier specified
Missing or invalid Firebase authentication
POST /billing/portal
Returns a URL to the Stripe Customer Portal where users can manage their subscription, update payment methods, and view invoices.
Requires Firebase Auth (Authorization + X-Firebase-AppCheck headers).
No request body required.
Request Example
Error Responses
Missing or invalid Firebase authentication
No Stripe customer record found for this user
POST /billing/sync-balance
Forces an immediate refresh of the user's cached credit balance. Use this after redeeming a voucher or promo code to reflect the updated balance without waiting for cache expiry.
Requires one of:
X-Api-Key header with a valid API key
Authorization and X-Firebase-AppCheck headers for browser-based auth
No request body required.
Request Example
Error Responses
Missing or invalid authentication
POST /billing/webhook
Stripe webhook endpoint. This is called directly by Stripe and is not intended for client use. It requires a valid Stripe webhook signature in the Stripe-Signature header.
checkout.session.completed
Provision subscription or top-up credits
customer.subscription.created
Activate plan and allocate monthly credits
customer.subscription.updated
Handle plan upgrades/downgrades
customer.subscription.deleted
Confirm payment and reset monthly credits
Flag account for follow-up
customer.subscription.trial_will_end
Send trial expiry notification
payment_intent.payment_failed
Link Stripe customer to Firebase user
Admin Endpoints
The following endpoints require the authenticated user to have the admin role set in their Firestore user document.
GET /admin/usage
Returns platform-wide analytics including total requests, total credits consumed, active users, and usage trends.
Requires Firebase Auth with admin role.
Request Example
Error Responses
Missing or invalid authentication
User does not have admin role
GET /admin/model-economics
Returns per-model cost versus revenue breakdown, showing the platform's margin on each model.
Requires Firebase Auth with admin role.
Request Example
Model Economics Object
Total requests to this model in the period.
Total input tokens processed.
Total output tokens generated.
Total cost paid to the upstream provider in USD.
Total credits charged to users.
Total revenue in USD (credits / 1000).
Profit margin percentage: (revenue - cost) / revenue * 100.
Error Responses
Missing or invalid authentication
User does not have admin role