mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 14:16:43 +00:00
fix(api): skip API key prompt for local Ollama preset
Local Ollama doesn't require an API key, but the CLI was still prompting for one. This adds a `requiresApiKey` property to provider presets to control whether the API key step is required. - Add `requiresApiKey` property to ProviderPreset interface - Set `requiresApiKey: false` for local Ollama (no key needed) - Set `requiresApiKey: true` for OpenRouter and Ollama Cloud - Skip API key prompt and show info message when not required Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,8 @@ export interface ProviderPreset {
|
||||
apiKeyPlaceholder: string;
|
||||
apiKeyHint: string;
|
||||
category: PresetCategory;
|
||||
/** Whether API key is required (false for local providers like Ollama) */
|
||||
requiresApiKey?: boolean;
|
||||
/** Additional env vars for thinking mode, etc. */
|
||||
extraEnv?: Record<string, string>;
|
||||
/** Enable always thinking mode */
|
||||
@@ -42,6 +44,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
||||
apiKeyPlaceholder: 'sk-or-...',
|
||||
apiKeyHint: 'Get your API key at openrouter.ai/keys',
|
||||
category: 'recommended',
|
||||
requiresApiKey: true,
|
||||
},
|
||||
{
|
||||
id: 'ollama',
|
||||
@@ -53,6 +56,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
||||
apiKeyPlaceholder: 'ollama',
|
||||
apiKeyHint: 'Install Ollama from ollama.com - no API key needed for local',
|
||||
category: 'recommended',
|
||||
requiresApiKey: false,
|
||||
},
|
||||
// Alternative providers
|
||||
{
|
||||
@@ -152,6 +156,7 @@ export const PROVIDER_PRESETS: ProviderPreset[] = [
|
||||
apiKeyPlaceholder: 'YOUR_OLLAMA_CLOUD_API_KEY',
|
||||
apiKeyHint: 'Get your API key at ollama.com',
|
||||
category: 'alternative',
|
||||
requiresApiKey: true,
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user