Skip to content

Credits & Top-ups

Credits let you use the API without a monthly subscription. Top up your balance, and usage is deducted automatically until your credits run out.

All endpoints require authentication.

POST /api/billing/topup
ParameterTypeRequiredDescription
amountnumberYesTop-up amount in USD (minimum $10)
methodstringYesstripe, stripe_direct, or usdc
Terminal window
curl -X POST https://api.cheapestinference.com/api/billing/topup \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"amount": 50, "method": "stripe"}'
{
"success": true,
"data": {
"sessionUrl": "https://checkout.stripe.com/c/pay/cs_live_...",
"sessionId": "cs_live_..."
}
}
Terminal window
curl -X POST https://api.cheapestinference.com/api/billing/topup \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"amount": 50, "method": "usdc"}'
{
"success": true,
"data": {
"address": "0x...",
"chain": "base",
"amount": "50"
}
}

POST /api/billing/verify-topup

After sending USDC on-chain, verify the transaction to credit your account.

ParameterTypeRequiredDescription
txHashstringYesBase L2 transaction hash
amountnumberYesAmount sent (must match)
Terminal window
curl -X POST https://api.cheapestinference.com/api/billing/verify-topup \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"txHash": "0xabc123...", "amount": 25}'
{
"success": true,
"data": {
"credited": 25,
"balance": 75.00
}
}

GET /api/billing/credits

Returns your current credit balance and usage.

Terminal window
curl https://api.cheapestinference.com/api/billing/credits \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"
{
"success": true,
"data": {
"totalTopUp": 100,
"remaining": 74.50,
"hasCreditKey": true,
"creditKeyCount": 2,
"userId": "ci_user_xxx"
}
}
FieldDescription
totalTopUpTotal amount you’ve ever topped up (number)
remainingCurrent available balance in USD (number, real-time)
hasCreditKeyWhether you have at least one credit key
creditKeyCountNumber of active credit keys
userIdInternal user ID for budget tracking (null until first top-up)

After topping up, create a credit key via POST /api/keys/credit or from the dashboard. Credit keys use budget-based tracking instead of subscription-based rate limits.

  • The credit key has a 60 RPM rate limit
  • There is no token-per-minute limit — spend is tracked in USD
  • The system tracks max_budget and spend for the key
  • When spend >= max_budget, further requests fail with a budget error

All credit usage for your account goes through your single credit key. The balance is shared — if you use it from multiple applications, they all draw from the same pool.

Each top-up adds to your existing budget:

Current max_budget: $50, spent: $20 (remaining: $30)
Top up $25
New max_budget: $75, spent: $20 (remaining: $55)
SubscriptionCredits
Payment$20 or $60/month (one-time, 30 days)$10+ per top-up
Rate limitsRPM + TPM per key60 RPM only
BillingFlat rate, unlimited usage within limitsPay per token used
Expiration30 days, then keys revokedNever expires, consumed until depleted
Key creationManual, choose name and planManual via API or dashboard after top-up

You can have both an active subscription and credits simultaneously. Subscription keys use rate-limited access; credit keys use budget-based access.