Add Charm Hyper balance provider - #2476
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 28, 2026, 6:12 AM ET / 10:12 UTC. ClawSweeper reviewWhat this changesAdds Charm Hyper as an opt-in API-key provider that fetches a remaining Hypercredit balance and displays it in CodexBar’s menu bar, provider card, CLI, settings, diagnostics, documentation, and tests. Merge readinessKeep this PR open for a maintainer decision rather than closing either candidate: it has credible live endpoint proof and a focused API-key design, but it overlaps the still-open Charm Hyper implementation at #2379. The two paths should be consolidated before a provider contract is merged. Priority: P3 Review scores
Verification
How this fits togetherCodexBar resolves provider credentials from environment variables, saved provider settings, and token accounts, then normalizes provider responses into usage snapshots. Those snapshots feed menu-bar text, detail cards, diagnostics, and CLI output. flowchart LR
A[API key or token account] --> B[Charm Hyper provider]
B --> C[Credits API request]
C --> D[Hypercredit balance snapshot]
D --> E[Menu bar]
D --> F[Provider card]
D --> G[CLI and diagnostics]
Decision needed
Why: Both open PRs address the same capability, while this PR deliberately limits v1 to the documented credits endpoint and avoids cookie/OAuth scope. Selecting the durable provider contract and consolidation path needs maintainer intent. Before merge
Agent review detailsSecurityNone. Review metrics
Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Choose one Charm Hyper implementation, preserve the documented Do we have a high-confidence way to reproduce the issue? Not applicable: this PR adds a provider capability rather than repairing established failing behavior. Its redacted live request is after-fix feature proof, not a bug reproduction. Is this the best way to solve the issue? Unclear: the API-key-only balance design is narrow and evidence-backed, but maintainers must select it as the permanent v1 scope and consolidate it with #2379 before merge. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 02b4ba278c81. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
Status from maintainer triage: your implementation (API-key-only, native HC balance) and #2379 ( Direction we're leaning: support both auth paths rather than picking one — API key when present, and a signed-in session when available (preferring the richer source) — consistent with how most CodexBar providers behave. We'll converge the two PRs into that shape once testing is possible, crediting both of you. Heads up: this branch is now conflicted against main (Qwen Cloud, ZoomMate, and Alibaba Personal providers landed, which moved provider counts, registries, docs, and the generated parser hash). No need to churn on rebases until the direction is settled. Thanks @akshayprabhu200! |
|
Update on Charm Hyper: Peter is on the Charm Hyper waitlist, so we can't verify either implementation against a live account just yet. Rather than leave two competing PRs sitting stale, we're combining them into a single new PR that implements both auth paths:
Both of you will be credited as co-authors on the combined PR. It'll be prepared, tested, and CI-green so it can merge the moment account access comes through and the live behavior checks out. We'll link it here when it's up — thanks for the work and the patience, @JavaGT and @akshayprabhu200. |
|
The combined Charm Hyper PR is up: #2502 — "Add Charm Hyper provider (API key + session)". It implements both auth paths as planned: a signed-in Both of you are recorded as co-authors on the combined commit, and the PR credits #2379 and #2476 explicitly. It is not merging yet: Peter is on the Charm Hyper waitlist, so nobody has confirmed the behavior against a real account. Once access lands we'll verify session auth, the session-over-key preference and fallback, API/session balance parity, and HC rendering — then it goes in. CI is green apart from one macOS shard still queued. Keeping #2379 and #2476 open for now so you can review the combined result and flag anything we got wrong about your implementations. |
Summary
HYPER_API_KEY, saved provider keys, and token accountsGET https://hyper.charm.land/v1/creditsendpoint and show the result as a Hypercredit balance in the menu bar, menu card, and CLIContext
Relates to #2318 and credits the original direction in #2379.
This draft differs from #2379 in two reviewed behavior details:
https://hyper.charm.land/v1/creditscontract instead of the incorrectapi.hyper.charm.landhostBalance: <amount> HCinstead of treating a balance asCost: <amount> / 0The API contract and
HYPER_API_KEYconvention are corroborated by Charm's maintained pi Hyper provider and Crush provider documentation.The implementation deliberately does not inspect browser cookies or reuse OAuth refresh tokens. It only sends an explicitly configured API key to Charm Hyper.
Hypercredit unit semantics
Charm currently documents 1 Hypercredit = 5¢ USD. This provider keeps the API's native HC balance authoritative, matching how CodexBar preserves other provider-specific credit units. It does not relabel HC as USD or hard-code a conversion into the usage snapshot, because the published rate is product pricing and may change independently of the API contract. A future presentation-only USD equivalent could be shown as approximate without replacing the HC value.
Validation
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer make checkgit diff --checkmake testwas invoked locally, but test discovery cannot start because the installed Xcode 15.3 provides Swift 5.10 while this package requires Swift 6.2; the draft PR's Xcode 26 macOS CI is the authoritative full-suite runRedacted live behavior proof
After the implementation was complete, a temporary API key was supplied only through hidden process input and used for one real request against the exact endpoint configured by this provider. The credential, authorization header, team identifier, and account identity were not logged or retained.
This establishes that the production endpoint accepts the documented bearer credential, returns the numeric
balancecontract parsed byHyperUsageFetcher, and produces the HC balance presentation covered by the focused CLI/menu regression tests. No Keychain or browser-cookie import was used.UI evidence
No runtime screenshot is included because the installed local Xcode cannot build the Swift 6.2 app. The redacted live request above verifies the production API contract, while focused model tests assert the exact menu-bar, menu-card, and CLI balance presentation.
Decision requested
Please confirm that a balance-only API-key v1 is acceptable for #2318. This remains a draft while that product decision and the full CI result are pending.