Early detection
Poll your credit balance before starting work that will consume a lot:/v1/read call), but for big batches it catches the obvious “you’re nowhere near enough” case.
Catching the 402
When/v1/read returns insufficient_credits:
The auto mode escalation edge case
The pre-flight credit check for auto mode is optimistic (1 credit per page, not 3). If auto escalates to stealth mid-request, your balance can briefly go negative, and the next request fails with insufficient_credits even though the one that caused the overdraft succeeded.
This is intentional (it mirrors Stripe’s metered billing), but it means your error handler should be able to tell the difference between “I genuinely have zero credits” and “I have zero credits because the last request escalated”. In both cases the fix is the same: top up, wait for reset, or route to a lower-cost path.
Low-credit webhook
Subscribe tocredit.low to get notified before you run out:
- Alert an operator
- Pause background workers
- Switch to a higher tier automatically (if you have a billing API)
- Queue further requests until the next reset
Graceful degradation strategies
When you’re out of credits, what should your app actually do?- Cached responses only. Set
cache: true(the default) and accept that anything not already cached is unavailable until reset. Cache hits are free. - Queue and defer. Accept user requests, queue the scrapes, run them when credits come back.
- Fail visibly to users. Better than silent corruption; show a “service degraded” banner.
- Switch to a cheaper mode. Temporarily force
proxyMode: "standard"instead ofautoto cut the cost by up to 3x per page.

