/** * Authentication helper utilities * Handles API key retrieval from multiple sources with proper fallback logic */ /** * Get API key with proper fallback logic: * 1. Environment variable (GROK_API_KEY) * 2. User settings file (~/.grok/user-settings.json) * 3. Command-line argument (passed explicitly) * * @param explicitApiKey - API key passed via command-line argument (highest priority) * @returns API key or undefined if not found */ export declare function getApiKey(explicitApiKey?: string): string | undefined; /** * Get base URL with proper fallback logic: * 1. Explicit base URL from command-line argument * 2. Environment variable (GROK_BASE_URL) * 3. User settings file (~/.grok/user-settings.json) * 4. Default value * * @param explicitBaseURL - Base URL passed via command-line argument (highest priority) * @param defaultBaseURL - Default base URL to use if none found (default: https://api.x.ai/v1) * @returns Base URL */ export declare function getBaseURL(explicitBaseURL?: string, defaultBaseURL?: string): string; /** * Get model with proper fallback logic: * 1. Explicit model from command-line argument * 2. Environment variable (GROK_MODEL) * 3. Project-specific model setting * 4. User's default model * 5. Default value * * @param explicitModel - Model passed via command-line argument (highest priority) * @param defaultModel - Default model to use if none found (default: grok-code-fast-1) * @returns Model name */ export declare function getModel(explicitModel?: string, defaultModel?: string): string; /** * Validate that required authentication is present * Throws an error with helpful message if API key is missing * * @param apiKey - API key to validate * @throws Error if API key is undefined or empty */ export declare function validateApiKey(apiKey: string | undefined): asserts apiKey is string; /** * Get all authentication configuration with proper fallbacks * Convenience function that combines all auth-related getters * * @param options - Optional explicit values from command-line arguments * @returns Complete authentication configuration */ export declare function getAuthConfig(options?: { apiKey?: string; baseURL?: string; model?: string; }): { apiKey: string | undefined; baseURL: string; model: string; };