Choose Auto, TokenLab Verified, or Official for each request, with prices shown up front. See what's new

AI API Credit Auto Recharge: How TokenLab Auto Recharge Works

·September 19, 2026·9 min read·Updated November 11, 2026·2130 views
#feature#billing#auto-recharge#ai-api
AI API Credit Auto Recharge: How TokenLab Auto Recharge Works

What you’ll learn

  • Can I configure TokenLab auto recharge with an API?
  • What are the default trigger and restore amounts?
  • What happens if my card is declined during a recharge?
  • How can I check my balance from code?
  • Is TokenLab auto recharge enabled by default?

When an API balance runs out, every request that the balance cannot cover fails with 402 insufficient_balance. TokenLab auto recharge is a workspace setting that avoids this stop. When the balance falls below a trigger amount, TokenLab charges your saved card and brings the balance back up to a restore amount. The dashboard calls the setting Automatic funding. This guide shows where to turn it on, how the trigger works, the default amounts and limits, what happens when a payment fails, and how to watch your balance from code.

Key Takeaways

  • Auto recharge is off by default. A workspace admin or owner turns it on from the Billing page, and a saved card is required. Cards are saved through Stripe.
  • Defaults are a trigger of $5, a restore amount of $30, and a monthly limit of $300. The monthly limit can be at most $10,000.
  • Each recharge adds the restore amount minus the current balance, not a fixed sum. The smallest recharge is $1.
  • If a payment fails, TokenLab does not retry. It turns auto recharge off and emails the workspace owner.
  • Auto recharge has no API and no webhook event. To watch the balance from your own system, use GET /v1/management/balance.

How to Turn On Auto Recharge

  1. Sign in as a workspace admin or owner and open the Billing page. Find the Automatic funding section next to the top-up options, and select Modify.
  2. Under Payment method, select Add payment method if no card is saved. TokenLab opens a Stripe page that saves a card. Only cards are supported, and auto recharge cannot be enabled without a saved card.
  3. Switch on Enable automatic funding.
  4. Set When balance drops below. This is the trigger amount.
  5. Set Restore balance to. This is the restore amount. It must be higher than the trigger amount.
  6. Check Monthly limit. It is on by default at $300. It must be at least the restore amount minus the trigger amount. A single recharge can still be larger than that when the balance has already fallen below the trigger, so leave headroom.
  7. Select Save. The page then shows a sentence such as "Automatic funding is on: when your balance drops below $5.00, we'll restore it to $30.00."

The defaults suit a workspace that is testing the API. A production agent or a customer-facing chatbot usually needs higher amounts. The sizing section below shows how to choose them.

Size the Trigger, Restore Amount, and Monthly Limit

A recharge adds the restore amount minus the balance at the moment it runs. With the defaults, a balance of $4.20 gets $25.80. Cost per token differs a lot between models, so the same amounts last for very different times. The table shows what a day with 10 million input tokens and 1 million output tokens costs on five models.

Model Price shown Input ($ per 1M tokens) Output ($ per 1M tokens) 10M input + 1M output ($)
Claude Sonnet 5 Verified $0.70 $3.50 $10.50
GPT-5.5 Verified $3.50 $21.00 $56.00
Gemini 3.6 Flash Verified $0.75 $3.75 $11.25
DeepSeek V4.1 Flash Official $0.15 $0.60 $2.10
GLM-5.2 Official $1.40 $4.40 $18.40

Prices read 2026-11-11 from the TokenLab pricing API. Models without a Verified offer, such as DeepSeek V4.1 Flash and GLM-5.2, bill at the Official price. GPT-5.5 doubles its input price and raises its output price by half for requests above 272K input tokens. DeepSeek V4.1 Flash has separate peak and off-peak prices, and the table shows off-peak. The model list has the current price of every model.

Example: with the default amounts, each recharge adds about $25. A GPT-5.5 workload that costs $56 per day triggers about 2.2 recharges per day, and the $300 monthly limit lasts about 5 days. The same token volume on DeepSeek V4.1 Flash costs $2.10 per day, about $63 in 30 days, which is well inside a $300 limit. Raise the monthly limit before you reach it, based on your real model mix and daily spend.

How the Trigger Works

Auto recharge does not poll your balance on a timer. After a request settles, TokenLab compares the balance with your trigger amount. If the balance is below it, a recharge check runs. The check reads the current balance again, so an old event cannot charge you for a balance that has already been refilled.

The check does nothing when:

  • The balance is at or above the trigger amount.
  • Another auto recharge for the workspace has not finished yet.
  • A recharge for the same workspace is already starting.
  • The amount to add is below $1.

The check turns auto recharge off, and shows the reason on the Billing page, when:

  • No saved card is found.
  • The next recharge would push the month above your monthly limit. The page shows "Monthly limit reached". The limit counts recharges in the current UTC month. Auto recharge stays off until an admin raises the limit if needed and turns it on again.

When a recharge runs, TokenLab creates a Stripe invoice in USD for the amount to add and charges the saved card. When Stripe confirms the payment, TokenLab adds that amount to the balance once, adds it to the monthly total, and emails the owner a payment confirmation. The balance changes after the payment is confirmed, not at the moment of the trigger.

What Happens When the Card Is Declined

If the payment fails, or the bank asks for more verification such as 3D Secure, TokenLab marks the recharge transaction as failed. It turns auto recharge off and sets its status to payment_failed or requires_action. It also emails the workspace owner. The Billing page shows "Automatic funding failed" and links to the transaction list.

TokenLab does not retry a failed payment, and it does not fall back to a second card. Auto recharge stays off, so you always know that it is not covering you. Requests that the balance cannot cover fail with 402 insufficient_balance until the balance is refilled.

To recover:

  1. Open the Billing page and select Modify.
  2. Under Payment method, select Update payment method and save a working card.
  3. Switch on Enable automatic funding again and select Save.
  4. Open View transactions to see the failed recharge and any later recharge.

Send payment failure emails to someone who reads them. Do not rely on the email alone: watch the balance as described in the next section.

Is There an API or Webhook for Auto Recharge?

No. The trigger amount, restore amount, monthly limit, and card are set in the dashboard by an admin or owner. There is no public API endpoint for these settings. Workspace webhooks cover async task events only (task.completed, task.failed, and task.timeout), not recharges.

You can still read the balance from your own code. GET /v1/management/balance returns the workspace balance with a management token (mt-...), which you create in Dashboard → API → Management Tokens. The Management API balance endpoint guide and the Get Workspace Balance reference describe the response.

import os
from decimal import Decimal

import requests

response = requests.get(
    "https://api.tokenlab.sh/v1/management/balance",
    headers={"Authorization": f"Bearer {os.environ['TOKENLAB_MANAGEMENT_TOKEN']}"},
    timeout=15,
)
response.raise_for_status()
balance = Decimal(response.json()["balance_decimal"])

TRIGGER = Decimal("5")  # your auto recharge trigger amount
if balance < TRIGGER:
    print(f"Balance {balance} USD is below the trigger amount")

Run this check on a schedule and alert your team when the balance stays below the trigger amount on two reads in a row. A working auto recharge refills the balance, so a balance that stays low means the recharge did not run or failed. A rising total_recharge_decimal between two reads shows that a recharge or top-up completed. You can also set a low-balance email alert in Console → Settings.

Limits and Defaults

Setting Dashboard label Default Rule
Trigger amount When balance drops below $5 Up to $10,000, and lower than the restore amount
Restore amount Restore balance to $30 $1 to $10,000, and higher than the trigger amount
Monthly limit Monthly limit $300, on $1 to $10,000, and at least the restore amount minus the trigger amount. Can be switched off.

Who Should Turn It On

Manual top-ups are enough for small, predictable usage. Turn on auto recharge when an empty balance would cost you more than the card charge:

  • Autonomous agents. A stuck loop can spend a balance faster than a person notices.
  • Customer-facing chatbots. Traffic follows your own product usage, so a weekend spike should not become a Monday outage.
  • Burst workloads. Image and video jobs cluster around launches and content batches.
  • Scheduled batch jobs. A failure in the middle of a nightly run is expensive to diagnose and rerun.

Before you rely on it:

  1. Use a card that will not expire soon. Only one card is saved.
  2. Set the trigger high enough that your requests do not empty the balance while a recharge is being paid.
  3. Set the restore amount to cover your busiest period, using the price table above.
  4. Set a monthly limit with real headroom. Reaching it turns auto recharge off.
  5. Add your own balance check, and read the failure emails.

Auto recharge is a safety net, not a budget. It solves one problem: running out of credit in the middle of a workload. The monthly limit exists so that it cannot spend without bound.

FAQ

Can I configure TokenLab auto recharge with an API?

No. A workspace admin or owner sets the trigger amount, restore amount, monthly limit, and card on the Billing page. There is no public API endpoint for these settings.

What are the default trigger and restore amounts?

The defaults are a trigger of $5, a restore amount of $30, and a monthly limit of $300. The monthly limit can be at most $10,000.

What happens if my card is declined during a recharge?

TokenLab marks the transaction failed, turns auto recharge off, sets its status to payment_failed or requires_action, and emails the workspace owner. It does not retry. After you update the card, switch auto recharge on again.

How can I check my balance from code?

Call GET /v1/management/balance with a management token. The response has balance_decimal, total_recharge_decimal, and total_used_decimal as exact decimal strings.

Is TokenLab auto recharge enabled by default?

No. It is off by default for each workspace, and a saved card is required before it can be turned on.

Turn it on from the Billing page, or compare current prices on the model list first to size your amounts.

Sources

Prices checked 2026-11-11

Prepared by TokenLab's AI agents. Facts are checked against the linked primary sources on the date shown.

Related models

Recent model releases

Try the models from this article

Chat, create images, or make video with the same TokenLab balance.

Your first API call

Get your API key
curl https://api.tokenlab.sh/v1/chat/completions \
  -H "Authorization: Bearer $TOKENLAB_API_KEY" -H "Content-Type: application/json" \
  -d '{"model":"deepseek-v4.1-flash","messages":[{"role":"user","content":"Hello!"}]}'