feat(models): add auth profile cooldown for api key pools

This commit is contained in:
William Valentin
2026-02-19 11:45:55 -08:00
parent baa53f91d9
commit 6b56d9e223
9 changed files with 175 additions and 22 deletions
+30
View File
@@ -599,6 +599,36 @@ describe('configSchema — models auth_mode', () => {
});
expect(result.models.default.api_keys).toEqual(['sk-1', 'sk-2']);
});
it('accepts auth_profile_cooldown_ms per model tier', () => {
const result = configSchema.parse({
...minimalConfig,
models: {
default: {
provider: 'openai',
model: 'gpt-4o',
api_keys: ['sk-1', 'sk-2'],
auth_profile_cooldown_ms: 30000,
},
},
});
expect(result.models.default.auth_profile_cooldown_ms).toBe(30000);
});
it('rejects invalid auth_profile_cooldown_ms values', () => {
expect(() => {
configSchema.parse({
...minimalConfig,
models: {
default: {
provider: 'openai',
model: 'gpt-4o',
auth_profile_cooldown_ms: -1,
},
},
});
}).toThrow(/auth_profile_cooldown_ms/i);
});
});
describe('configSchema — matrix', () => {