Billing & Subscriptions
All billing endpoints require authentication unless noted otherwise.
Authorization: Bearer YOUR_AUTH_TOKENSubscribe (checkout)
Section titled “Subscribe (checkout)”POST /api/billing/checkoutStart a subscription checkout. Returns a payment URL (Stripe) or wallet instructions (USDC).
Request body
Section titled “Request body”| Parameter | Type | Required | Description |
|---|---|---|---|
planSlug | string | Yes | standard or pro |
method | string | Yes | stripe or usdc |
Stripe checkout
Section titled “Stripe checkout”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.
USDC checkout
Section titled “USDC checkout”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.
Verify USDC payment
Section titled “Verify USDC payment”POST /api/billing/verify-paymentAfter sending USDC on-chain, call this endpoint with the transaction hash to activate your subscription.
Request body
Section titled “Request body”| Parameter | Type | Required | Description |
|---|---|---|---|
txHash | string | Yes | Base L2 transaction hash |
planSlug | string | Yes | standard or pro |
Example
Section titled “Example”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"}'Response
Section titled “Response”{ "activated": true, "expiresAt": "2026-03-15T10:00:00.000Z"}The backend verifies the USDC transfer on-chain (correct recipient, correct amount) before activating.
Subscription status
Section titled “Subscription status”GET /api/billing/statusReturns the current subscription and billing state.
Example
Section titled “Example”curl https://api.cheapestinference.com/api/billing/status \ -H "Authorization: Bearer YOUR_AUTH_TOKEN"Response
Section titled “Response”{ "plan": "pro", "status": "active", "subscriptionExpiresAt": "2026-03-15T10:00:00.000Z", "stripeCustomerId": "cus_...", "creditBalance": "25.00"}| Field | Description |
|---|---|
plan | Current plan slug (standard, pro, or null) |
status | active, expired, pending, or null |
subscriptionExpiresAt | When the current 30-day period ends |
creditBalance | Pay-as-you-go credit balance in USD |
If
statusisactivebutsubscriptionExpiresAtis in the past, the endpoint automatically marks the subscription as expired and returnsexpired.
Cancel subscription
Section titled “Cancel subscription”POST /api/billing/cancelCancels your subscription. Keys remain active until the current period expires.
Example
Section titled “Example”curl -X POST https://api.cheapestinference.com/api/billing/cancel \ -H "Authorization: Bearer YOUR_AUTH_TOKEN"Response
Section titled “Response”{ "canceled": true, "expiresAt": "2026-03-15T10:00:00.000Z"}Payment address
Section titled “Payment address”GET /api/billing/payment-addressReturns the USDC payment address and chain for direct payments.
Response
Section titled “Response”{ "address": "0x...", "chain": "base"}How subscriptions work
Section titled “How subscriptions work”- 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.
Expiration
Section titled “Expiration”An hourly cron job checks for expired subscriptions. When your subscription expires:
- All active API keys are revoked
- Your subscription status is set to
expired - Your plan is cleared
Credit keys are not affected by subscription expiration — they remain active as long as you have credit balance.