Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public enum GrokCreditsProxyFetcher {

if resetsAt != nil {
return GrokWebBillingSnapshot(
usedPercent: 0,
usedPercent: nil,
resetsAt: resetsAt,
subscriptionTier: subscriptionTier)
}
Expand Down
10 changes: 5 additions & 5 deletions Tests/CodexBarTests/GrokCreditsProxyFetcherTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ struct GrokCreditsProxyFetcherTests {
}

@Test
func `treats a period without usage as zero percent`() throws {
func `treats a period without usage as unknown`() throws {
let snapshot = try GrokCreditsProxyFetcher.parseSnapshot(
Data(
"""
Expand All @@ -109,7 +109,7 @@ struct GrokCreditsProxyFetcherTests {
""".utf8))
let expectedReset = try Self.date("2026-08-13T00:00:00.123Z")

#expect(snapshot.usedPercent == 0)
#expect(snapshot.usedPercent == nil)
#expect(snapshot.resetsAt == expectedReset)
#expect(snapshot.subscriptionTier == nil)
}
Expand All @@ -134,7 +134,7 @@ struct GrokCreditsProxyFetcherTests {
let expectedReset = try Self.date("2026-08-23T18:42:45.537749+00:00")

#expect(snapshot.subscriptionTier == "SuperGrok Heavy")
#expect(snapshot.usedPercent == 0)
#expect(snapshot.usedPercent == nil)
#expect(snapshot.resetsAt == expectedReset)
}

Expand Down Expand Up @@ -184,7 +184,7 @@ struct GrokCreditsProxyFetcherTests {
""".utf8))
let expectedReset = try Self.date("2026-08-13T00:00:00Z")

#expect(snapshot.usedPercent == 0)
#expect(snapshot.usedPercent == nil)
#expect(snapshot.subscriptionTier == "SuperGrok Heavy")
#expect(snapshot.resetsAt == expectedReset)
}
Expand Down Expand Up @@ -231,7 +231,7 @@ struct GrokCreditsProxyFetcherTests {
""".utf8))
let expectedReset = try Self.date("2026-08-13T00:00:00Z")

#expect(snapshot.usedPercent == 0)
#expect(snapshot.usedPercent == nil)
#expect(snapshot.resetsAt == expectedReset)
}

Expand Down
2 changes: 1 addition & 1 deletion docs/grok.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ The grok.com billing gRPC-web endpoint remains a best-effort fallback.
`Accept: application/json`.
- Reads `config.creditUsagePercent`, falling back to
`onDemandUsed.val / onDemandCap.val * 100`. A parseable current period
without either value represents zero usage. The reset timestamp comes from
without either value represents unknown usage. The reset timestamp comes from
`config.currentPeriod.end`, then `config.billingPeriodEnd`.
- Plan name does not come from the credits payload. After a successful
auth-file or SuperGrok OAuth web billing result (CLI-proxy) or the team
Expand Down