diff --git a/aider/main.py b/aider/main.py index a8c9de437..f47ed36cb 100644 --- a/aider/main.py +++ b/aider/main.py @@ -140,11 +140,13 @@ def format_settings(parser, args): def scrub_sensitive_info(args, text): - # Replace sensitive information with placeholder + # Replace sensitive information with last 4 characters if text and args.openai_api_key: - text = text.replace(args.openai_api_key, "***") + last_4 = args.openai_api_key[-4:] + text = text.replace(args.openai_api_key, f"...{last_4}") if text and args.anthropic_api_key: - text = text.replace(args.anthropic_api_key, "***") + last_4 = args.anthropic_api_key[-4:] + text = text.replace(args.anthropic_api_key, f"...{last_4}") return text