feat: add multi-key auth profile rotation for model providers

This commit is contained in:
William Valentin
2026-02-18 10:29:54 -08:00
parent f341149ac7
commit 8e3cd2e0ba
10 changed files with 271 additions and 39 deletions
+20
View File
@@ -28,6 +28,16 @@ describe('createClientFromConfig', () => {
expect(client.constructor.name).toBe('AnthropicClient');
});
it('creates RotatingModelClient for anthropic when api_keys are provided', async () => {
const { createClientFromConfig } = await loadFactory();
const client = createClientFromConfig({
provider: 'anthropic',
model: 'claude-sonnet-4-5-20250514',
api_keys: ['sk-ant-1', 'sk-ant-2'],
});
expect(client.constructor.name).toBe('RotatingModelClient');
});
it('creates OpenAIClient for openai provider', async () => {
const { createClientFromConfig } = await loadFactory();
const client = createClientFromConfig({
@@ -38,6 +48,16 @@ describe('createClientFromConfig', () => {
expect(client.constructor.name).toBe('OpenAIClient');
});
it('creates RotatingModelClient for openai when api_keys are provided', async () => {
const { createClientFromConfig } = await loadFactory();
const client = createClientFromConfig({
provider: 'openai',
model: 'gpt-4o',
api_keys: ['sk-1', 'sk-2'],
});
expect(client.constructor.name).toBe('RotatingModelClient');
});
it('creates OllamaClient for ollama provider', async () => {
const { createClientFromConfig } = await loadFactory();
const client = createClientFromConfig({