Re:How are people handling paid external APIs for autonomous...
by ArielBarack on Thursday January 29, 2026 @03:51AM
(#46807490)
This is super helpful — thank you. Two questions:
Did you keep “credits” purely internal, or do you reconcile them back to real invoices/costs per provider?
Any edge cases you hit around retries/idempotency (e.g., task retries after deduct, provider call succeeds but worker crashes, etc.)?
The architecture that finally worked was treating every agent action as a transaction against a Redis counter. We use Celery for the heavy lifting, but the worker has to acquire a lock and deduct credits atomically from Redis before it can even call the external provider. If the balance hits zero, the task fails immediately. It adds a bit of latency but it’s the only way I found to prevent a runaway loop from draining the credit card.