From 384b3008686f31c875c81ce441cde9bf246b4f65 Mon Sep 17 00:00:00 2001 From: Blaine Kasten Date: Sat, 21 Feb 2026 13:40:59 -0600 Subject: [PATCH] fix(cli): Display info message when api key is an empty string --- src/together/lib/cli/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/together/lib/cli/__init__.py b/src/together/lib/cli/__init__.py index 7140e050..7c56290b 100644 --- a/src/together/lib/cli/__init__.py +++ b/src/together/lib/cli/__init__.py @@ -63,6 +63,14 @@ def main( os.environ.setdefault("TOGETHER_LOG", "debug") setup_logging() # Must run this again here to allow the new logging configuration to take effect + if api_key == "": + click.secho( + "Error: api key missing.\n\nThe api_key must be set either by passing --api-key to the command or by setting the TOGETHER_API_KEY environment variable", + fg="red", + ) + click.secho("\nYou can find your api key at https://api.together.xyz/settings/api-keys", fg="yellow") + sys.exit(1) + try: ctx.obj = together.Together( api_key=api_key,