Appearance
Authentication
The CLI needs an API key to communicate with BetterPrompt. You can authenticate via a browser flow or by providing a key directly.
Browser login
Opens your browser to authenticate and receive an API key automatically:
bash
betterprompt loginThe CLI starts a local callback server (port 22450–22460), opens https://betterprompt.me/api-keys, and saves the key once you complete the flow. The login URL is also printed in the terminal if the browser doesn't open.
API key auth
Set an API key directly (useful for CI/scripts):
bash
betterprompt auth --api-key bp_sk_abc123Without --api-key, this command prompts interactively.
You can also set the key via config:
bash
betterprompt config set apiKey bp_sk_abc123Check identity
bash
betterprompt whoamiReturns your username and account info. Use --json for machine-readable output.
Check credits
bash
betterprompt creditsReturns your current credit balance. Credits are consumed when you generate output.