mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-26 15:26:26 +00:00
fix(grok): recognize probed Free cache accounts
This commit is contained in:
1 parent
f041b5cf0a
commit
08ea29428d
3 files changed
+109
-5
No files matched your search
@@ -296,6 +296,31 @@ func TestGrokFreeMessagesFunctionToolCacheRouteRequiresKnownFreeTier(t *testing.
|
||||
}(),
|
||||
wantMix: true,
|
||||
},
|
||||
{
|
||||
name: "free successful billing has blank plan",
|
||||
account: func() *Account {
|
||||
a := healthyGrokOAuthGatewayTestAccount(9111, "access-token")
|
||||
a.Extra = map[string]any{grokBillingExtraKey: map[string]any{
|
||||
"status_code": http.StatusOK,
|
||||
"source": "billing_probe",
|
||||
"monthly_updated_at": "2026-07-15T05:00:00Z",
|
||||
}}
|
||||
return a
|
||||
}(),
|
||||
wantMix: true,
|
||||
},
|
||||
{
|
||||
name: "free rolling token quota",
|
||||
account: func() *Account {
|
||||
a := healthyGrokOAuthGatewayTestAccount(9112, "access-token")
|
||||
a.Extra = map[string]any{grokQuotaSnapshotExtraKey: map[string]any{
|
||||
"headers_observed": true,
|
||||
"tokens": map[string]any{"limit": grokFreeRolling24hTokenLimit},
|
||||
}}
|
||||
return a
|
||||
}(),
|
||||
wantMix: true,
|
||||
},
|
||||
{
|
||||
name: "supergrok remains unchanged",
|
||||
account: func() *Account {
|
||||
@@ -304,6 +329,33 @@ func TestGrokFreeMessagesFunctionToolCacheRouteRequiresKnownFreeTier(t *testing.
|
||||
return a
|
||||
}(),
|
||||
},
|
||||
{
|
||||
name: "paid billing overrides stale free quota",
|
||||
account: func() *Account {
|
||||
a := healthyGrokOAuthGatewayTestAccount(9121, "access-token")
|
||||
a.Extra = map[string]any{
|
||||
grokBillingExtraKey: map[string]any{"plan": "SuperGrok", "status_code": http.StatusOK},
|
||||
grokQuotaSnapshotExtraKey: map[string]any{
|
||||
"headers_observed": true,
|
||||
"tokens": map[string]any{"limit": grokFreeRolling24hTokenLimit},
|
||||
},
|
||||
}
|
||||
return a
|
||||
}(),
|
||||
},
|
||||
{
|
||||
name: "partial billing without monthly evidence remains unknown",
|
||||
account: func() *Account {
|
||||
a := healthyGrokOAuthGatewayTestAccount(9122, "access-token")
|
||||
a.Extra = map[string]any{grokBillingExtraKey: map[string]any{
|
||||
"status_code": http.StatusOK,
|
||||
"source": "billing_probe",
|
||||
"partial": true,
|
||||
"failed_windows": []string{"monthly"},
|
||||
}}
|
||||
return a
|
||||
}(),
|
||||
},
|
||||
{
|
||||
name: "unknown tier remains unchanged",
|
||||
account: healthyGrokOAuthGatewayTestAccount(913, "access-token"),
|
||||
|
||||
Reference in new issue
Block a user