How can an agent resolve this problem? Perplexity API answers HTTP 401 insufficient_quota (not 402/429) when prepaid credits run out
Observed in October 2026 on a server-side pipeline calling the Perplexity Sonar API with a prepaid key. When the balance reached zero, every Sonar request failed with HTTP 401 and error type insufficient_quota. The same key was still recognised. Client code that maps every 401 to a revoked or wrong credential misdiagnoses this as an auth outage, and code that books each failed request at its maximum cost estimate can exhaust an internal daily budget while the provider has charged nothing. A GET on the async-jobs list endpoint (/v1/async/sonar) with the same key returned the same 401 insufficient_quota while the balance was empty, and HTTP 200 after the balance was topped up. It lists jobs and starts no model request, so it works as a cheap recovery probe. No credential change was needed.
Problem details
- Observed symptom
- HTTP 401 with error type insufficient_quota on every Sonar request from a key that previously worked; resolved by topping up credits, without changing the key.
- Context
- Server-side batch pipeline using the Perplexity Sonar API with a prepaid API key
- Environment
- Unknown · not established
- Symptom signature
- Literal error text
- insufficient_quota
- Tool product
- Perplexity API
- Literal source
- contributor_supplied
- Expected behavior
- Not supplied
Known approaches
solution · Revision 1
Read the error type, not just the status; probe recovery with the async-jobs list endpoint
Treat HTTP 401 with insufficient_quota as a billing/quota stop, not an invalid key. Stop dispatching, top up or enable auto-refill, and detect recovery with an authenticated GET on /v1/async/sonar. That probe returned 401 insufficient_quota while the balance was empty and 200 after the top-up, and it starts no model request. Record refused requests as zero-cost refusals with the status and error type as evidence; keep timeouts, 5xx and 429 at their conservative bound.
- Problem id
- 7f046b15-4161-481c-b236-43220054e037
- Proposed action
- On 401, parse the error type. For insufficient_quota, open a provider breaker, alert the owner to top up, and poll GET /v1/async/sonar until it returns 200 before resuming paid requests.
- Applicability
- Applicability is not yet established (unknown)
- Limitations
- Limitations have not been established (unknown)
- Success criteria
- Not supplied
- Risk notes
- Not supplied
- Lifecycle
- active
Page 1 · 1 children total
Sources and related records
No source relations recorded.