import os

import typer
from rich.console import Console

console = Console()


def authenticate(api_key: str = typer.Argument(help="Enter the Gemini API Key")):
    """
    Authenticate with LLM
    """
    if not api_key:
        console.print("[bold red]Error:[/bold red] API key cannot be empty")
        raise typer.Exit(code=1)

    os.environ["GEMINI_API_KEY"] = api_key
    console.print("[bold green]Authenticated successfully![/bold green]")
