MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / handle_login

Function handle_login

src/cli.py:515–562  ·  view source on GitHub ↗

Interactive API configuration.

()

Source from the content-addressed store, hash-verified

513
514
515def handle_login():
516 """Interactive API configuration."""
517 console = Console()
518 console.print("\n[bold blue]ClawCodex - API Configuration[/bold blue]\n")
519
520 _show_provider_defaults_table()
521
522 from src.providers import PROVIDER_INFO
523 provider_names = list(PROVIDER_INFO.keys())
524
525 provider = Prompt.ask(
526 "Select LLM provider",
527 choices=provider_names,
528 default="anthropic"
529 )
530
531 info = PROVIDER_INFO[provider]
532
533 api_key = Prompt.ask(
534 f"Enter {provider.upper()} API Key",
535 password=True
536 )
537
538 if not api_key:
539 console.print("\n[red]Error: API Key cannot be empty[/red]")
540 return 1
541
542 console.print(f"\n[dim]Default:[/dim] {info['default_base_url']}")
543 base_url = Prompt.ask(
544 f"{provider.upper()} Base URL",
545 default=info["default_base_url"]
546 )
547
548 console.print(f"\n[dim]Available models:[/dim] {', '.join(info['available_models'])}")
549 console.print(f"[dim]Default:[/dim] [bold]{info['default_model']}[/bold]")
550 default_model = Prompt.ask(
551 f"{provider.upper()} Default Model",
552 default=info["default_model"]
553 )
554
555 from src.config import set_api_key, set_default_provider
556
557 set_api_key(provider, api_key=api_key, base_url=base_url, default_model=default_model)
558 set_default_provider(provider)
559
560 console.print(f"\n[green]✓ {provider.upper()} API Key saved successfully![/green]")
561 console.print(f"[green]✓ Default provider set to: {provider}[/green]\n")
562 return 0
563
564
565def show_config():

Callers 1

mainFunction · 0.85

Calls 4

set_api_keyFunction · 0.90
set_default_providerFunction · 0.90
joinMethod · 0.80

Tested by

no test coverage detected