mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-11-01 00:27:30 +00:00
Merge pull request #4385 from yardbirds0/feat/upstream-billing-probe
feat: 增加上游 Sub2API 计费倍率探测与账号展示
This commit is contained in:
@@ -865,6 +865,48 @@ export interface TempUnschedulableStatus {
|
||||
state?: TempUnschedulableState
|
||||
}
|
||||
|
||||
export interface UpstreamBillingData {
|
||||
object: 'sub2api.key_billing'
|
||||
schema_version: 1
|
||||
billing_scope: 'token'
|
||||
group_rate_multiplier: number
|
||||
user_rate_multiplier?: number
|
||||
resolved_rate_multiplier: number
|
||||
peak_rate_enabled: boolean
|
||||
peak_start?: string
|
||||
peak_end?: string
|
||||
peak_rate_multiplier?: number
|
||||
applied_peak_multiplier?: number
|
||||
effective_rate_multiplier: number
|
||||
timezone?: string
|
||||
observed_at: string
|
||||
}
|
||||
|
||||
export type UpstreamBillingProbeStatus = 'ok' | 'unsupported' | 'failed'
|
||||
|
||||
export interface UpstreamBillingProbeSnapshot {
|
||||
status: UpstreamBillingProbeStatus
|
||||
data?: UpstreamBillingData
|
||||
received_at?: string
|
||||
fresh_until?: string
|
||||
last_attempt_at: string
|
||||
next_probe_at: string
|
||||
failure_count?: number
|
||||
http_status?: number
|
||||
last_error?: string
|
||||
}
|
||||
|
||||
export interface UpstreamBillingProbeSettings {
|
||||
enabled: boolean
|
||||
interval_minutes: number
|
||||
}
|
||||
|
||||
export interface UpstreamBillingProbeResult {
|
||||
account_id: number
|
||||
snapshot?: UpstreamBillingProbeSnapshot
|
||||
error?: string
|
||||
}
|
||||
|
||||
export interface Account {
|
||||
id: number
|
||||
name: string
|
||||
@@ -881,6 +923,8 @@ export interface Account {
|
||||
extra?: (CodexUsageSnapshot & OpenAICompactState & {
|
||||
model_rate_limits?: Record<string, { rate_limited_at: string; rate_limit_reset_at: string }>
|
||||
antigravity_credits_overages?: Record<string, { activated_at: string; active_until: string }>
|
||||
upstream_billing_probe_enabled?: boolean
|
||||
upstream_billing_probe?: UpstreamBillingProbeSnapshot
|
||||
} & Record<string, unknown>)
|
||||
proxy_id: number | null
|
||||
proxy_fallback_origin_id?: number | null
|
||||
|
||||
Reference in New Issue
Block a user