feat(cli): add gemini-auth command and alias support

This commit is contained in:
William Valentin
2026-02-21 11:39:23 -08:00
parent 7c121b82c6
commit e9cb1d7c1a
10 changed files with 350 additions and 10 deletions
+5 -1
View File
@@ -4,6 +4,7 @@ import type { ModelClient, RetryConfig, ModelTier } from '../models/index.js';
import { logger } from '../logger.js';
import { getZaiApiKey } from '../auth/zai.js';
import { getAnthropicApiKey, getAnthropicAuthToken } from '../auth/anthropic.js';
import { getGeminiApiKey } from '../auth/gemini.js';
import { getOpenAIApiKey, loadStoredOpenAIAuth } from '../auth/openai.js';
type AuthMode = 'auto' | 'api_key' | 'oauth';
@@ -223,10 +224,13 @@ export function createClientFromConfig(cfg: ModelConfig): ModelClient {
authToken: cfg.auth_token,
});
case 'gemini':
{
const apiKey = cfg.api_key ?? getGeminiApiKey() ?? undefined;
return new GeminiClient({
model: cfg.model,
apiKey: cfg.api_key,
apiKey,
});
}
case 'openrouter':
{
const keys = resolveApiKeyPool(cfg, 'OPENROUTER_API_KEY');