Skip to main content

Authenticating via JWT

In Sphinx, you can either authenticate with your user account by calling
sphinx-cli auth login
This will create a .sphinx directory in your home folder with a token that will need to be refreshed every 30 days.

Authenticating via API Key

Obtaining Your API Key

You can obtain your Sphinx API key from your Sphinx Dashboard. Go to your account settings and generate a new API key if you do not yet have one. Keep your API key secure and do not share it.

Using a Sphinx API key

Set the SPHINX_API_KEY environment variable to your API key before running Sphinx CLI commands: On macOS/Linux:
export SPHINX_API_KEY=sk-xxxxxxxxxxxxxxxxxxxx
sphinx-cli chat --notebook-filepath <path> --prompt "<prompt>"
On Windows (Command Prompt):
set SPHINX_API_KEY=sk-xxxxxxxxxxxxxxxxxxxx
sphinx-cli chat --notebook-filepath <path> --prompt "<prompt>"
On Windows (Powershell):
$env:SPHINX_API_KEY="sk-xxxxxxxxxxxxxxxxxxxx"
sphinx-cli chat --notebook-filepath <path> --prompt "<prompt>"
If the SPHINX_API_KEY environment variable is set, Sphinx CLI will use it for authentication without requiring an interactive login.