feat: add provider-key concurrent limit (#352)

* feat: add provider-key concurrent limit

* Fix provider key concurrent limit checks

---------

Co-authored-by: fawney19 <elky0401@gmail.com>
This commit is contained in:
Kayphoon
2026-05-03 01:55:23 +08:00
committed by GitHub
parent 11c5884d4f
commit fe27fb17fb
23 changed files with 1827 additions and 62 deletions

View File

@@ -146,6 +146,7 @@ export async function addProviderKey(
rate_multipliers?: Record<string, number> | null // 按 API 格式的成本倍率
internal_priority?: number
rpm_limit?: number | null // RPM 限制(留空=自适应模式)
concurrent_limit?: number | null // 并发请求上限(留空或 0=不限制)
cache_ttl_minutes?: number
max_probe_interval_minutes?: number
allowed_models?: AllowedModels
@@ -177,6 +178,7 @@ export async function updateProviderKey(
internal_priority: number
global_priority_by_format: Record<string, number> | null // 按 API 格式的全局优先级
rpm_limit: number | null // RPM 限制(留空=自适应模式)
concurrent_limit: number | null // 并发请求上限(留空或 0=不限制)
cache_ttl_minutes: number
max_probe_interval_minutes: number
allowed_models: AllowedModels

View File

@@ -243,6 +243,7 @@ export interface EndpointAPIKey {
internal_priority: number // Key 内部优先级
global_priority_by_format?: Record<string, number> | null // 按 endpoint signature 的全局优先级
rpm_limit?: number | null // RPM 速率限制 (1-10000)null 表示自适应模式
concurrent_limit?: number | null // 并发请求上限null/0 表示不限制
allowed_models?: AllowedModels // 允许使用的模型列表null=不限制)
capabilities?: Record<string, boolean> | null // 能力标签配置(如 cache_1h, context_1m
// 缓存与熔断配置
@@ -395,6 +396,7 @@ export interface EndpointAPIKeyUpdate {
internal_priority?: number
global_priority_by_format?: Record<string, number> | null // 按 API 格式的全局优先级
rpm_limit?: number | null // RPM 速率限制 (1-10000)null 表示切换为自适应模式
concurrent_limit?: number | null // 并发请求上限null/0 表示不限制
allowed_models?: AllowedModels
capabilities?: Record<string, boolean> | null
cache_ttl_minutes?: number