Subscriptions & Plans

Manage subscription plans with Stripe-powered billing, automatic credit grants, and feature access control.

How Subscriptions Work

1

Browse plans

Fetch available plans with their features and pricing. Plans control rate limits, feature access, and monthly credit grants.

2

Create checkout session

Redirect the user to Stripe Checkout to complete payment. Supports monthly and yearly billing.

3

Automatic activation

After payment, the Stripe webhook activates the subscription, grants credits, and unlocks plan features — all automatically.

List Plans

GET/v1/plansPublic

Fetch all publicly available subscription plans with their features and pricing:

Bash
curl https://api.llmhub.one/v1/plans

Response

json
[
  {
    "id": "plan-free",
    "name": "Free",
    "slug": "free",
    "description": "Get started with basic access",
    "monthly_price_cents": 0,
    "yearly_price_cents": 0,
    "features": {
      "max_requests_per_minute": 10,
      "max_requests_per_day": 100,
      "max_agents": 1,
      "max_rag_servers": 1,
      "image_generation": false,
      "workflows": false,
      "sabine": false
    },
    "sort_order": 1
  },
  {
    "id": "plan-pro",
    "name": "Pro",
    "slug": "pro",
    "description": "For professionals and power users",
    "monthly_price_cents": 1900,
    "yearly_price_cents": 19000,
    "credit_grant_monthly": 500000,
    "features": {
      "max_requests_per_minute": 60,
      "max_requests_per_day": 5000,
      "max_agents": 10,
      "max_rag_servers": 5,
      "image_generation": true,
      "workflows": true,
      "sabine": true,
      "vision": true,
      "function_calling": true
    },
    "sort_order": 2
  }
]

Get Current Subscription

GET/v1/subscriptionAuth Required

Get your current subscription status and plan details:

Bash
curl https://api.llmhub.one/v1/subscription \
  -H "Authorization: Bearer $LLMHUB_API_KEY"

Response

json
{
  "has_subscription": true,
  "subscription": {
    "id": "sub-uuid",
    "user_id": "user-uuid",
    "plan_id": "plan-pro",
    "stripe_subscription_id": "sub_xxx",
    "status": "active",
    "interval": "monthly",
    "current_period_start": "2026-03-01T00:00:00Z",
    "current_period_end": "2026-04-01T00:00:00Z",
    "created_at": "2026-01-15T10:00:00Z"
  },
  "plan": {
    "id": "plan-pro",
    "name": "Pro",
    "slug": "pro",
    "monthly_price_cents": 1900,
    "features": { ... }
  }
}

Subscribe to a Plan

POST/v1/subscription/checkoutAuth Required

Create a Stripe Checkout session to subscribe. Redirect the user to the returned URL to complete payment.

Bash
curl -X POST https://api.llmhub.one/v1/subscription/checkout \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $LLMHUB_API_KEY" \
  -d '{
    "plan_id": "plan-pro",
    "interval": "monthly",
    "success_url": "https://yourdomain.com/dashboard?subscribed=true",
    "cancel_url": "https://yourdomain.com/dashboard/subscription"
  }'

Parameters

ParameterTypeDescription
plan_idRequiredstringID of the plan to subscribe to
intervalstringBilling interval: monthly or yearly. Default: monthly
success_urlRequiredstringRedirect URL after successful payment
cancel_urlRequiredstringRedirect URL if user cancels checkout

Response

json
{
  "checkout_url": "https://checkout.stripe.com/c/pay/cs_xxx...",
  "session_id": "cs_xxx"
}

Billing Portal

POST/v1/subscription/portalAuth Required

Open the Stripe customer portal where users can manage payment methods, view invoices, and update billing information:

Bash
curl -X POST https://api.llmhub.one/v1/subscription/portal \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $LLMHUB_API_KEY" \
  -d '{
    "return_url": "https://yourdomain.com/dashboard/subscription"
  }'

Response

json
{
  "portal_url": "https://billing.stripe.com/p/session/xxx..."
}

Cancel Subscription

POST/v1/subscription/cancelAuth Required

Cancel at the end of the current billing period. The subscription remains active until the period ends — features are not removed immediately.

Bash
curl -X POST https://api.llmhub.one/v1/subscription/cancel \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $LLMHUB_API_KEY" \
  -d '{
    "reason": "Too expensive",
    "feedback": "Would return if pricing was lower"
  }'

Response

json
{
  "message": "Subscription will be cancelled at end of billing period",
  "cancel_at": "2026-04-01T00:00:00Z",
  "subscription": {
    "id": "sub-uuid",
    "status": "active",
    "cancel_at_period_end": true,
    "current_period_end": "2026-04-01T00:00:00Z"
  }
}

Change Plan

POST/v1/subscription/change-planAuth Required

Upgrade or downgrade your plan. Stripe handles proration automatically — you'll only be charged for the difference.

Bash
curl -X POST https://api.llmhub.one/v1/subscription/change-plan \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $LLMHUB_API_KEY" \
  -d '{
    "plan_id": "plan-business",
    "interval": "yearly"
  }'

Frontend Integration

Example of a subscription checkout flow in a web application:

TypeScript
// Frontend: redirect to Stripe Checkout
async function subscribe(planId: string, interval: 'monthly' | 'yearly') {
  const response = await fetch('/v1/subscription/checkout', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${apiKey}`,
    },
    body: JSON.stringify({
      plan_id: planId,
      interval,
      success_url: window.location.origin + '/dashboard?subscribed=true',
      cancel_url: window.location.origin + '/dashboard/subscription',
    }),
  });

  const { checkout_url } = await response.json();
  window.location.href = checkout_url;
}

// After successful checkout, Stripe webhook automatically:
// 1. Creates UserSubscription record
// 2. Grants monthly credit allocation
// 3. Activates plan features

Other Endpoints

MethodEndpointDescription
GET/v1/plans/:idGet plan details by ID or slug
POST/v1/subscription/reactivateReactivate a cancelled subscription before period ends
GET/v1/subscription/historyList all past and current subscriptions
GET/v1/subscription/invoicesList invoices (last 100)