Grok: support first-party Grok Bot weekly usage alongside Credits via xAI bot.usage
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- swift
- Ambito
- backend, observability
Direzione di ricerca
Start by reading Sources/CodexBarCore/Providers/Grok/GrokStatusProbe.swift and the existing Grok credits flow, then compare its session handling and usage model with CursorSandUsage.swift. Implementing the first-party bot.usage request requires Grok authentication, bounded WebSocket handling, response parsing, and menu-bar and JSON presentation. Done means the Grok card and JSON expose an active allowance or trial while failures and inactive meters leave the Credits bar unchanged.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
CodexBar's Grok provider (Sources/CodexBarCore/Providers/Grok/) currently surfaces only the weekly Credits pool (cli-chat-proxy.grok.com/v1/billing?format=credits / GetGrokCreditsConfig, with GrokBuild and GrokChat shares under Usage breakdown). Its secondary, tertiary, and extraRateWindows remain empty (GrokStatusProbe.swift:95-118).
Meanwhile, Grok Bot weekly usage is only surfaced under the Cursor provider (CursorSandUsage.swift), and PR #4426 was rightly closed because it read Cursor's cursor.com/api/dashboard/get-sand-usage-status account data and displayed it under the Grok provider.
However, xAI exposes a first-party Grok Bot usage RPC (bot.usage) directly under the Grok / xAI account via its Computer Hub (bot_relay) protocol, where SuperGrok subscriptions fund the meter (fundingPlan: "supergrok-heavy" / "supergrok-plus"). Supporting bot.usage inside the Grok provider lets Grok users see their Grok Credits and Grok Bot weekly allowance together using 100% first-party Grok credentials—without touching Cursor's session or crossing provider boundaries.
First-Party xAI Protocol Evidence (xai-org/grok-build)
-
Endpoint:
PROD_COMPUTER_HUB_WS_URL = "wss://computer-hub.grok.com/v1/tools"
(crates/codegen/xai-grok-shell-base/src/env.rs#L14) -
Handshake (
ConnectionKind::BotClient):
SendHelloMsg:{ "protocol_version": "1.0.0", "kind": "bot_client" }The hub replies with
HelloAckMsgadvertising"bot.usage"incapabilities(BOT_RELAY_CAPABILITIES).
(crates/common/xai-tool-protocol/src/connection.rs#L11-L26,handshake.rs#L19-L56) -
RPC Method (
bot.usage):
Documented as "Caller-scoped weekly Grok Bot usage summary. Cold — never wakes the box."
(crates/common/xai-tool-protocol/src/methods.rs#L162-L164){ "jsonrpc": "2.0", "id": 1, "method": "bot.usage", "params": {} } -
Response Schema (
BotUsageResult):
Defined incrates/common/xai-tool-protocol/src/bot_relay.rs#L377-L420(with round-trip fixture atbot_relay.rs#L1545-L1596):{ "usagePercent": 12.8, "currentPeriodStartMs": 1756000000000, "nextResetAtMs": 1756604800000, "hasAvailableUsage": true, "hasNonZeroIncludedLimit": true, "includedLimitZero": false, "trial": false, "isTeamSeat": false, "fundingPlan": "supergrok-heavy", "planLabel": "SuperGrok Heavy", "manageUrl": "https://example.com/usage", "onDemandEligible": true, "onDemandEnabled": false }
Expected Behavior
- Query
bot.usageusing Grok's own authenticated session (~/.grok/auth.jsonbearer orgrok.comweb cookies—never Cursor's session) under a short bounded timeout. - Fail soft: if
bot.usagetimes out, errors, or reports no active personal meter (includedLimitZero == true && !trial, or missingusagePercent), preserve the primary Grok Credits bar unchanged. - When an active Grok Bot allowance or unexpired trial is present, surface it alongside the Weekly Credits bar on the Grok card and
codexbar usage --provider grok --json(asextraRateWindowsorsecondary, with a selectableGrok Bot/GBmenu-bar metric token, matching the paid 7-day pace vs unpaced trial semantics inCursorSandUsageStatus).
Related (Not Duplicates)
- #4426 (closed PR): Attempted to show Cursor's
cursor.com/api/dashboard/get-sand-usage-statusdata under the Grok provider. Closed because a provider must never display data sourced from a different provider's account. This issue uses xAI's own first-partybot.usagesurface on the Grok account. - #4432 (open): Tracks
POST https://grok.com/rest/rate-limitsper-model consumer chat caps (Fast / Expert / Heavy query & token counters), which is separate from the weekly Grok Bot (bot.usage) allowance. - #3309 / #4207 / #4269 / #4340 (closed): Cover Grok Bot under the Cursor provider only.
Environment
- CodexBar 0.77.0 (macOS)
- Grok CLI 1.0.63 (
SuperGrok Heavy)
- Lingua principale
- Swift
- Stelle
- 22.9k
- Fork
- 2.2k
- Merge medio
- 1g 1h
- PR unite (30g)
- 399
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di steipete/CodexBar
-
Cursor: layout editor labels the monthly Auto window "Weekly", and Grok Bot has no reset elementApertaclawsweeper:fix-shape-clear clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
steipete/CodexBar#4873 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Linux serve: dashboard snapshots remain stuck at 504 while /health stays healthy; restart recoversApertaclawsweeper:needs-maintainer-review clawsweeper:no-new-fix-pr impact:other issue-rating: 🦪 silver shellfish P2
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
steipete/CodexBar#4867 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Pace predictionApertaclawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr issue-rating: 🌊 off-meta tidepool P3
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
steipete/CodexBar#4850 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
clawsweeper:fix-shape-clear clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:other issue-rating: 🦞 diamond lobster P2
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
steipete/CodexBar#4846 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
clawsweeper:fix-shape-clear clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:auth-provider impact:ux-friction issue-rating: 🦞 diamond lobster P2
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
steipete/CodexBar#4845 · 4 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di steipete/CodexBar
Issue simili
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
RodnaPamet/agrent-ios#499 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
area: agents
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
manaflow-ai/cmux#29762 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
AI summaries can show reasoning text instead of the answerForse già presa @yashiels l’ha presa oggi. Apertaclawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
steipete/RepoBar#156 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno