From 91497dc2ee5e30f43b3bc6679c1739f068e8adf4 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Fri, 28 Mar 2025 17:57:26 -1000 Subject: [PATCH] feat: Append OpenRouter API key to oauth-keys.env instead of overwriting --- aider/onboarding.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aider/onboarding.py b/aider/onboarding.py index 7fdaabe23..b88c13ade 100644 --- a/aider/onboarding.py +++ b/aider/onboarding.py @@ -338,8 +338,7 @@ def start_openrouter_oauth_flow(io, analytics): config_dir = os.path.expanduser("~/.aider") os.makedirs(config_dir, exist_ok=True) key_file = os.path.join(config_dir, "oauth-keys.env") - # append ai! - with open(key_file, "w", encoding="utf-8") as f: + with open(key_file, "a", encoding="utf-8") as f: f.write(f'OPENROUTER_API_KEY="{api_key}"\n') io.tool_output(f"Successfully obtained OpenRouter API key and saved it to {key_file}") io.tool_output("Aider will load this key automatically in future sessions.")