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.
Top up credits
Section titled “Top up credits”POST /api/billing/topupRequest body
Section titled “Request body”| Parameter | Type | Required | Description |
|---|---|---|---|
amount | number | Yes | Top-up amount in USD (minimum $10) |
method | string | Yes | stripe or usdc |
Stripe top-up
Section titled “Stripe top-up”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"}'{ "sessionUrl": "https://checkout.stripe.com/c/pay/cs_live_...", "sessionId": "cs_live_..."}USDC top-up
Section titled “USDC top-up”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"}'{ "address": "0x...", "chain": "base", "amount": 25}Verify USDC top-up
Section titled “Verify USDC top-up”POST /api/billing/verify-topupAfter sending USDC on-chain, verify the transaction to credit your account.
Request body
Section titled “Request body”| Parameter | Type | Required | Description |
|---|---|---|---|
txHash | string | Yes | Base L2 transaction hash |
amount | number | Yes | Amount sent (must match) |
Example
Section titled “Example”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}'Response
Section titled “Response”{ "credited": 25, "balance": "75.00"}Check credit balance
Section titled “Check credit balance”GET /api/billing/creditsReturns your current credit balance and usage.
Example
Section titled “Example”curl https://api.cheapestinference.com/api/billing/credits \ -H "Authorization: Bearer YOUR_AUTH_TOKEN"Response
Section titled “Response”{ "totalTopUp": "100.00", "remaining": "74.50", "hasCreditKey": true, "creditKeyId": "clx3ghi..."}| Field | Description |
|---|---|
totalTopUp | Total amount you’ve ever topped up |
remaining | Current available balance (real-time tracking) |
hasCreditKey | Whether you have a credit key |
creditKeyId | ID of your credit key (if exists) |
How credits work
Section titled “How credits work”Credit key
Section titled “Credit key”When you make your first top-up, a credit key is automatically created. This is a special API key with plan credits that uses 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_budgetandspendfor the key - When
spend >= max_budget, further requests fail with a budget error
Shared balance
Section titled “Shared balance”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.
Top-up accumulation
Section titled “Top-up accumulation”Each top-up adds to your existing budget:
Current max_budget: $50, spent: $20 (remaining: $30)Top up $25New max_budget: $75, spent: $20 (remaining: $55)Credits vs. Subscriptions
Section titled “Credits vs. Subscriptions”| Subscription | Credits | |
|---|---|---|
| Payment | $20 or $60/month (one-time, 30 days) | $10+ per top-up |
| Rate limits | RPM + TPM per key | 60 RPM only |
| Billing | Flat rate, unlimited usage within limits | Pay per token used |
| Expiration | 30 days, then keys revoked | Never expires, consumed until depleted |
| Key creation | Manual, choose name and plan | Automatic on first top-up |
You can have both an active subscription and credits simultaneously. Subscription keys use rate-limited access; credit keys use budget-based access.