Skip to content

Billing & Subscriptions

All billing endpoints require authentication unless noted otherwise.

Authorization: Bearer YOUR_AUTH_TOKEN
POST /api/billing/checkout

Start a subscription checkout. Returns a payment URL (Stripe) or wallet instructions (USDC).

ParameterTypeRequiredDescription
planSlugstringYesstandard or pro
methodstringYesstripe or usdc
Terminal window
curl -X POST https://api.cheapestinference.com/api/billing/checkout \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"planSlug": "pro", "method": "stripe"}'
{
"sessionUrl": "https://checkout.stripe.com/c/pay/cs_live_...",
"sessionId": "cs_live_..."
}

Redirect the user to sessionUrl. After payment, Stripe sends a webhook and the subscription activates automatically.

Terminal window
curl -X POST https://api.cheapestinference.com/api/billing/checkout \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"planSlug": "pro", "method": "usdc"}'
{
"address": "0x...",
"chain": "base",
"amount": "60",
"planSlug": "pro"
}

Send the exact USDC amount to the address on Base L2, then verify the transaction.


POST /api/billing/verify-payment

After sending USDC on-chain, call this endpoint with the transaction hash to activate your subscription.

ParameterTypeRequiredDescription
txHashstringYesBase L2 transaction hash
planSlugstringYesstandard or pro
Terminal window
curl -X POST https://api.cheapestinference.com/api/billing/verify-payment \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"txHash": "0xabc123...", "planSlug": "pro"}'
{
"activated": true,
"expiresAt": "2026-03-15T10:00:00.000Z"
}

The backend verifies the USDC transfer on-chain (correct recipient, correct amount) before activating.


GET /api/billing/status

Returns the current subscription and billing state.

Terminal window
curl https://api.cheapestinference.com/api/billing/status \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"
{
"plan": "pro",
"status": "active",
"subscriptionExpiresAt": "2026-03-15T10:00:00.000Z",
"stripeCustomerId": "cus_...",
"creditBalance": "25.00"
}
FieldDescription
planCurrent plan slug (standard, pro, or null)
statusactive, expired, pending, or null
subscriptionExpiresAtWhen the current 30-day period ends
creditBalancePay-as-you-go credit balance in USD

If status is active but subscriptionExpiresAt is in the past, the endpoint automatically marks the subscription as expired and returns expired.


POST /api/billing/cancel

Cancels your subscription. Keys remain active until the current period expires.

Terminal window
curl -X POST https://api.cheapestinference.com/api/billing/cancel \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"
{
"canceled": true,
"expiresAt": "2026-03-15T10:00:00.000Z"
}

GET /api/billing/payment-address

Returns the USDC payment address and chain for direct payments.

{
"address": "0x...",
"chain": "base"
}

  • Subscriptions are 30-day one-time purchases — there is no auto-renewal.
  • After 30 days, the subscription expires and all API keys are automatically revoked.
  • To continue, purchase a new subscription and create new keys.
  • You can pay with credit card (Stripe) or USDC on Base L2.

An hourly cron job checks for expired subscriptions. When your subscription expires:

  1. All active API keys are revoked
  2. Your subscription status is set to expired
  3. Your plan is cleared

Credit keys are not affected by subscription expiration — they remain active as long as you have credit balance.