feat(grok): improve free quota probing and usage
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
*/
|
||||
|
||||
import { apiClient } from '../client'
|
||||
import type { GrokBillingSummary, GrokQuotaWindow, WindowStats } from '@/types'
|
||||
|
||||
export type { GrokBillingSummary, GrokQuotaWindow } from '@/types'
|
||||
|
||||
export interface GrokAuthUrlResponse {
|
||||
auth_url: string
|
||||
@@ -39,13 +42,6 @@ export interface GrokTokenInfo {
|
||||
[key: string]: unknown
|
||||
}
|
||||
|
||||
export interface GrokQuotaWindow {
|
||||
limit?: number | null
|
||||
remaining?: number | null
|
||||
reset_unix?: number | null
|
||||
reset_at?: string | null
|
||||
}
|
||||
|
||||
export interface GrokQuotaSnapshot {
|
||||
requests?: GrokQuotaWindow | null
|
||||
tokens?: GrokQuotaWindow | null
|
||||
@@ -62,13 +58,18 @@ export interface GrokQuotaSnapshot {
|
||||
}
|
||||
|
||||
export interface GrokQuotaProbeResult {
|
||||
source: 'active_probe'
|
||||
model: string
|
||||
source: 'active_probe' | 'billing_probe' | 'hybrid_probe'
|
||||
model?: string
|
||||
billing?: GrokBillingSummary | null
|
||||
snapshot?: GrokQuotaSnapshot | null
|
||||
local_usage_7d?: WindowStats | null
|
||||
local_usage_monthly?: WindowStats | null
|
||||
status_code?: number
|
||||
headers_observed: boolean
|
||||
reset_supported: boolean
|
||||
fetched_at: number
|
||||
persisted?: boolean
|
||||
probe_error?: string
|
||||
}
|
||||
|
||||
export interface GrokQuotaResetResult {
|
||||
|
||||
Reference in New Issue
Block a user