refactor: Update OpenRouter onboarding messages and flow

This commit is contained in:
Paul Gauthier 2025-03-28 18:03:04 -10:00 committed by Paul Gauthier (aider)
parent 91497dc2ee
commit 477f9eb4ec

View file

@ -56,13 +56,13 @@ def offer_openrouter_oauth(io, analytics):
""" """
# No API keys found - Offer OpenRouter OAuth # No API keys found - Offer OpenRouter OAuth
io.tool_warning( io.tool_warning(
"No API key environment variables found (e.g., OPENAI_API_KEY, ANTHROPIC_API_KEY...)." "No model was specified and no API keys were provided."
) )
io.tool_output("OpenRouter provides free and paid access to many LLMs.")
# Use confirm_ask which handles non-interactive cases # Use confirm_ask which handles non-interactive cases
if io.confirm_ask( if io.confirm_ask(
"Authenticate with OpenRouter via browser to get an API key?", "Would you like to login to OpenRouter or create a free account?",
default="y", default="y",
group="openrouter_oauth",
): ):
analytics.event("oauth_flow_initiated", provider="openrouter") analytics.event("oauth_flow_initiated", provider="openrouter")
openrouter_key = start_openrouter_oauth_flow(io, analytics) openrouter_key = start_openrouter_oauth_flow(io, analytics)
@ -285,7 +285,10 @@ def start_openrouter_oauth_flow(io, analytics):
io.tool_output( io.tool_output(
"\nPlease open the following URL in your web browser to authorize Aider with OpenRouter:" "\nPlease open the following URL in your web browser to authorize Aider with OpenRouter:"
) )
io.tool_output()
print(auth_url) print(auth_url)
MINUTES=5 # ai!
io.tool_output("\nWaiting for authentication... (Timeout: 2 minutes)") io.tool_output("\nWaiting for authentication... (Timeout: 2 minutes)")
try: try: