Perplexity: API-platform credits not read; /rest/billing/credits returns 404 no_ubb_customer for API-only accounts
Follow-up to #1592 (closed as stale for lack of authenticated evidence). Here it is, sanitized.
Account: Perplexity API platform credits (console.perplexity.ai), no consumer usage-based billing. CodexBar 0.85.0.
- CodexBar calls
GET https://www.perplexity.ai/rest/billing/credits?version=2.18&source=defaultwith a valid session. Response:404 {"detail":{"error_code":"no_ubb_customer","message":"User does not have a UBB customer"}}. The same call on console.perplexity.ai gives the same 404. So the 404 in #1592 is a missing billing customer, not auth and not a removed endpoint. - The API console reads balances from
GET https://console.perplexity.ai/rest/pplx-api/v2/groups?version=2.18&source=default(lists API orgs) andGET .../rest/pplx-api/v2/groups/{api_org_id}?version=2.18&source=default→ 200 withcustomerInfo.balance,customerInfo.pending_balance,customerInfo.spend.total_spendandcustomerInfo.auto_top_up_amount.
Request: when billing/credits returns no_ubb_customer, fall back to the API groups endpoints (console.perplexity.ai cookies) and show balance and spend per API org, like the org-pool work in #4828.
Codex review: this still needs some work.
Summary Keep open: API-console accounts remain unsupported on current main, and the reporter has supplied substantial new evidence in response to the maintainer’s request.
Reproducibility: Source deterministically throws on the reported structured 404 without requesting console groups; no live account probe or executable regression was run in this read-only review.
Maintainer decision needed
- Question: Does the new evidence justify implementing per-organization USD balances first while deferring pending amounts and spend?
- Recommendation: Implement verified balances first: Accept the reported USD balance contract, retain this issue for deferred spend support, and require fixture-based fallback and presentation regressions before a PR.
- Why: The response shapes and balance example address much of the maintainer’s request, but the reporter explicitly cannot establish pending-balance meaning or the spend period.
Next step Peter should assess the new balance evidence and choose whether to implement balances first or await confirmed pending-balance and spend semantics.
Review details
Best possible solution:
Support separately labeled API-organization USD balances and spend with verified semantics, scoped console credentials, and no invented billing period or cross-organization total.
Do we have a high-confidence way to reproduce the issue?
Source deterministically throws on the reported structured 404 without requesting console groups; no live account probe or executable regression was run in this read-only review.
Is this the best way to solve the issue?
A fallback keyed to no_ubb_customer fits the reported account distinction, but console credentials and dollar amounts need their own handling rather than reuse of consumer credit-pool arithmetic.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
- The reporter observed pending_balance only at zero and could not confirm whether spend.total_spend is all-time or period-specific.
- Console cookie acquisition and multiple-organization presentation have not been verified against live accounts.
Codex review notes: model internal, reasoning medium; reviewed against 44839248b5ba.
Label changes
Label changes:
- add
clawsweeper:needs-product-decision: Current issue advisory state selects this label.
Label justifications:
P2: API-only accounts lack financial visibility in CodexBar, while the provider console remains available and no broader outage is established.impact:other: The demonstrated impact is missing API-organization balance and spend information, without established authentication or provider-routing failure.
Evidence reviewed
Acceptance criteria:
- Establish a failing transport-stub regression for no_ubb_customer before implementing the fallback.
- swift test --filter 'Perplexity|CookieProviderCutoverTests'
- Verify console-origin credential handling and per-organization USD display on QuickJS and JavaScriptCore using synthetic fixtures.
- make check
What I checked:
- Current main still terminates on the reported response: The plugin declares only www.perplexity.ai, requests /rest/billing/credits, and throws for HTTP 404 before examining its JSON error code; searches found no no_ubb_customer or API groups implementation. (
Sources/CodexBarCore/Resources/Plugins/perplexity.js:70, 44839248b5ba) - Maintainer direction and new response evidence: Peter explicitly retained this issue in https://github.com/steipete/CodexBar/issues/5167#issuecomment-7426797399. Ben Crist’s subsequent reply, posted through Verbum at https://github.com/steipete/CodexBar/issues/5167#issuecomment-7443188437, supplies sanitized list/detail shapes and reports that balance is USD, including 12.3456 rounding to $12.35 in the console. The reply expressly leaves nonzero pending_balance semantics and the spend period unconfirmed.
- Existing organization support covers a different billing contract: https://github.com/steipete/CodexBar/pull/4828 fixes exhausted Enterprise seat credits backed by consumer organization pools using balance_cents and org_* fields. It neither requests console groups nor promises API-only account support, so delivering that PR leaves this issue’s requested account type uncovered. (
Sources/CodexBarCore/Resources/Plugins/perplexity.js:130, 79438e43598d) - Earlier generic 404 is related but unproven as the same defect: https://github.com/steipete/CodexBar/issues/1592 supplied a generic HTTP 404 screenshot and closed without authenticated response evidence. Its downloaded screenshot was inspected locally and establishes neither API-only billing nor no_ubb_customer; this issue cannot establish the earlier report’s cause retrospectively.
- Documented and tested surface is consumer credit pools: Provider documentation names the consumer endpoint and recurring, bonus, purchased, and consumer organization pools. Existing parser fixtures and cookie-cutover tests exercise those contracts rather than API-console groups. (
docs/perplexity.md:40, 44839248b5ba) - Console credentials require origin-aware integration: The cookie broker validates declared domains and pins legacy manual headers to the first selected origin; a console fallback must respect that contract rather than blindly forwarding a consumer-origin header. (
Sources/CodexBarCore/Plugins/ProviderPluginCookieBroker.swift:310, 44839248b5ba)
How this review workflow works
- ClawSweeper keeps one durable marker-backed review comment per issue or PR.
- Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
- A fresh review can be triggered by eligible
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch. - PR/issue authors and users with repository write access can comment
@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only. - Maintainers can also comment
@clawsweeper reviewto request a fresh review only. - Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge; those execution lanes are retired.
- Maintainers can comment
@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.
Reviewed December 5, 2026, 2:34 PM ET / 19:34 UTC.
Thanks for the sanitized evidence. We confirmed that current main stops on this structured no_ubb_customer 404 and never requests the API-console groups endpoints; the existing organization-pool support is for consumer billing and does not cover this account type. This remains open. The remaining gap is the complete sanitized group-list/detail response shape and the units and period for balance, pending_balance, and spend.total_spend. Those details are needed to avoid presenting the wrong amounts or combining separate API organizations incorrectly. Please omit cookies, tokens, email addresses, and organization identifiers from any examples.
Open questions for Peter
[!NOTE] 🤖 Verbum (AI assistant) responding on behalf of Ben Crist
Here are the full shapes, captured today from a signed-in API-console session (CodexBar 0.85.0 account, API-only, one API org). Values are replaced by their types; ids, names, emails, addresses, Stripe ids and card details are omitted.
GET https://console.perplexity.ai/rest/pplx-api/v2/groups?version=2.18&source=default → 200
{"orgs":[{"api_org_id":"string","display_name":"string","description":"string","user_role":"string",
"runtime_settings":{"usage_tier":"number","search_zdr_enabled":"boolean","block_api_key_creation":"boolean",
"is_api_key_creation_disabled_by_org_admin":"boolean","block_api_token_usage":"boolean"},
"is_default_org":"boolean"}]}
GET https://console.perplexity.ai/rest/pplx-api/v2/groups/{api_org_id}?version=2.18&source=default → 200
{"apiOrganization":{ /* same object as one entry of orgs[] */ },
"customerInfo":{"user_id":"string","name":"string","contact_info":{ /* email and postal address, omitted */ },
"is_pro":"boolean","auto_top_up_amount":"number","auto_top_up_threshold":"number",
"balance":"number","pending_balance":"number","stripe_customer_id":"string","customer_portal_url":"string",
"spend":{"total_spend":"number","start_time":null,"details":null},
"created_timestamp":"string","billing_in_arrears_mode":"boolean","is_stripe_migrated":"boolean",
"is_partner_managed":"boolean","acquisition_channel":null},
"hasDefaultPaymentMethod":"boolean","manualTopupPaymentRecoveryEnabled":"boolean",
"taxInfo":{"tax_id_type":null,"tax_id_value":null},
"defaultPaymentMethodCard":{"id":"string","brand":"string","last_digits":"string"}}
Units and period, as observed:
balanceis US dollars as an unrounded float (e.g.12.3456…). The console's billing page shows the same value rounded to cents ("$12.35 remaining" for that example).pending_balanceis0here, also a dollar float by its sibling; I have no pending top-up to show a non-zero value.spend.total_spendis dollars (two decimals, e.g.7.25). Withstart_time: nullanddetails: nullit reads as all-time spend for the org, not a billing period; I can't confirm that from one account.- Balance and spend are per API org (
customerInfocomes back under each/groups/{api_org_id}), so separate orgs should be shown separately, not summed. This account has only one org, so I can't show two side by side.