mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-09-02 01:20:23 +08:00
feat: add API key load balancing for providers (#676)
Support multiple API keys per provider with random selection for load balancing. When AI_MODELS_CONFIG has multiple apiKeyEnv values for a provider, requests will randomly select one available key. - Update schema to accept apiKeyEnv as string or string array - Add random key selection in resolveApiKey() - Update validation to check at least one key exists - Add tests for array format support
This commit is contained in:
@@ -73,8 +73,9 @@ export interface FlattenedModel {
|
||||
source?: "user" | "server"
|
||||
// Whether this model is the server default (matches AI_MODEL env var)
|
||||
isDefault?: boolean
|
||||
// Custom env var names for server models (allows multiple API keys per provider)
|
||||
apiKeyEnv?: string
|
||||
// Custom env var name(s) for server models
|
||||
// Can be a single string or array of strings for load balancing
|
||||
apiKeyEnv?: string | string[]
|
||||
baseUrlEnv?: string
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user