Draggable, resizable usage-limits panel with dark/light theme memory
< Valutazione su Perplexity – Usage Limits & Settings
Something is wrong on your side. I just tested it and everything worked fine.
Maybe you have an adblocker that prevent your browser to reach Perplexity API. It's good. I also be your user script manager, personally I use Tampermonkey.
Actually, not pi-hole, which has been running since before I ever installed the script, but something in Chrome. I ran the script on a different machine and it is fine.
Unfortunately, there doesn't seem to be a way to delete the earlier post. Thanks for taking the time to respond and your writing a useful script.
Use the devtools to track where is the problem in the network tabs.
This way you will see what thing is blocking the perplexity API.
Maybe it could be an updated blocking list on the piehole 🤔
I recently investigated this issue thoroughly by capturing network traffic (HAR logs) and reproducing the requests against Perplexity's backend. The issue where all items show 0 is not caused by Adblockers or Pi-hole, but by recent changes in Perplexity's API gateway requirements and session routing.
Mandatory Client Signature Headers:
Perplexity’s Cloudflare WAF now enforces client signature validation on internal REST endpoints (/rest/rate-limit/all and /rest/user/settings). Requests sent via plain fetch() without x-app-apiclient and x-app-apiversion are either challenged by Cloudflare or dropped to unauthenticated fallback responses.
Multi-Tenant Account Routing (x-pplx-account):
Perplexity recently updated its session architecture to __Secure-pplx.session.<user_uuid>. For /rest/rate-limit/all and /rest/user/settings, the server now strictly requires the header:
x-pplx-account: <your_user_id>
If this header is missing, the server does not associate the request with your Pro session and silently treats it as a guest/unauthenticated user, returning remaining_pro: 0, remaining_research: 0, and upload_limit: 0 (HTTP 200 with all-zero values).
/api/auth/session?version=2.18&source=default (which works with browser cookies) to retrieve the user's id, and optionally cache it. Also passively capture x-pplx-account from the page's native fetch requests.x-app-apiclient: default, x-app-apiversion: 2.18, and x-pplx-account: <user_id>.?version=2.18&source=default.Here is the minimal and verified patch against 5.0.4:
+ // ── ACCOUNT RESOLUTION ─────────────────────────────────────────────────────
+ let _accountId = null;
+ async function getAccountId() {
+ if (_accountId) return _accountId;
+ try {
+ const res = await fetch('/api/auth/session?version=2.18&source=default', {
+ credentials: 'include',
+ headers: { 'x-app-apiclient': 'default', 'x-app-apiversion': '2.18' }
+ });
+ const data = await res.json();
+ if (data?.user?.id) _accountId = data.user.id;
+ } catch (_) {}
+ return _accountId;
+ }
+
// ── FETCH & RENDER ─────────────────────────────────────────────────────────
@@ -395,4 +409,9 @@
- const [r1, r2] = await Promise.allSettled([
- fetch('/rest/rate-limit/all', { credentials: 'include' }).then(r => r.json()),
- fetch('/rest/user/settings', { credentials: 'include' }).then(r => r.json()),
- ]);
+ const acc = await getAccountId();
+ const reqHeaders = {
+ 'x-app-apiclient': 'default',
+ 'x-app-apiversion': '2.18',
+ ...(acc ? { 'x-pplx-account': acc } : {})
+ };
+ const [r1, r2] = await Promise.allSettled([
+ fetch('/rest/rate-limit/all?version=2.18&source=default', { credentials: 'include', headers: reqHeaders }).then(r => r.json()),
+ fetch('/rest/user/settings?skip_connector_picker_credentials=true&version=2.18&source=default', { credentials: 'include', headers: reqHeaders }).then(r => r.json()),
+ ]);
@@ -428,2 +447,5 @@
window.fetch = function (...a) {
try {
+ const hdrs = a[1]?.headers;
+ const acc = hdrs?.['x-pplx-account'] || (typeof hdrs?.get === 'function' ? hdrs.get('x-pplx-account') : null);
+ if (acc) _accountId = acc;
Tested and verified on Chromium and Firefox/LibreWolf with active Pro subscriptions. Applying this immediately restores accurate quota counters and account settings.
Hope this helps resolve the issue for everyone!
The script has been working well until the last week when all the items are showing O (zero).