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:
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 ofpremiumto cut the cost by up to 3x per page.

