---
title: Auto-continue on balance refund (API-key providers)
---

# Auto-continue on balance refund (API-key providers)

## What it is

When you run sessions on your own API-key account at **DeepSeek** or **Kimi** and that **account runs out of credit**, the provider rejects the turn for non-payment. Omniscio first moves the session to the next row of that model family's **Who pays & who serves** list — Omniscio credits, for example — and marks the account out of credit for every session (see [model-vendors.md](model-vendors.md)). Only when no row in the list can pay does it park the session with a red **"Out of credit"** state and the provider's **Add credit** link. Normally you'd have to add credit AND then manually restart every parked session. With this feature on, a background governor watches the account balance and — the moment you top it up — **automatically continues every session that was parked out-of-balance**, with no manual restart, and **reopens the account for every list** at once, instead of leaving it to the ten-minute re-check. It's the built-in, productized version of a "poll the balance and nudge the sessions" script.

The feature is **in development and off by default**. It is gated by the setting `providerBalanceAutoResumeEnabled` and carries the feature id `provider-balance-autoresume`.

## Where to find it

There are two places this shows up. The **park** is visible in the session itself: a parked session renders **red**, labeled **"Out of credit"**, and carries the provider's recharge link in place. The **switch** is in **Settings → Lab**, under the entry **"Auto-continue on balance refund"**. There is no separate dashboard or panel for it — the governor runs in the background and reports itself through the sessions it resumes.

## How it behaves

- **The park.** An out-of-balance turn (e.g. DeepSeek "Insufficient balance" / a non-payment 402) that no other row of the list can take parks the session as a distinct `balance_parked` state — rendered **red**, labeled "Out of credit", carrying the provider's recharge link. It stays **visible** (you still have to add credit), and it's excluded from Omniscio's normal auto-recovery (which can't fund an account) — only this governor owns it.
- **The governor.** A background sweeper (~every 10 minutes) finds the `balance_parked` sessions, groups them by provider, and polls each account's balance **once** (free — a balance API call, no AI tokens). If the account is funded again (available balance above zero) it **continues** that provider's parked sessions by injecting a "please continue" turn. If the account is still empty, or the balance check itself fails (network/auth), it leaves them parked — it **never** resumes on a failed check or an empty account, so no paid turns are wasted.
- **Reopening the account.** The same balance check also covers a DeepSeek or Kimi account that is marked out of credit while its sessions have moved on to another row (so nothing is parked). Once it polls funded, the account is open again for every list straight away and its "Out of credit" inbox card goes away. Without this feature, the account comes back on its own ten-minute re-check instead.
- **Coverage.** Only providers whose account exposes a balance endpoint: **DeepSeek** and **Kimi (Moonshot)**. GLM, MiniMax, and Meta publish no balance API, so when nothing else in their list can pay, their out-of-credit sessions still park terminally (you resume those by hand), and their accounts come back only on the ten-minute re-check.
- **Bounded + safe.** Load-aware (a few resumes per tick, fewer when the machine is busy), a per-session attempt cap so a re-draining account can't loop forever, runs only on the primary app instance, and a kill switch (`AMC_DISABLE_PROVIDER_BALANCE_RESUME=1`). The API keys used to poll the balance stay in the Main process — never sent to the renderer, never logged.

### Turning it on

Settings → Lab → **"Auto-continue on balance refund"** (`providerBalanceAutoResumeEnabled`), or set `AMC_SHOW_PROVIDER_BALANCE_AUTORESUME=1`. When it graduates from in-development it defaults **on** for everyone (and stays toggle-off-able).

## For agents

The gate is the flat setting `providerBalanceAutoResumeEnabled`; the feature id is `provider-balance-autoresume`, and the escape hatch is `AMC_DISABLE_PROVIDER_BALANCE_RESUME=1`. The full invariants — the park state's name, the sweep cadence, the coverage rule, and the kill switch — live in the `provider-balance-autoresume-contract` contract, which is the file to read before changing any of them.

## Related

The low-balance **alert** is a different job from this feature and has its own page: [kimi-balance-monitor.md](kimi-balance-monitor.md) warns you before or after a balance change, while this feature resumes the sessions once they are funded — read both together, because they are easy to confuse. What happens before a session ever parks — moving to the next way to pay, and the account being skipped by every session — is on [model-vendors.md](model-vendors.md). The providers this actually covers are described in [deepseek-provider.md](deepseek-provider.md) and [kimi-provider.md](kimi-provider.md), and where their credentials live is [api-keys.md](api-keys.md). If several accounts for the same provider are in play, [account-pool.md](account-pool.md) explains how sessions are distributed across them.
