mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-30 08:22:34 +00:00
feat(ollama): 支持 Cloud 官方用量自动刷新
This commit is contained in:
@@ -975,6 +975,53 @@ export interface UpstreamBillingProbeResult {
|
||||
error?: string
|
||||
}
|
||||
|
||||
export type OllamaCloudUsageStatus = 'ok' | 'unauthorized' | 'failed'
|
||||
|
||||
export interface OllamaCloudUsageWindow {
|
||||
used_percent: number
|
||||
reset_at?: string
|
||||
reset_text?: string
|
||||
}
|
||||
|
||||
export interface OllamaCloudUsageModel {
|
||||
model: string
|
||||
window: 'five_hour' | 'seven_day'
|
||||
requests: number
|
||||
}
|
||||
|
||||
export interface OllamaCloudUsageData {
|
||||
plan?: string
|
||||
five_hour?: OllamaCloudUsageWindow
|
||||
seven_day?: OllamaCloudUsageWindow
|
||||
balance?: string
|
||||
models?: OllamaCloudUsageModel[]
|
||||
}
|
||||
|
||||
export interface OllamaCloudUsageSnapshot {
|
||||
status: OllamaCloudUsageStatus
|
||||
data?: OllamaCloudUsageData
|
||||
fetched_at?: string
|
||||
last_attempt_at: string
|
||||
next_refresh_at: string
|
||||
failure_count?: number
|
||||
http_status?: number
|
||||
last_error?: string
|
||||
}
|
||||
|
||||
export interface OllamaCloudUsageState {
|
||||
account_id: number
|
||||
eligible: boolean
|
||||
configured: boolean
|
||||
auto_refresh_enabled: boolean
|
||||
encryption_key_configured: boolean
|
||||
snapshot?: OllamaCloudUsageSnapshot
|
||||
}
|
||||
|
||||
export interface OllamaCloudUsageSettings {
|
||||
enabled: boolean
|
||||
interval_minutes: number
|
||||
}
|
||||
|
||||
export interface Account {
|
||||
id: number
|
||||
name: string
|
||||
@@ -987,6 +1034,7 @@ export interface Account {
|
||||
// 改为通过 credentials_status.has_<key> 暴露存在性。
|
||||
credentials?: Record<string, unknown>
|
||||
credentials_status?: Record<string, boolean>
|
||||
ollama_cloud_usage?: OllamaCloudUsageState
|
||||
// Extra fields including Codex usage, OpenAI compact capability, and model-level rate limits.
|
||||
extra?: (CodexUsageSnapshot & OpenAICompactState & {
|
||||
model_rate_limits?: Record<string, { rate_limited_at: string; rate_limit_reset_at: string }>
|
||||
|
||||
Reference in New Issue
Block a user