| summary | Perplexity provider: browser cookie setup, credits API, recurring/bonus/purchased credit display. | |||
|---|---|---|---|---|
| read_when |
|
CodexBar reads Perplexity account credit data with a Perplexity web session cookie. It does not use a Perplexity API key and does not support token-cost history.
- Open Settings -> Providers.
- Enable Perplexity.
- Sign in to perplexity.ai in a supported browser.
- Leave Cookie source on Automatic, or switch to Manual and paste a full
Cookie:header or a bare Perplexity session-token value.
Manual mode accepts these session cookie names:
__Secure-authjs.session-tokenauthjs.session-token__Secure-next-auth.session-tokennext-auth.session-token
You can also provide credentials through the environment:
export PERPLEXITY_SESSION_TOKEN="..."
export PERPLEXITY_COOKIE="__Secure-next-auth.session-token=..."CodexBar requests:
GET https://www.perplexity.ai/rest/billing/credits?version=2.18&source=default
The request sends the resolved Perplexity session cookie, Origin: https://www.perplexity.ai, and
Referer: https://www.perplexity.ai/account/usage.
Automatic mode tries any cached Perplexity cookie first, then imports browser cookies, then falls back to environment variables. Browser-imported cookies are cached and invalid cached cookies are cleared after a rejected request. The bundled JavaScript provider owns fetching and credit parsing on QuickJS and JavaScriptCore. It retries the four supported cookie names for a bare token, assembles numbered session-cookie chunks, and advances through browser profiles after rejected credentials. Manual mode stays exclusive and never falls back to an environment token.
- Credits: recurring account credits when Perplexity reports them.
- Bonus credits: promotional or bonus credits.
- Purchased: on-demand purchased credits.
- Organization: organization pool credits, shown when the API reports
org_pool_draws_centsororg_user_cap_cents. Used isorg_pool_draws_cents; available is the part ofbalance_centsnot covered by the member's own credits, or zero whenis_org_pool_depletedis true. The member's cap is not counted as available. - Renewal: recurring credits use the renewal timestamp when the API returns one.
The menu-bar percent picker can explicitly show Credits or Bonus credits, including when the API reports no duration. These choices use the actual credit pools without inventing a session or weekly cadence. Automatic keeps the existing recurring → purchased → bonus consumption order, then falls back to org credits.
When an org pool is reported, Organization is also available as a named percent window. With window labels enabled, Auto identifies that pool as Organization.
Purchased, bonus, and org credits do not reset, so their balances remain details in menus and CLI output. Layout reset-time tokens require an actual reset date for credit-detail windows; amounts never stand in for a reset clock.
Large finite credit counts retain their whole-number descriptions; nonfinite aggregate counts omit the description.
codexbar usage --provider perplexity --verboseSign in to perplexity.ai and refresh CodexBar, or paste a fresh cookie/session token in manual mode.
Log out and back in to Perplexity. If manual mode is enabled, paste a new Cookie: header or session-token value.
Open Perplexity account usage in the same browser profile and confirm the account has visible credit data.
Sources/CodexBarCore/Providers/Perplexity/PerplexityProviderDescriptor.swiftSources/CodexBarCore/Resources/Plugins/perplexity.jsSources/CodexBarCore/Plugins/ProviderPluginCookieBroker.swiftSources/CodexBarCore/Providers/Perplexity/PerplexityCookieHeader.swiftSources/CodexBar/Providers/Shared/PluginCookieProviderImplementation.swift