Skip to content

Commit 384b300

Browse files
committed
fix(cli): Display info message when api key is an empty string
1 parent b9bb6e0 commit 384b300

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/together/lib/cli/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ def main(
6363
os.environ.setdefault("TOGETHER_LOG", "debug")
6464
setup_logging() # Must run this again here to allow the new logging configuration to take effect
6565

66+
if api_key == "":
67+
click.secho(
68+
"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",
69+
fg="red",
70+
)
71+
click.secho("\nYou can find your api key at https://api.together.xyz/settings/api-keys", fg="yellow")
72+
sys.exit(1)
73+
6674
try:
6775
ctx.obj = together.Together(
6876
api_key=api_key,

0 commit comments

Comments
 (0)